Why linear mixed-effects models are probably not the solution to your missing data problems

July 09, 2020

Linear mixed-effects models are often used for their ability to handle missing data using maximum likelihood estimation. In this post I will present a simple example of when the LMM fails, and illustrate two MNAR sensitivity analyses: the pattern-mixture method and the joint model (shared parameter model). This post is based on a small example from my PhD thesis.

MCAR, MAR, and MNAR missing data

D. B. Rubin (1976) presented three types of missing data mechanisms: missing completely at random (MCAR), missing at random (MAR), missing not at random (MNAR). LMMs provide unbiased estimates under MAR missingness. If we have the complete outcome variable (which is made up of the observed data and the missing values ) and a missing data indicator (D. B. Rubin 1976; R. J. Little and Rubin 2014; Schafer and Graham 2002), then we can write the MCAR and MAR mechanisms as,

If the missingness depends on , the missing values in , then the mechanism is MNAR. MCAR and MAR are called ignorable because the precise model describing the missing data process is not needed. In theory, valid inference under MNAR missingness requires specifying a joint distribution for both the data and the missingness mechanisms (R. J. A. Little 1995). There are no ways to test if the missing data are MAR or MNAR (Molenberghs et al. 2008; Rhoads 2012), and it is therefore recommended to perform sensitivity analyses using different MNAR mechanisms (Schafer and Graham 2002; R. J. A. Little 1995; Hedeker and Gibbons 1997).

LMMs and missing data

LMMs are frequently used by researchers to try to deal with missing data problems. However, researchers frequently misunderstand the MAR assumption and often fail to build a model that would make the assumption more plausible. Sometimes you even see researchers using tests, e.g., Little’s MCAR test, to prove that the missing data mechanisms is either MCAR or MAR and hence ignorable—which is clearly a misunderstanding and builds on faulty logic.

A common problem is that researchers do not include covariates that potentially predict dropout. Thus, it is assumed that missingness only depend on the previously observed values of the outcome. This is quite a strong assumption. A related misunderstanding, is that the LMM’s missing data assumption is more liberal as it allows for participants’ slopes to vary. It is sometimes assumed tat if a random slope is included in the model it can also be used to satisfy the MAR assumption. Clearly, it would be very practical if the inclusion of random slopes would allow missingness to depend on patients’ latent change over time. Because it is probably true that some participants’ dropout is related to their symptom’s rate of change over time. Unfortunately, the random effects are latent variables and not observed variables—hence, such a missingness mechanism would also be MNAR (R. J. A. Little 1995). The figure below illustrates the MAR, outcome-based MNAR, and random coefficient-based MNAR mechanisms.

missing data labels
Figure 1. Three different drop out mechanisms in longitudinal data from one patient. a) Illustrates a MAR mechanism where the patient's likelihood of dropping out is related to an observed large value. b) Shows an outcome-related MNAR mechanism, where dropout is related to a large unobserved value. c) Shows a random-slope MNAR mechanism where the likelihood of dropping out is related to the patient's unobserved slope.

Let’s generate some data

To illustrate these concepts let’s generate data from a two-level LMM with random intercept and slopes, and included a MNAR missing data mechanism where the likelihood of dropping out depended on the patient-specific random slopes. Moreover, let’s assume that the missingness differs between the treatment and control group. This isn’t that unlikely in unblinded studies (e.g., wait-list controls).

MNAR p dropout
Figure 2. A differential MNAR dropout process where the probability of dropping out from a trial depends on the patient-specific slopes which interact with the treatment allocation. The probability of dropout is assumed to be constant over time.
Figure 3. A sample of patients drawn from the MNAR (random slope) data-generating process. Circles represent complete observations; the bold line represents the slope before dropping out. P(dropout) gives the probability of dropout, which is assumed to be constant at all time points.

The equations for the dropout can be written as,

The R code is quite simple,

Now let’s draw a large sample from this model (1000 participants per group), and fit a typical longitudinal LMM using both the complete outcome variable and the incomplete (MNAR) outcome variable.

Here are the results (click on “SHOW” to see the output).

We can see that the slope difference is -0.25 for the complete data and much larger for the LMM with missing data (-1.14).

A Pattern-mixture model

A simple extension of the classical LMM is a pattern-mixture model. This is a simple model where we allow the slope to differ within subgroups of different dropout patterns. The simplest pattern is to group the participants into two subgroups dropouts (1) or completers (0), and include this dummy variable in the model.

As you can see in the output, we now have a bunch of new coefficients. In order to get the marginal treatment effect we need to average over the dropout patterns. There are several ways to do this, we could just calculate a weighted average manually. For example, the outcome at posttest in the control group is

To estimate the treatment effect we’d need to repeat this for the treatment group and take the difference. However, we’d also need to calculate the standard errors (e.g., using the delta method). An easier option is to just specify the linear contrast we are interest in.

This tells us that the difference between the groups at posttest is estimated to be -4.65. This is considerably smaller than the estimate from the classical LMM, but still larger then for the complete data. We could accomplish to same thing using emmeans package.

Fitting a joint model

The pattern-mixture model was an improvement, but it didn’t completely recover the treatment effect under the random slope MNAR model. We can actually fit a model that allows dropout to be related to the participants’ random slopes. To accomplish this we combine a survival model for the dropout process and an LMM for the longitudinal outcome.

We can see from the output that the estimate of the treatment effect is really close to the estimate from the complete data (-0.23 vs -0.25). There’s only one small problem with the joint model and that is that we almost never know what the correct model is…

A small simulation

Now let’s run a small simulation to show the consequences of this random-slope dependent MNAR scenario. We’ll do a study with 11 time points, 150 participants per group, a variance ratio of 0.02, and pretest ICC = 0.6, with a correlation between intercept and slopes of -0.5. There will be a “small” effect in favor of the treatment of . The following models will be compared:

  • LMM (MAR): a classical LMM assuming that the dropout was MAR.
  • GEE: a generalized estimating equation model.
  • LMM (PM): an LMM using a pattern-mixture approach. Two patterns were used; either “dropout” or “completer”, and the results were averaged over the two patterns.
  • JM: A joint model that correctly allowed the dropout to be related to the random slopes.
  • LMM with complete data: an LMM fit to the complete data without any missingness.

I will not post all code here; the complete code for this post can be found on GitHub. Here’s a snippet showing the code that was used to fit the models.


The table and figure below shows how much the treatment effects differ. We can see that LMMs are badly biased under this missing data scenario; the treatment effect is much larger than it should be (Cohen’s d: -0.7 vs. -0.2). The pattern-mixture approach improves the situation, and the joint model recovers the true effect. Since the sample size is large, the bias under the MAR assumption leads to the LMM’s CIs having extremely bad coverage. Moreover, under the assumption of no treatment effect the MAR LMM’s type I errors are very high (83%), whereas the pattern-mixture and joint model are closer to the nominal levels.

ModelM(Est.)Rel. biasdPowerCI coverageType I error

Note: MAR = missing at random; LMM = linear mixed-effects model; GEE = generalized estimating equation; JM = joint model; PM = pattern mixture; Est. = mean of the estimated effects; Rel. bias = relative bias of Est.; d = mean of the Cohen’s d estimates.

MNAR sim res
Figure 3. Mean of the estimated treatment effect from the MNAR missing data simulations for the different models. The dashed lines represents the control group's estimated average slope and the solid lines the treatment group's average slope.


This example is purposely quite extreme. However, even if the MNAR mechanism would be weaker, the LMM will yield biased estimates of the treatment effect. The assumption that dropout might be related to patients’ unobserved slopes is not unreasonable. However, fitting a joint model is often not feasible as we do not know the true missingness mechanism. I included it just to illustrate what is required to avoid bias under a plausible MNAR mechanism. In reality, the patients’ likelihood of dropping out is likely an inseparable mix of various degrees of MCAR, MAR, and MNAR mechanisms. The only sure way of avoiding bias would be to try to acquire data from all participants—and when that fails, perform sensitivity analyses using reasonable assumptions of the missingness mechanisms.


Hedeker, Donald, and Robert D Gibbons. 1997. “Application of Random-Effects Pattern-Mixture Models for Missing Data in Longitudinal Studies.” Psychological Methods 2 (1): 64–78. doi:10.1037/1082-989X.2.1.64.

Little, Roderick J. A. 1995. “Modeling the Drop-Out Mechanism in Repeated-Measures Studies.” Journal of the American Statistical Association 90 (431): 1112–21. doi:10.1080/01621459.1995.10476615.

Little, Roderick JA, and Donald B Rubin. 2014. Statistical Analysis with Missing Data. Vol. 333. John Wiley & Sons.

Molenberghs, Geert, Caroline Beunckens, Cristina Sotto, and Michael G. Kenward. 2008. “Every Missingness Not at Random Model Has a Missingness at Random Counterpart with Equal Fit.” Journal of the Royal Statistical Society: Series B (Statistical Methodology) 70 (2): 371–88. doi:10.1111/j.1467-9868.2007.00640.x.

Rhoads, Christopher H. 2012. “Problems with Tests of the Missingness Mechanism in Quantitative Policy Studies.” Statistics, Politics, and Policy 3 (1). doi:10.1515/2151-7509.1012.

Rubin, Donald B. 1976. “Inference and Missing Data.” Biometrika 63 (3): 581–92. doi:10.1093/biomet/63.3.581.

Schafer, Joseph L., and John W. Graham. 2002. “Missing Data: Our View of the State of the Art.” Psychological Methods 7 (2): 147–77. doi:10.1037//1082-989X.7.2.147.

Written by Kristoffer Magnusson a researcher in clinical psychology. You should follow him on Twitter and come hang out on the open science discord Git Gud Science.


Published July 09, 2020 (View on GitHub)