Issue with mi() and residual correlations

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

  • Operating System: Mac OS High Sierra v10.13.6
  • brms Version: 2.8.0

Hello!

I am somewhat new at all this, so please bear with me, but I recently encountered a problem that I had not seen before.

PROBLEM:

My imputation model continually produces this error message:

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.
Chain 1: 
Chain 1: Initialization between (-2, 2) failed after 100 attempts. 
Chain 1:  Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.

However, just approximately 1 month ago, this model worked perfectly without this error message.

MODEL

I am doing research on hormones, and because of the problems with collection, there are a few NAs in my data. I decided to impute these values with a similar model to below:

Missing_1 <- bf(log_hormone_1 | mi() ~ weight + age + (1|q|Group) + Species * Sex)

Missing_2 <- bf(log_hormone_2 | mi() ~ weight + age + (1|q|Group) + Species * Sex)

Missing_3 <- bf(log_hormone_3 | mi() ~ weight + age + (1|q|Group) + Species * Sex)

Missing_4 <- bf(log_hormone_4 | mi() ~ weight + age + (1|q|Group) + Species * Sex)

Model_1 <- brm(Missing_1 + Missing_2 + Missing_3 + Missing_4 + set_rescor(TRUE),
                    data = MyData,
                    prior = c(
                      prior(normal(0,2), class="Intercept"),
                      prior(normal(0,1), class="b"),
                      prior(cauchy(0,1), class="sd", resp="Missing_1"),
                      prior(cauchy(0,1), class="sd", resp="Missing_2"),
                      prior(cauchy(0,1), class="sd", resp="Missing_3"),
                      prior(cauchy(0,1), class="sd", resp="Missing_4"),
                      prior(lkj(2), class="cor")),
                      chains=3, cores=3, warmup=2000, iter=6000, 
                      control = list(max_treedepth = 15, adapt_delta=0.99))

Although this model worked just fine previously, now I get that error message mentioned above.

Oddly enough, this model CAN work now if I remove the residual correlation terms.

I tried alternative formulations such as:

Model_1 <- brm(mvbf(Missing_1, Missing_2, Missing_3, Missing_4, rescor = TRUE)

But this was also unsuccessful.

SUMMARY

I looked around and noticed that the mi() term has been updated within the last month, so I imagine that my problems have begun occurring because of this update.

I am just wondering:

  1. Why does the model not work when the residual correlations are included?

  2. How should I rephrase my model to make it more compatible to the newer mi() code?

Thank you very much for your time and efforts with brms!

Can you try it again with the GitHub version of brms? I believe I have fixed something like that before a few weeks ago.

Thanks for getting back to me!

I just tried the Github version (2.8.9) and still encountered the same problem when setting “set_rescor” to “TRUE”.

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.

So no luck so far!

Does the following work for you?

dat <-
  data.frame(a = rnorm(100),
         b = c(NA, rnorm(99)))

bfa <- bf(a ~ 1)
bfb <- bf(b | mi() ~ 1)

fit4 <-
  brm(data = dat,
      mvbf(bfa, bfb, rescor = TRUE))

No, it does not seem to work. Here is the end of the error message:

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.
Chain 1: 
Chain 1: Initialization between (-2, 2) failed after 100 attempts. 
Chain 1:  Try specifying initial values, reducing ranges of constrained values, or    reparameterizing the model.
[1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed."

But the exact same model works on my machine with the current github version. Perhaps you still have the old brms version loaded in your R session? A restart of R could help and if it still fails afterwards, please also post your session info.

Ah! That worked! Also, my main model appears to be working as well!

Thanks again!