brms icon indicating copy to clipboard operation
brms copied to clipboard

brm_multiple fails on dimension mismatch for variational inference algorithms

Open wpetry opened this issue 2 years ago • 0 comments

Expected behavior: brm_multiple contains a ... to pass arguments to brm, suggesting that variational inference should be possible by changing the default algorithm = "sampling" to either "meanfield" or "fullrank".

Actual behavior: The model appears to converge, but encounters a dimension mismatch when returning the fit (from fit2 in reprex): Error in dim(s1) <- c(length(tidx), length(m) + 5L) : dims [product 110] do not match the length of object [99] Perhaps this is a simple fix? Or is there some deeper reason that variational inference can't be done for multiply-imputed datasets?

Reprex:

library(mice)
library(brms)

imp <- mice(nhanes2)
fit1 <- brm_multiple(bmi ~ age + hyp + chl, data = imp, chains = 2, algorithm = "sampling")  # fits
fit2 <- brm_multiple(bmi ~ age + hyp + chl, data = imp, chains = 2, algorithm = "meanfield")  # fails
fit3 <- brm_multiple(bmi ~ age + hyp + chl, data = imp, chains = 2, algorithm = "fullrank")  # fails

wpetry avatar Aug 05 '22 18:08 wpetry