- Operating System: Mac
- brms Version: 2.8.0
Let’s say we have 2 + response variables. One has some missing values and the other(s) are complete. Is there a way to fit a multivariate model where we avoid dropping cases with missingness?
We have examples.
Here’s the typical setup.
dat <- tibble(a = rnorm(100), b = c(NA, rnorm(99))) fit1 <- brm(data = dat, mvbind(a, b) ~ 1)
Before compiling the model,
brm() tells us “Rows containing NAs were excluded from the model.” And indeed, the summary confirms we only used 99 out of our 100 cases.
Family: MV(gaussian, gaussian) Links: mu = identity; sigma = identity mu = identity; sigma = identity Formula: a ~ 1 b ~ 1 Data: dat (Number of observations: 99) Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1; total post-warmup samples = 4000 Population-Level Effects: Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat a_Intercept -0.05 0.10 -0.24 0.14 4134 1.00 b_Intercept -0.13 0.10 -0.31 0.07 4492 1.00 Family Specific Parameters: Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat sigma_a 0.95 0.07 0.82 1.09 4305 1.00 sigma_b 0.98 0.07 0.85 1.15 4603 1.00 Residual Correlations: Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat rescor(a,b) -0.08 0.10 -0.28 0.12 4583 1.00
If possible, I would like to use all 100.
I did a little fooling around to try to solve the problem on my own. No luck. For example
fit2 <- brm(data = dat, mvbind(a, b | mi()) ~ 1)
yields a parsing error.
Error in parse(text = x, keep.source = FALSE) : :2:0: unexpected end of input 1: mvbind(a,b~1 ^
fit3 <- brm(data = dat, bf(mvbind(a, b ) | mi() ~ 1) + set_rescor(TRUE))
gives me a whole bunch of error messages
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can’t start sampling from this initial value.
that finally end with
 “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
error occurred during calling the sampler; sampling not done
And I get the same sad results with approach:
bfa <- bf(a ~ 1) bfb <- bf(b | mi() ~ 1) fit4 <- brm(data = dat, mvbf(bfa, bfb, rescor = TRUE))
Is there a nice solution?