I am fitting a linear mixed effect model with two categorical factors: mPair with 6 levels, and spd_des with 3 levels. This is a repeated measure design, where each subject ratID is measured on each combination of the levels of the two factors. There are 100-300 observations for each level of mPair:spd_des for each level of ratID (n=10). However there are missing data, meaning that for some subject, I have no data at all for certain combinations of mPair and spd_des.

I am using the package glmmTMB to have the possibility of simplifying the model by specifying a diagonal var-cov matrix (which is a very reasonable assumption knowing the data).

linM4.4_g <- glmmTMB(cc_marg ~ mPair*spd_des + diag(mPair:spd_des|ratID), data = dat_trf, na.action=na.omit,  control = glmmTMBControl(optCtrl=list(iter.max=1e3,eval.max=1e3)))

The optimization converges nicely. The problem is I get zero-valued random effects on the combinations ratID:mPair:spd_des for which there are no data (see mPairRFVI:spd_des10 column in the data below).

>  ranef(linM4.4_g)
     (Intercept) mPairVMVL:spd_des10 mPairRFVI:spd_des10 mPairVLRF:spd_des10 mPairVLVI:spd_des10 mPairVMRF:spd_des10 mPairVMVI:spd_des10 mPairVMVL:spd_des15 mPairRFVI:spd_des15 mPairVLRF:spd_des15 mPairVLVI:spd_des15 mPairVMRF:spd_des15 ...
J10  0.001827757         -0.17918078         -0.03075098        0.0018182122          0.07827280         0.112484260        0.0954968509         -0.24630298         -0.10002992        -0.305957440          0.41137589        -0.157894900
J11 -0.189155288          0.24541186         -0.09278771       -0.0035584985         -0.01468943        -0.094139450        0.0005709601          0.27205626         -0.13606275         0.135484501         -0.23057219         0.081491910
J12 -0.116602355         -0.29521831          0.00000000        0.0026521403          0.00000000        -0.133977634        0.0000000000         -0.16048987          0.00000000         0.020322373          0.00000000         0.041967314
J13  0.120292128          0.10728810         -0.08469476        0.0062409308         -0.15379432         0.114260411       -0.1677873380          0.18608155         -0.01595738         0.079921149         -0.13123584         0.150402587
J14  0.233235840          0.13302235          0.12580540       -0.0145336459          0.12826689         0.018515372        0.1728495592          0.04939448          0.11941437        -0.004761555         -0.08566245         0.058172962
J5  -0.379325487          0.29627438          0.00000000       -0.0022949353          0.00000000        -0.017487437        0.0000000000          0.15576143          0.00000000        -0.020144557          0.00000000        -0.036359487
J6   0.081365803         -0.24183702          0.00000000        0.0000000000          0.00000000         0.000000000        0.0000000000          0.00000000          0.00000000         0.000000000          0.00000000         0.000000000
J7  -0.022488986          0.04304708          0.00000000        0.0066625165          0.00000000        -0.042639968        0.0000000000          0.02003516          0.00000000         0.056399015          0.00000000        -0.087320620
J8   0.157365810         -0.07851425          0.08241558        0.0005276979         -0.03806280         0.049995476       -0.1011526183         -0.11242074          0.13263072        -0.106576960          0.03604285        -0.009879695
J9   0.113540834         -0.03029801          0.00000000        0.0024881828          0.00000000        -0.007039204        0.0000000000         -0.16400947          0.00000000         0.145311701          0.00000000        -0.040587929

Questions are:

  1. is this supposed to be expected behavior? Why would the random effect for missing data on specific subjects be equal to zero, therefore making the prediction for that subject and combination of factors equal to the marginal prediction on fixed effects?

  2. This issue makes the distribution of random effect obviously non-Gaussian (see qq-plot below), preventing the assumption of linear mixed effect models to be met. How much of a problem is that? Btw, if you look carefully at the qq-plot, you will notice that apart from the zero random effect, the other ones lie nicely close to the diagonal.

  3. Can I trust this model for interference? (The results of the post-hoc tests seem reasonable)

enter image description here

Little background: I need to use random slopes on the interaction because otherwise I would break the assumption of independence of observation on the same cell, and since there are so many repetitions the denDF would be be extremely high (see this). The package nlme has issues at estimating denDF in random slope models (see here). I tried to fit the model with the function lmer() under the package lme4, but I had very serious convergence problems. I therefore thought of simplifying the var-cov matrix, a feature that is not supported in lme4 and therefore I moved to glmmTMB.

Any help is highly appreciated!


closed as too broad by Michael Chernick, Siong Thye Goh, Frans Rodenburg, Peter Flom Jun 14 at 11:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I am no expert on this sort of model but if you have no data what estimate did you expect? I would have thought either NA or 0 were plausible options. $\endgroup$ – mdewey Jun 13 at 13:23
  • $\begingroup$ as far as I know random effects are estimated based on a normal distribution fitted to the random effect; in other cases I indeed got a meaningful estimate even if there is no data. $\endgroup$ – Cristiano Jun 13 at 14:31
  • 1
    $\begingroup$ Problems with estimating the random effects in this sort of model are not uncommon. The most detailed treatment of these that I have seen is in Richly Parameterized Linear Models by James Hodges. $\endgroup$ – Peter Flom Jun 14 at 11:58

Note that even though the design of your experiment may suggest that you need a complex random-effects structure, often in practice, the data do not have enough information to estimate. This will result in unstable models that may lead to incorrect conclusions. Hence, I would suggest starting with a simpler structure and try to elaborate it step-by-step.

Regarding the advice of trying the maximal model, check this paper.

  • $\begingroup$ Thanks for the paper, I'll read it. However, I seem to be able to fit the model as described. Do you think the zeroed random effects are due to lack of power? To me it is abut suspicious that I get those only for the cells with no data; it sounds more of a theoretical than a practical issue. But I do not understand why, and I do not know if I can trust the model. $\endgroup$ – Cristiano Jun 12 at 16:25
  • $\begingroup$ I would say that you get a zero as the empirical Bayes estimate for these specific combinations of the levels because you do not have any outcome data for them and you have assumed that the random effects are independent. $\endgroup$ – Dimitris Rizopoulos Jun 13 at 20:54
  • $\begingroup$ I am not sure I can follow your explanation. Could you elaborate it please? $\endgroup$ – Cristiano Jun 13 at 22:59
  • 1
    $\begingroup$ The estimates you get for the random effects are the mode of the conditional distribution $[b \mid y]$ with respect to $b$, where $b$ are the random effects and $y$ the outcome data. This distribution is analogous to $[y | b] [b]$. The first term is the model for the outcome data conditional on the random effects, and the second your assumption for the random effects distribution. In your case, since you have no outcome data $y$ for these specific combinations of levels, you only have the second term, which is a normal distribution with mean zero. This is why you get the zero as the estimate. $\endgroup$ – Dimitris Rizopoulos Jun 14 at 9:13
  • $\begingroup$ I see, thanks! However, I only get zeros when I use a diagonal var-cov matrix. If I use, for example, compound symmetry this is not the case. The point is if I can trust the fitted model when I get zero random effects. $\endgroup$ – Cristiano Jun 14 at 14:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.