I saw a Stan program where the data
block contained int person[N_obs]
. Is this creating an array of integers of size N_obs
that is called with person
?
Yes, exactly. Brackets behind the variable names specify an array of the type that was specified before the name. In addition, for collection data types like vector
and matrix
, you need to specify the size behind the data type:
vector[N] y;
matrix[N, K] X;
You can also create arrays of collection data types. For example
vector[N] X[K];
would specify an array of K
vectors of size N
.