data dimensions from R

35 views
Skip to first unread message

Jack Tanner

unread,
Apr 25, 2013, 4:16:22 PM4/25/13
to stan-...@googlegroups.com
Are data dimensions known on the stan side when called from rstan? In
JAGS, if I pass in a data matrix Q, I can do

data {
Q_dim <- dim(Q)
n_rows <- Q_dim[1] // number of columns in Q
n_cols <- Q_dim[2] // number of rows in Q
}

This means I don't have to pass in n_rows and n_cols as separate data
entries.

But it looks like I can't do that in stan. If I declare

data {
int<lower=0,upper=1> y[N];
}

then N is not known. Can stan determine N from dimensions of y?

Ben Goodrich

unread,
Apr 26, 2013, 6:54:19 PM4/26/13
to stan-...@googlegroups.com
No, you have to pass N from R using length(y) or possibly nrow(y).

Ben
Reply all
Reply to author
Forward
0 new messages