Brms and IRT - kfold

I am fitting a one parameter logit IRT model, almost identical to what is described in the brms and IRT paper (https://arxiv.org/abs/1905.09501). Loo issues a warning, so I attempted k fold cross validation, using kfold(model). However, after K=10 fitted models, it throws out an error.

m_one_parameter_logistic <- bf(value ~ 0 + group + (1 | variable) + (1 | id))

prior1 <- 
  prior("normal(0, 3)", class = "sd", group = "variable") + 
  prior("normal(0, 1)", class = "sd", group = "id")

m1 <- brm(
  formula = m_one_parameter_logistic,
  data = stan_dat,
  family = brmsfamily("bernoulli", "logit"),
  prior=prior1,
  cores=8)

error in rbind(deparse.level, …) :
numbers of columns of arguments do not match

I imagine the solution is simple, but I can’t figure it out.

Many thanks in advance.

  • Catalina 10.15.7
  • brms 2.13.3

Can you make a minimal reproducible example for me to try out?

Hi Paul, I think I figured it out. I didn’t set seed in the brm call… saving and reloading the data and running kfold then didn’t work. Everything seems to now be in working order. Thanks.