So far we have considered explanatory variables defined at the lowest level of the hierarchical structure. For example, in our analysis of the correlates of birth weights, we have included individual characteristics such as mother’s age at time of birth. The multilevel models we have considered up to this point control for clustering, and allow us to quantify the extent of dependency and to investigate whether the effects of level 1 variables vary across these clusters. One particular benefit of multilevel modelling, however, is the ability to explore the effects of group-level variables while simultaneously allowing for the possibility that y may be influenced by unmeasured group factors. Variables defined at level 2 are often called contextual variables and their effects on an individual’s y-value are called contextual effects.

If contextual effects are of interest, it is particularly important to use a multilevel modelling approach because the standard errors of coefficients of level 2 variables may be severely underestimated when a single-level model is used.

Examples of research questions involving contextual effects include:

A level 2 explanatory variable can be included in a multilevel model in exactly the same way as a level 1 variable. For example, if we have a level 1 variable \(x_{1ij}\) and a level 2 variable \(x_{2i}\), then the random intercept model becomes:

\[y_{ij}=\beta_0+\beta_1x_{1ij}+\beta_2x_{2i}+u_{i}+\varepsilon_{ij}.\]

(Note that a level 2 variable does not have an j subscript because, by definition, its values do not vary from individual to individual within a level 2 unit.)

We can think of this model hierachically as:

Since the level 2 variable does not vary at the individual level, its value is fixed for a specific group. In this case, we are using the group level variable to adjust the subject specific intercepts (baseline effect).

Contextual variables may come from a number of sources. Data may be collected at level 2, e.g. community surveys in which key figures in the community are interviewed, or data from geographical information systems (GIS) on the location of health facilities. Contextual data may also derive from level 1 data that is aggregated to form level 2 variables. These data may come from an external source, e.g. a Census, or the same source as the level 1 data to be analysed.

If the contextual variable is the level 2 mean of a level 1 variable that is also included in the model becomes

\[y_{ij}=\beta_0+\beta_1x_{ij}+\beta_2\bar{x}_{i}+u_{i}+\varepsilon_{ij}.\] where \(\bar{x}_i\) is the mean of x in group i.

In the model above, \(\beta_1\) is the within-group effect of x and \(\beta_1+\beta_2\) is the between-group effect of x. The within-group coefficient measures the relationship between an individual’s x and y values within a group. The between-group effect measures the relationship between x and y at the group level, i.e. the effect of the group mean of x on the group mean of y . \(\beta_2\) is the contextual effect of x, which is the effect of the group mean of x on an individual y that is over and above the effect of an individual x on y.

So that the within-group and between-group effects can each be represented by a single parameter, the model above can be conveniently re-expressed as

\[y_{ij}=\beta_0+\beta_1^\star (x_{ij}-\bar{x}_i)+\beta_2^\star \bar{x}_{i}+u_{i}+\varepsilon_{ij}\]

where \(\beta_1^\star=\beta_1\) is the within group effect, and \(\beta_2^\star=\beta_1+\beta_2\) is the between group effect. These two models are equivalent, but the latter model produces a direct estimate and standard error for the between group effect.

The transformation of \(x_{ij}\) to \(x_{ij}-\bar{x}_i\) is called group mean centering, as opposed to grand mean centering.

Example: Within and between mother relationships between birth weight and mother’s age

Let’s consider the relationship between an individual’s birth weight and mother’s age and mother’s average age at birth over the five children. Mother i’s age during the birth of infant j (\(x_{ij}\)) is measured in years and the average mother’s age (\(\bar{x}_j\)) is the average of the mother’s age at the birth’s of her five children. The following table gives the results of three models.

## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: bweight ~ momage + (1 | momid)
##    Data: gababies.dat
## 
##      AIC      BIC   logLik deviance df.resid 
##  15332.7  15352.3  -7662.3  15324.7      996 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.1170 -0.4428  0.0475  0.5290  4.0915 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  momid    (Intercept) 126825   356.1   
##  Residual             198850   445.9   
## Number of obs: 1000, groups:  momid, 200
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 2793.576     72.934    38.3
## momage        15.804      3.096     5.1
## 
## Correlation of Fixed Effects:
##        (Intr)
## momage -0.918
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: bweight ~ momage + momageGC + (1 | momid)
##    Data: gababies.dat
## 
##      AIC      BIC   logLik deviance df.resid 
##  15334.1  15358.6  -7662.1  15324.1      995 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.1358 -0.4431  0.0506  0.5373  3.9339 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  momid    (Intercept) 126459   355.6   
##  Residual             198821   445.9   
## Number of obs: 1000, groups:  momid, 200
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 2694.799    150.482  17.908
## momage        14.625      3.473   4.211
## momageGC       5.745      7.660   0.750
## 
## Correlation of Fixed Effects:
##          (Intr) momage
## momage    0.000       
## momageGC -0.875 -0.453
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: bweight ~ I(momage - momageGC) + momageGC + (1 | momid)
##    Data: gababies.dat
## 
##      AIC      BIC   logLik deviance df.resid 
##  15334.1  15358.6  -7662.1  15324.1      995 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.1358 -0.4431  0.0506  0.5373  3.9339 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  momid    (Intercept) 126459   355.6   
##  Residual             198821   445.9   
## Number of obs: 1000, groups:  momid, 200
## 
## Fixed effects:
##                      Estimate Std. Error t value
## (Intercept)          2694.799    150.482  17.908
## I(momage - momageGC)   14.625      3.473   4.211
## momageGC               20.370      6.827   2.984
## 
## Correlation of Fixed Effects:
##             (Intr) I(-mGC
## I(mm-mmgGC)  0.000       
## momageGC    -0.981  0.000
Model 1 Model 2 Model 3
Variable Est. SE Est. SE Est. SE
Fixed Part
Constant 2794 72.9 2695 150.5 2695 150.5
xij 15.8 3.10 14.625 3.5 - -
xij - xi - - - - 14.6 3.5
xi - - 5.745 7.7 20.37 6.8
Random Part
σ2u 126825 - 126459 - 126459 -
σ2e 198850 - 198821 - 198821 -

Cross-level interactions

As in multiple regression, we can allow for the possibility that the effect of one explanatory variable on y depends on the value of another explanatory variable. Recall that such effects are called interaction effects and are represented in a model by including the product of the interacting variables as explanatory variables. Interactions can also be included in a multilevel model and these can be between any pair (or larger set) of variables, regardless of the level at which they are defined. An interaction between a level 1 variable and a level 2 variable is known as a cross-level interaction.