WAIC and predictions from multivariate model with monotonic effects and imputation

I’ve estimated a multivariate model with multiple monotonic effects and imputation for three covariates. The model converges well, but I am currently unable to estimate WAIC or extract fitted values and predictions from it with brms functions. Here is a minimal example suggesting that this may reflect general behavior about the inclusion of monotonic effects in imputation models.

data<-
data.frame(x=sample(1:4, size=20, replace=TRUE), #ordinal predictor
y=sample(1:5, size=20, replace=TRUE), #ordinal response
z=c(rnorm(10,0,1), rep(NA, 10))) #missing covariate
impute.m<-
bf(z|mi() ~ mo(x) + mo(y))+gaussian()
response.m<-
bf(y ~ mo(x) + mi(z))+cumulative()
model<-
brm(impute.m + response.m, data=data)

Although I can extract posterior samples from the model, I get the following error when attempting to calculate WAIC or generate predictions

brms::WAIC(model, resp=“y”)
Error in seq_len(sdata$Jmo[i]) :
argument must be coercible to non-negative integer
fitted(model, resp=“y”)
Error in seq_len(sdata$Jmo[i]) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(sdata$Jmo[i]) : first element used of ‘length.out’ argument

The same issue occurs for predict(). How can I avoid these errors?

Thanks for your time!

Please also provide the following information in addition to your question:

  • Operating System: Windows 10 x64
  • brms Version: 2.7.0

I believe this error has been fixed in the github version of brms already, to be installed via

if (!requireNamespace("devtools")) {
  install.packages("devtools")
}
devtools::install_github("paul-buerkner/brms")
2 Likes

Thank you very much, Paul. I recently reformatted my PC and had not yet reinstalled the github version. I can confirm that things are working properly now.

1 Like