paul-buerkner/brms

Data-related post-processing for multiple imputation models via brm_multiple()

Open

#997 opened on Sep 11, 2020

View on GitHub
 (10 comments) (0 reactions) (0 assignees)R (1,402 stars) (220 forks)batch import
featuregood first issuepost-processing

Description

When I try to use bayes_R2() on a brmsfit_multiple object, I get a warning message that only the first imputed data set was used. I assume this means that R2 was only calculated using the first imputed dataset. I asked about this on the mc-stan discourse and it seems that R2 can be pooled from the combined posterior samples just like many other parameters. Would it be possible to add that functionality to the bayes_R2() method? I tried to look into doing it myself, but was struggling to understand the fit$fit S4 object.

library(brms)
library(mice)
imp <- mice(nhanes2)
fit <- brm_multiple(bmi ~ age + hyp + chl, data = imp, chains = 1)
bayes_R2(fit)
#>    Estimate Est.Error      Q2.5    Q97.5
#> R2 0.4452458 0.1071932 0.2068827 0.623473
#> Warning message:
#> Using only the first imputed data set. Please interpret the results with caution until a more principled approach has been implemented. 

Contributor guide