简体   繁体   中英

What do brackets mean after a type is specified when declaring variables in Stan?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM