Imputation of Missing Data at Level 2


This vignette illustrates the use of mitml for the treatment of missing data at Level 2. Specifically, the vignette addresses the following topics:

  1. Specification of the two-level imputation model for missing data at both Level 1 and 2
  2. Running the imputation procedure

Further information can be found in the other vignettes and the package documentation.

Example data

For purposes of this vignette, we make use of the leadership data set, which contains simulated data from 750 employees in 50 groups including ratings on job satisfaction, leadership style, and work load (Level 1) as well as cohesion (Level 2).

The package and the data set can be loaded as follows.

library(mitml)
data(leadership)

In the summary of the data, it becomes visible that all variables are affected by missing data.

summary(leadership)
#      GRPID          JOBSAT             COHES            NEGLEAD          WLOAD    
#  Min.   : 1.0   Min.   :-7.32934   Min.   :-3.4072   Min.   :-3.13213   low :416  
#  1st Qu.:13.0   1st Qu.:-1.61932   1st Qu.:-0.4004   1st Qu.:-0.70299   high:248  
#  Median :25.5   Median :-0.02637   Median : 0.2117   Median : 0.08027   NA's: 86  
#  Mean   :25.5   Mean   :-0.03168   Mean   : 0.1722   Mean   : 0.04024             
#  3rd Qu.:38.0   3rd Qu.: 1.64571   3rd Qu.: 1.1497   3rd Qu.: 0.79111             
#  Max.   :50.0   Max.   :10.19227   Max.   : 2.5794   Max.   : 3.16116             
#                 NA's   :69         NA's   :30        NA's   :92

The following data segment illustrates this fact, including cases with missing data at Level 1 (e.g., job satisfaction) and 2 (e.g., cohesion).

#    GRPID      JOBSAT     COHES     NEGLEAD WLOAD
# 73     5 -1.72143400 0.9023198  0.83025589  high
# 74     5          NA 0.9023198  0.15335056  high
# 75     5 -0.09541178 0.9023198  0.21886272   low
# 76     6  0.68626611        NA -0.38190591  high
# 77     6          NA        NA          NA   low
# 78     6 -1.86298201        NA -0.05351001  high

In the following, we will employ a two-level model to address missing data at both levels simultaneously.

Specifying the imputation model

The specification of the two-level model, involves two components, one pertaining to the variables at each level of the sample (Goldstein, Carpenter, Kenward, & Levin, 2009; for further discussion, see also Enders, Mister, & Keller, 2016; Grund, Lüdtke, & Robitzsch, in press).

Specifically, the imputation model is specified as a list with two components, where the first component denotes the model for the variables at Level 1, and the second component denotes the model for the variables at Level 2.

For example, using the formula interface, an imputation model targeting all variables in the data set can be written as follows.

fml <- list( JOBSAT + NEGLEAD + WLOAD ~ 1 + (1|GRPID) , # Level 1
             COHES ~ 1 )                                # Level 2

The first component of this list includes the three target variables at Level 1 and a fixed (1) as well as a random intercept (1|GRPID). The second component includes the target variable at Level 2 with a fixed intercept (1).

From a statistical point of view, this specification corresponds to the following model \[ \begin{aligned} \mathbf{y}_{1ij} &= \boldsymbol\mu_{1} + \mathbf{u}_{1j} + \mathbf{e}_{ij} \\ \mathbf{y}_{2j} &= \boldsymbol\mu_{2} + \mathbf{u}_{1j} \; , \end{aligned} \] where \(\mathbf{y}_{1ij}\) denotes the target variables at Level 1, \(\mathbf{y}_{2j}\) th