Data for K-length array of 2-vectors

Hi,
I am struggling to find the appropriate representation of data for arrays of vectors. For a normal vector y[N] I have used

y <- c(8.90680694580078,5.51890277862549)

but I don’t know how to do this when I have this form:

vector[2] y[N];

I have tried something like vectors in a vector, which apparently does not work

y <- c(c(1,2),c(3,4))

and I get the error message

"data y value  beyond int range"

Does anyone have any suggestions?

You should just be able to use an Nx2 matrix (assuming N is 50 here):

matrix(rnorm(100), nrow = 50, ncol = 2)

or a list of N length 2 vectors:

y = list()
for(n in 1:50) {
  y[[n]] = rnorm(2)
}

or there’s this strange structure thing that cmdstan uses as input:

structure(rnorm(100), .Dim = c(50, 2))

One of those seem like what you’re looking for?

Yes, thank you! Didn’t know cmdstan doesn’t like a matrix as input. The structure worked

The exact format is documented in the CmdStan manual. There’s a function in RStan, stan_rdump, that will write data into the format CmdStan expects.