I'm writing a model using the ulam function in the rethinking package in rstan. The data list I'm providing it is all numeric (is.numeric returns true for each variable) on its own, but is not as a whole. How can I make it numeric so the model can run? Here's the data list and model code, as well as the full error message:
Data list:
datBIG <- list(
R = d$R,
P = d$P,
I = d$I,
N = d$N,
M = d$M,
B = d$B,
AID = d$AID)
Model:
mBIG<-ulam(alist(
V ~ dnorm(mu, sigma),
mu <- a[AID] + bR*R + bP*P + bI*I + bN*N + bM*M + bB*B,
a[AID] ~ dnorm(abar, sigma_a),
abar ~ dnorm(0, 0.2),
bR ~ dnorm(0, 0.2),
bP ~ dnorm(0, 0.2),
bI ~ dnorm(0, 0.2),
bN ~ dnorm(0, 0.2),
bM ~ dnorm(0, 0.2),
bB ~ dnorm(0, 0.2),
sigma_a ~ dexp(1),
sigma ~ dexp(1)
), data=datBIG, chains=1, cores=1, log_lik=TRUE)
And the error message:
Error in validObject(.Object) : invalid class “ulam” object: invalid object for slot "coef" in class "ulam": got class "NULL", should be or extend class "numeric"