diff --git a/education/causal_iv_one-sided/case_study_02_IV_one-sided.html b/education/causal_iv_one-sided/case_study_02_IV_one-sided.html index ab80877c..b221c8d5 100644 --- a/education/causal_iv_one-sided/case_study_02_IV_one-sided.html +++ b/education/causal_iv_one-sided/case_study_02_IV_one-sided.html @@ -3381,12 +3381,12 @@

Data block

data {
-  int<lower=1> N;               // Sample size N 
-  int<lower=0, upper=1> Z[N];   // Treatment assigned Z
-  int<lower=0, upper=1> W[N];   // Treatment received W  
-  int<lower=0, upper=1> Y[N];   // Outcome Y  
+  int<lower=1> N;                    // Sample size N 
+  array[N] int<lower=0, upper=1> Z;  // Treatment assigned Z
+  array[N] int<lower=0, upper=1> W;  // Treatment received W
+  array[N] int<lower=0, upper=1> Y;  // Outcome Y
 }
-

For the model’s data inputs, we initially encode three observed binary variables (\(Z_{i}\), \(W_{i}^{\text{obs}}\), and \(Y_{i}^{\text{obs}}\)) along with the number of units in the sample (\(N\)).

+

For the model’s data inputs, we initially encode three observed binary variables (\(Z_{i}\), \(W_{i}^{\text{obs}}\), and \(Y_{i}^{\text{obs}}\)) along with the number of units in the sample (\(N\)). With the updated Stan syntax, we have shifted to using the array function for array declarations, which provides a more explicit and streamlined way to denote multidimensional structures. This modern syntax not only enhances clarity but also aligns with the direction of Stan’s evolution, ensuring compatibility with future versions.

Parameters block

diff --git a/education/causal_iv_one-sided/case_study_02_IV_one-sided.qmd b/education/causal_iv_one-sided/case_study_02_IV_one-sided.qmd index 50083e11..33c21533 100644 --- a/education/causal_iv_one-sided/case_study_02_IV_one-sided.qmd +++ b/education/causal_iv_one-sided/case_study_02_IV_one-sided.qmd @@ -192,14 +192,14 @@ The model-based estimation strategy offers several advantages over the moment-ba ``` stan data { - int N; // Sample size N - int Z[N]; // Treatment assigned Z - int W[N]; // Treatment received W - int Y[N]; // Outcome Y + int N; // Sample size N + array[N] int Z; // Treatment assigned Z + array[N] int W; // Treatment received W + array[N] int Y; // Outcome Y } ``` -For the model's data inputs, we initially encode three observed binary variables ($Z_{i}$, $W_{i}^{\text{obs}}$, and $Y_{i}^{\text{obs}}$) along with the number of units in the sample ($N$). +For the model's data inputs, we initially encode three observed binary variables ($Z_{i}$, $W_{i}^{\text{obs}}$, and $Y_{i}^{\text{obs}}$) along with the number of units in the sample ($N$). With the updated Stan syntax, we have shifted to using the `array` function for array declarations, which provides a more explicit and streamlined way to denote multidimensional structures. This modern syntax not only enhances clarity but also aligns with the direction of Stan's evolution, ensuring compatibility with future versions. #### Parameters block diff --git a/education/causal_iv_one-sided/stan/cace_with_exclusion.stan b/education/causal_iv_one-sided/stan/cace_with_exclusion.stan index 07ab4fdb..45ab60bd 100644 --- a/education/causal_iv_one-sided/stan/cace_with_exclusion.stan +++ b/education/causal_iv_one-sided/stan/cace_with_exclusion.stan @@ -1,8 +1,8 @@ data { - int N; // Sample size N - int Z[N]; // Treatment assigned Z - int W[N]; // Treatment received W - int Y[N]; // Outcome Y + int N; // Sample size N + array[N] int Z; // Treatment assigned Z + array[N] int W; // Treatment received W + array[N] int Y; // Outcome Y } parameters { @@ -57,3 +57,4 @@ model { } } } + diff --git a/education/causal_iv_one-sided/stan/cace_without_exclusion.stan b/education/causal_iv_one-sided/stan/cace_without_exclusion.stan index bfa2c5df..bace996d 100644 --- a/education/causal_iv_one-sided/stan/cace_without_exclusion.stan +++ b/education/causal_iv_one-sided/stan/cace_without_exclusion.stan @@ -1,8 +1,8 @@ data { - int N; // Sample size N - int Z[N]; // Treatment assigned Z - int W[N]; // Treatment received W - int Y[N]; // Outcome Y + int N; // Sample size N + array[N] int Z; // Treatment assigned Z + array[N] int W; // Treatment received W + array[N] int Y; // Outcome Y } parameters { @@ -59,3 +59,4 @@ model { } } } +