Hello,

I am using Rstudio, cmdrstan and rethinking package to run bayesian models and I’d like to compare various models. As suggested in rethinking documentation one has to add log_lik=TRUE to the ulam() but when I add that it then I get an error. I’ve tried without imputation too (just removing NAs from my dataset and that doesn’t work). Any help would be appreciated!

My model setup:

diverse_f1 <-ulam(alist(

- grossProd ~ dnorm(mu, sigma),
- mu ← a + b*(zScore),
- zScore~dnorm(mu_x1, sigma_x1),
- a ~ dnorm(2, 30),
- b ~ dnorm(0, 100),
- mu_x1~dnorm(0,100),
- sigma_x1~dcauchy(0,2),
- sigma ~ dcauchy(0,2)
- ),data=d_full_f1, log_lik=TRUE, chains=4 , cores=4 ,start=list( B_impute = rep(0.5,26)))

And I get the error:

Found 26 NA values in grossProd and attempting imputation.

starting worker pid=13941 on localhost:11138 at 12:16:25.468

starting worker pid=13955 on localhost:11138 at 12:16:25.788

starting worker pid=13969 on localhost:11138 at 12:16:26.110

starting worker pid=13983 on localhost:11138 at 12:16:26.473

no parameter log_lik; sampling not done

no parameter log_lik; sampling not done

no parameter log_lik; sampling not done

no parameter log_lik; sampling not done

here are whatever error messages were returned

[[1]]

Stan model ‘anon_model’ does not contain samples.

[[2]]

Stan model ‘anon_model’ does not contain samples.

[[3]]

Stan model ‘anon_model’ does not contain samples.

[[4]]

Stan model ‘anon_model’ does not contain samples.

Stan model ‘anon_model’ does not contain samples.

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”

In addition: Warning message:

In .local(object, …) :

some chains had errors; consider specifying chains = 1 to debug