Multilevel Modelling in SPSS
Aug 8, 2018

Michael Page

INTRODUCTION

Nested data structures

When selecting an analysis for a given data set it is important to consider if the data is in a nested (i.e., hierarchical/clustered/grouped) structure. A nested data structure is one in which the data is organised at more than one level. For example, students can be nested within classes as so: In a similar fashion, it could be said that individual student test scores can be nested within students, who are nested within classes, which are nested within schools: To extent of this nesting structure is only limited by the nature of the data collected. Nonetheless, the most common nested structure is a two level structure, (i.e., students with classes), which is the type of nesting we will be exploring later.

Essentially, a nested data structure is one where the variables at one level (e.g., student) cannot be considered independent of the variables at another level (e.g. class). So extending the student-class example above, if the test scores of students 1-9 were to be predicted, it would be reasonable to assume that the scores of students 1-3 will be similar, as will the scores of students 4-6, as will the scores of students 7-9, as nested (grouped) by the higher-level class variable. The explanation for this is intuitive: the pupils in class 1 will be exposed to different teachers and different environments, etc., in comparison to the students in class 2, and so on. That is not to say that the class is the only predictor of student grades, rather, it must be modeled into the data. Indeed, there will be variability in students scores within classes, and it may be that different students in different classes still achieve similar scores. In this scenario, the effect of the higher-level class variable will be minimal or non-significant (more on this later).

If we were to model the prediction of student test scores, as was done above, using ordinary least squares (OLS) regression we would run into a problem: OLS regression requires independence of observations. In this case, the assumption would be violated, as student scores are not independent of their class. This is because we have a nested data structure. Therefore, we must use an alternative solution: multilevel models.

Why use multilevel models over regression?

When dealing with a nested data structure, multilevel models offer several distinct advantages over OLS regression:

1. Multilevel models do not require independence of observations (i.e., the same participant can be measured twice without confounding the data).
2. Multilevel models do not require homogeneity of regression slopes (i.e., multilevel models explicitly model variability in regression slopes; Field, 2009).
3. Multilevel models play nicely with missing (i.e., NA) data.
Multilevel models

In short, multilevel models are just a fancy type of regression. The title of Bickel (2009) supports this notion:

“Multilevel Analysis for Applied Research: It’s Just Regression!”

While the mathematics behind multilevel models is a little more complex, they are essentially regression equations which control for variability in the higher-level structures. This variability occurs as variance in the slope and intercept of the plotted regression lines, which are fixed in a standard OLS regression. Thus, multilevel models are said to have a fixed and random component. To understand these concepts further, let’s run through a specific example from start to finish.

MULTILEVEL MODELS IN ACTION

Cortisol and perfectionism

To understand and apply multilevel models, let’s model some data using SPSS on perfectionism and cortisol I have collected as part of an ongoing study.

The variables

The study is investigating whether athletes experience a change in their cortisol awakening response (CAR) the morning of a competition (the CAR is essentially a measure of stress), and whether perfectionism (a multidimensional personality trait) can predict these changes. In other words, the study is trying to see if levels of perfectionism in athletes can predict how stressed they get before a competition (of course, it is a little more complicated than that). One might expect that an athlete higher in perfectionism would get more stressed before a competition.

To assess whether athletes are experiencing a change in CAR before a competition, the CAR is measured on a baseline day and the day of a competition (i.e., at multiple time points). The CAR is expressed in two different metrics: AUCi and AUCg. The details of these metrics are not important at this stage, but take note they both provide an index of stress. Perfectionism is measured at one time point before any measures of the CAR take place. As each participant must provide CAR measurements on two separate occasions (a baseline day and a competition day), the CAR measurements are nested within participants. Therefore, multilevel models must be used, in the first instance, to model this data.

The data

A subset of the data we will use to create our models can be seen below:

ID SOP SPP SOPP SPPP AUCg_Base AUCg_Comp AUCi_Base AUCi_Comp
1 2.8 2.2 3.75 1.75 25.65300 22.27275 16.99950 -0.75825
2 5.6 4.4 6.00 4.25 17.28750 35.36925 5.11500 -2.04825
3 5.0 3.0 4.50 2.00 3.92670 12.62250 1.94985 1.17000
4 2.8 3.8 6.25 5.25 18.15600 13.64625 -0.24450 -9.89325
5 6.6 2.2 6.75 2.50 22.33275 25.71300 -1.04475 2.83950
6 5.8 4.6 5.50 2.50 8.58900 21.98700 0.80400 -7.32600
7 3.6 2.8 4.25 2.75 23.12925 16.66050 3.11325 5.54550
8 4.0 5.0 5.00 5.25 21.41775 27.80025 4.34475 7.44225
9 4.8 3.8 5.50 4.25 6.94950 23.14950 0.35700 4.63650
10 4.8 3.2 5.25 4.00 15.01275 27.06300 2.15625 14.56200

The data contains four perfectionism measures (SOP, SPP, SOPP, SPPP), both CAR metrics across the baseline day and competition day (AUCg_Base, AUCg_Comp, AUCi_Base, AUCi_Comp), and a participant identifier (ID). To model the data, it must be transformed into a longitudinal (or ‘tidy’; Wickham, 2014) format. Good guides on transforming data into a longitudinal format can be found in Bickel (2007) and Field (2009).

Growth models

To apply multilevel models to the data, we need to use a type of model called a growth model (because we are assessing changes over time - from baseline day to competition day). The growth models we will use will examine whether there are intra-individual changes in cortisol scores across days (level 1 or unconditional model including only time), and whether perfectionism measures can predict these changes (level 2 or conditional model that includes perfectionism dimensions; see Bickel, 2007).

The fixed components of level 1 models follow a normal regression equation structure and describe an individual’s score as a function of the intercept, the slope (i.e. the growth rate), and a time-specific residual. The random components of level 1 models examine whether there is individual variation in terms of the intercept and the slope.

Typically, the level 1 growth rate is tested to establish if there is a relationships across time for the repeated measures. If a significant relationship is found, the variance components (intercept and slope) are then tested to establish if individuals differed in terms of their initial status and growth rates. If significant relationships are found for the intercept and slope, the model is then tested for fit using a chi-square likelihood ratio test. Providing adequate fit, level 2 predictor variables are then added to the model. Significant interaction terms at level 2 indicate whether the predictor variables are related to accelerated or decelerated growth in the repeated measures at level 1.

Fitting the models

To fit the growth models in SPSS, let’s go beyond the point and click interface, which is convoluted and timely, and write some concise, reproducible syntax. As a guide, let’s use the syntax provided in Peugh and Enders (2005) to run our growth models (note that comments are indicated by an asterisk). First, we need to write our level 1 unconditional linear models to test whether there is a change in CAR over time, and whether there is individual variation in terms of the intercept and slope, for both CAR metrics (AUCi and AUCg):

* Level 1 unconditional linear growth models.
* Model below is for AUCg
MIXED AUCg WITH Time
/PRINT = SOLUTION TESTCOV /METHOD =ML
/FIXED = INTERCEPT Time
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN)

* Model below is for AUCi
MIXED AUCi WITH Time
/PRINT = SOLUTION TESTCOV
/METHOD =ML
/FIXED = INTERCEPT Time
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN)

Next, we need to build our level 2 models to assess whether the predictor variables are related to accelerated or decelerated growth in the repeated measures at level 1 for both CAR metrics (AUCi and AUCg). Note that in the models below the four perfectionism measures are added to the models in groups of two (e.g., SOP and SPP), this is because these pairs of perfectionism measures are subdomains of perfectionism scales (consisting of multiple dimensions):

* Level 2 conditional linear growth models.
* Model below is for AUCg with the HF-MPS
MIXED AUCg WITH Time SOP SPP
/PRINT = SOLUTION TESTCOV
/METHOD = ML
/FIXED = INTERCEPT Time SOP SPP Time*SOP Time*SPP
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN)

* Model below is for AUCi with the HF-MPS
MIXED AUCi WITH Time SOP SPP
/PRINT = SOLUTION TESTCOV
/METHOD = ML
/FIXED = INTERCEPT Time SOP SPP Time*SOP Time*SPP
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN)

* Model below is for AUCg with the PPS-S
MIXED AUCg WITH Time SOPP SPPP
/PRINT = SOLUTION TESTCOV
/METHOD = ML
/FIXED = INTERCEPT Time SOPP SPPP Time*SOPP Time*SPPP
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN).

* Model below is for AUCi with the PPS-S
MIXED AUCi WITH Time SOPP SPPP
/PRINT = SOLUTION TESTCOV
/METHOD = ML
/FIXED = INTERCEPT Time SOPP SPPP Time*SOPP Time*SPPP
/RANDOM INTERCEPT Time | SUBJECT(Participant) COVTYPE(UN).

That is it! That is the models built. Next, we run the syntax and inspect the results. Below, is a cleaned up, more digestible version of the SPSS output for the level 1 and 2 models examining SOP and SPP: For AUCi, the level 1 unconditional linear growth models showed that there were no significant changes over time (p = .596). For AUCg, the level 1 unconditional linear growth models showed that there were significant changes over time (p = .001). However, there was no significant variability between individuals in terms of both slope and intercept, therefore, the level 2 models need not be examined. In this case, a two step regression analysis would be an appropriate analysis to now run on the data to examine the significant change in AUCg over time that was found.

SUMMARY

1. Multilevel models allow us to analyse nested data structures and offer several advantages over OLS regression.

2. When using multilevel growth models, first, level 1 growth rate is tested to establish if there is a relationship across time for the repeated measures. If a significant relationship is found, the variance components (intercept and slope) are then tested to establish if individuals differed in terms of their initial status and growth rates. Level 2 predictor variables are then added to the model. Significant interaction terms at level 2 indicate whether the predictor variables are related to accelerated or decelerated growth in the repeated measures at level 1.

3. SPSS syntax offers a simple and reproducible method for performing multilevel models.