# Chapter 9 Multilevel Modelling with Repeated Measures Data

## 9.1 Learning Objectives

In this chapter, we will review fitting MLMs for repeated measures data.

The learning objectives for this chapter are:

- Review multilevel modelling concepts discussed so far;
- Recognize when data are repeated measures and in the correct format for multilevel modelling;
- Conduct multilevel modelling on repeated measures data;
- Interpret coefficients for repeated measures data.

All materials for this chapter are available for download here.

## 9.2 Data Demonstration

### 9.2.1 Load Dependencies

For this data demo, we will use the following packages:

```
library(lme4) # for multilevel models
library(lmerTest) # for p-values
library(performance) # for ICC
```

### 9.2.2 Review of Multilevel Modelling Procedure

Multilevel modelling in repeated measures data is a new application of the techniques we’ve covered so far, so let’s briefly review the steps in our modelling framework:

- Establish solid theory and measurement, decide whether you need MLMs for your question
- Run random-intercept-only (i.e., null) model to calculate ICC and quantify extent of clustering in data
- Build model incrementally adding fixed and random effects per your theory, considering centering and estimation (REML or FIML) choices
- Conduct deviance test to compare model fits
- If you run into estimation issues, change your optimizer or remove problematic effects
- Report results: coefficients, significance, plausible values ranges, any changes made to address estimation issues

### 9.2.3 Multilevel Models for Repeated Measures

Thus far, we’ve been using a cross-sectional example of students clustered within schools. Our level-1 variables have been about traits that students vary on (e.g., age, gender, SES) while our level-2 variables have been about traits that schools vary on (e.g., whether they are public or private schools).

With repeated measures data, measures are clustered within person rather than having people clustered within some organizational structure. The level-1 variables are about traits that the measures vary on (e.g., experimental manipulations) whereas level-2 variables are about traits that people vary on (e.g., age, gender, SES). For example, imagine we show participants pictures of lines and ask them to estimate the line length. We measure how long it takes them to rate each line, making their reaction time the dependent variable. A level-1 predictor variable would be the line length; each participant sees several lines of different lengths. A level-2 predictor variable would be something demographic like a participant’s age or gender; each person has the same value on the variable for the entire experiment.

In this chapter, we’ll look at repeated measures data without time in the model. This approaches assumes that time is not related to the outcome in the model. In Chapter 10, we’ll look at repeated measures data with time in the model, i.e., longitudinal models, which focus on how an outcome changes over time.

#### 9.2.3.1 Data Structures: Long vs Wide

Imagine you were measuring weight and caloric intake. If you have historically worked with repeated measures data in an ANOVA framework, you are probably used to working with data in a “wide” format, i.e., one row per participant with different variables for different measurement instances.

id | weight1 | weight2 | calories1 | calories2 |
---|---|---|---|---|

1 | 200 | 190 | 3500 | 3300 |

2 | 150 | 160 | 3200 | 3100 |

In MLMs, you need to use data in a “long” format where one row is one measurement occasion:

id | weight | calories | measurement_occasion | |
---|---|---|---|---|

1 | 200 | 3500 | 1 | |

1 | 190 | 3300 | 2 | |

2 | 150 | 3200 | 1 | |

2 | 160 | 3100 | 2 |

This requires transposing your data, which you can read more about here.

An aside: you might also be used to thinking listwise deletion deletes an entire participant, because listwise deletion deletes rows with any missing data and in wide data one row *is* one participant. In long data, listwise deletion means deleting one measurement instance, not necessarily an entire participant. For example, if a participant answers a questionnaire a first time, then at one follow-up, but not at the second follow-up, listwise deletion will only remove their third row full of NAs; you’ll keep their data from the first two questionnaires.

### 9.2.4 Our Data: Reaction Time

The data used in this module are used as an example in Hoffman and Rovine (2007). The article and supporting materials can be found here: http://www.lesahoffman.com/Research/MLM.html

`<- read.csv('hoffman2007.csv') data `

Let’s look at our data:

`head(data)`

```
## X id sex age NAME rt_sec Item meaning salience lg_rt oldage yrs65 c_mean c_sal
## 1 1 1 1 20 rt_sec1 4.662 1 3.5 4.0 1.5394445 0 0 0.5 1.0
## 2 2 1 1 20 rt_sec2 6.660 2 0.0 3.0 1.8961195 0 0 -3.0 0.0
## 3 3 1 1 20 rt_sec3 6.602 3 4.0 2.0 1.8873726 0 0 1.0 -1.0
## 4 4 1 1 20 rt_sec4 1.332 4 4.0 4.0 0.2866816 0 0 1.0 1.0
## 5 5 1 1 20 rt_sec5 1.332 5 0.0 5.0 0.2866816 0 0 -3.0 2.0
## 6 6 1 1 20 rt_sec7 1.302 7 3.5 4.5 0.2639015 0 0 0.5 1.5
```

For this data demo the outcome of interest is the log of reaction time for participants to detect a change during a picture viewing task (`rt_sec`

). The pictures varied on two dimensions: how meaningful driving was to the picture (`meaning`

) and how salient the change was in the picture (`salient`

). For this analysis we will focus on the variables centered from the midpoint of the rating (3): `c_mean`

and `c_sal`

. One of the primary research questions was how age related to reaction time, given those differences in pictures. Participants were sampled in age categories: younger (`oldage`

= 0, 40 and under) and older (`oldage`

= 1, above 40). Repeated trials are nested within persons.

### 9.2.5 Random-Intercept-Only/Null Model

Let’s estimate our null model with FIML as our estimator and calculate the ICC:

```
<- lmer(lg_rt ~ 1 + (1|id), data = data, REML = FALSE) # note that REML = FALSE
null_model ::icc(null_model) performance
```

```
## # Intraclass Correlation Coefficient
##
## Adjusted ICC: 0.252
## Unadjusted ICC: 0.252
```

With repeated measures data, the ICC is interpreted as the proportion of variance between people: How much of the variance stems from people being different from one another versus fluctuating within themselves? A large ICC means that most of the variability is between people, not from people varying in their answers to a set of questions (or in this case, reaction time). The ICC is 0.252, indicating that 25.2% of the variance in log reaction time is attributed to a person.

(Some bonus fun: when responses to questions are nested within person, Cronbach’s alpha is equivalent to the ICC: a high alpha indicates high “reliability” of the scale because most of the scale variance is between people. By contrast, if individuals answered inconsistently, most of the scale variance would be within person and we would get a lower alpha.)

### 9.2.6 Adding Level-1 Fixed Effects

Let’s add our level-1 predictors for picture meaning `c_mean`

and picture salience `c_sal`

to our model. This is represented with the following formulae:

Level | Equation |
---|---|

Level 1 | \(lg\_rt_{ij} = \beta_{0j} + \beta_{1j}c\_mean_{ij} + \beta_{2j}c\_sal_{ij} + R_{ij}\) |

Level 2 | \(\beta_{0j} = \gamma_{00} + U_{0j}\) |

\(\beta_{1j} = \gamma_{10}\) | |

\(\beta_{2j} = \gamma_{20}\) | |

Combined | \(lg\_rt_{ij} = \gamma_{00} + \gamma_{10}c\_mean_{ij} + \gamma_{20}c\_sal_{ij} + U_{0j} + R_{ij}\) |

With this model, we’re estimating 5 parameters:

- \(\gamma_{00}\): the fixed effect for the intercept, controlling for
`c_mean`

and`c_sal`

; - \(\gamma_{10}\): the fixed effect for the slope of
`c_mean`

, controlling for`c_sal`

. This represents how meaning affects a person’s reaction time — do people respond more quickly or slowly to photos with changes that are related to driving a car (perhaps because they’re often driving and are attuned to changes in the environment when operating a car)? - \(\gamma_{20}\): the fixed effect for the slope of
`c_sal`

, controlling for`c_mean`

. This represents how salience affects a person’s reaction time — do people respond more quickly or slowly to photos with more obvious changes? - \(\tau_0^2\): a random effect for the intercept capturing the variance of people around the intercept, controlling for
`c_mean`

and`c_sal`

; - \(\sigma^2\): a random effect capturing the variance of people around their own mean log reaction time, controlling for
`c_mean`

and`c_sal`

.

Let’s run the model with FIML as our estimator:

```
<- lmer(lg_rt ~ 1 + c_mean + c_sal + (1|id), data = data, REML = FALSE)
l1_model summary(l1_model)
```

```
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: lg_rt ~ 1 + c_mean + c_sal + (1 | id)
## Data: data
##
## AIC BIC logLik deviance df.resid
## 16525.9 16560.6 -8257.9 16515.9 7641
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5224 -0.7291 -0.1090 0.6177 3.8884
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 0.1756 0.4191
## Residual 0.4785 0.6917
## Number of obs: 7646, groups: id, 153
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.605254 0.034828 153.300086 46.09 <0.0000000000000002 ***
## c_mean -0.051528 0.004304 7493.037128 -11.97 <0.0000000000000002 ***
## c_sal -0.132320 0.007435 7493.183164 -17.80 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) c_mean
## c_mean 0.044
## c_sal -0.015 -0.219
```

The intercept of 1.61 is the mean log reaction time across all people at average values of meaning and salience. A one-unit increase in meaning is associated with a decrease in log reaction time of 0.05 (i.e., a faster reaction time), at the average level of salience. A one-unit increase in salience is associated with a decrease in log reaction time of 0.13 at the average level of meaning. All coefficients are significant. The term describing how people vary around the grand mean intercept is 0.18. The term describing how people vary around their own intercept is 0.48.

Does this model have significantly less deviance (i.e., better fit) than the null model alone? Let’s use a deviance test to check. Note that we can compare the null and level-1 models because we used FIML as our estimator and they are nested (i.e., all variables in the level-1 model are in the null model).

`anova(null_model, l1_model)`

```
## Data: data
## Models:
## null_model: lg_rt ~ 1 + (1 | id)
## l1_model: lg_rt ~ 1 + c_mean + c_sal + (1 | id)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 3 17082 17103 -8537.9 17076
## l1_model 5 16526 16561 -8257.9 16516 559.94 2 < 0.00000000000000022 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
```

The level-1 model does have significantly less deviance (16516 compared to 17076 for the null model), so is a better model. Hooray!

### 9.2.7 Adding Random Slopes

Let’s try adding random slopes for our level-1 variables of meaning and salience. This allows slopes to vary across people. Maybe some people have stronger relationships between salience and reaction time — such that when the change is more salient they really notice it, and when it’s less salient they notice it less — while other people have eagle eyes and notice the changes no matter their salience.

Level | Equation |
---|---|

Level 1 | \(lg\_rt_{ij} = \beta_{0j} + \beta_{1j}c\_mean_{ij} + \beta_{2j}c\_sal_{ij} + R_{ij}\) |

Level 2 | \(\beta_{0j} = \gamma_{00} + U_{0j}\) |

\(\beta_{1j} = \gamma_{10} + U_{1j}\) | |

\(\beta_{2j} = \gamma_{20} + U_{2j}\) | |

Combined | \(lg\_rt_{ij} = \gamma_{00} + \gamma_{10}c\_mean_{ij} + \gamma_{20}c\_sal_{ij} + U_{0j} + U_{1j}c\_mean_{ij} + U_{2j}c\_sal_{ij} + R_{ij}\) |

Let’s not estimate random effect covariances, so with this model, we’re estimating 7 parameters:

- \(\gamma_{00}\): the fixed effect for the intercept, controlling for
`c_mean`

and`c_sal`

; - \(\gamma_{10}\): the fixed effect for the slope of
`c_mean`

, controlling for`c_sal`

; - \(\gamma_{20}\): the fixed effect for the slope of
`c_sal`

, controlling for`c_mean`

; - \(\tau_0^2\): a random effect for the intercept capturing the variance of people around the intercept, controlling for
`c_mean`

and`c_sal`

; - \(\tau_1^2\): a random effect capturing how people’s slopes for
`c_mean`

vary around the grand mean slope, controlling for`c_sal`

; - \(\tau_2^2\): a random effect capturing how people’s slopes for
`c_sal`

vary around the grand mean slope, controlling for`c_mean`

; - \(\sigma^2\): a random effect capturing the variance of people around their own mean log reaction time, controlling for
`c_mean`

and`c_sal`

.

Let’s run our model with random slope effects (but no covariances) in R:

`<- lmer(lg_rt ~ 1 + c_mean + c_sal + (1|id) + (0 + c_mean|id) + (0 + c_sal|id), data = data, REML = FALSE) l1_random `

`## boundary (singular) fit: see help('isSingular')`

`summary(l1_random)`

```
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: lg_rt ~ 1 + c_mean + c_sal + (1 | id) + (0 + c_mean | id) + (0 + c_sal | id)
## Data: data
##
## AIC BIC logLik deviance df.resid
## 16529.4 16578.0 -8257.7 16515.4 7639
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5320 -0.7287 -0.1087 0.6142 3.8842
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 0.175630278350 0.41908266
## id.1 c_mean 0.000000003766 0.00006137
## id.2 c_sal 0.000685267135 0.02617761
## Residual 0.477680830140 0.69114458
## Number of obs: 7646, groups: id, 153
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.605250 0.034825 153.308074 46.09 <0.0000000000000002 ***
## c_mean -0.051539 0.004301 7337.355821 -11.98 <0.0000000000000002 ***
## c_sal -0.132294 0.007724 169.044391 -17.13 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) c_mean
## c_mean 0.044
## c_sal -0.014 -0.211
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
```

We get an estimation error! Recall that singularity occurs when a variance term is close to zero or a correlation between variance terms is near 1 (high multicollinearity). Looking at our output, the variance terms for meaning and salience both look quite small. Let’s try to address our estimation issue by removing the smaller of the two, the random effect for `c_mean`

.

```
<- lmer(lg_rt ~ 1 + c_mean + c_sal + (1|id) + (0 + c_sal|id), data = data, REML = FALSE)
l1_random_without_cmean summary(l1_random_without_cmean)
```

```
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: lg_rt ~ 1 + c_mean + c_sal + (1 | id) + (0 + c_sal | id)
## Data: data
##
## AIC BIC logLik deviance df.resid
## 16527.4 16569.0 -8257.7 16515.4 7640
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5320 -0.7287 -0.1087 0.6142 3.8842
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 0.1756384 0.41909
## id.1 c_sal 0.0006842 0.02616
## Residual 0.4776817 0.69115
## Number of obs: 7646, groups: id, 153
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.605250 0.034826 153.298193 46.09 <0.0000000000000002 ***
## c_mean -0.051539 0.004301 7351.748763 -11.98 <0.0000000000000002 ***
## c_sal -0.132294 0.007724 168.954450 -17.13 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) c_mean
## c_mean 0.044
## c_sal -0.014 -0.211
```

That took care of our singularity issue. However, the random effect for salience still looks very small. Let’s conduct a deviance test to see if including the random effect reduces deviance at all (that is, whether it is worth it to estimate).

`anova(l1_random, l1_random_without_cmean)`

```
## Data: data
## Models:
## l1_random_without_cmean: lg_rt ~ 1 + c_mean + c_sal + (1 | id) + (0 + c_sal | id)
## l1_random: lg_rt ~ 1 + c_mean + c_sal + (1 | id) + (0 + c_mean | id) + (0 + c_sal | id)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## l1_random_without_cmean 6 16527 16569 -8257.7 16515
## l1_random 7 16529 16578 -8257.7 16515 0 1 1
```

There is no significant difference between these models, so there doesn’t seem to be much benefit to including the random effect for salience because the model fits just as well without it.

### 9.2.8 Adding Level-2 Fixed Effects

The level-2 variables in our dataset are demographic variables about participants, which in this dataset are their sex, age in years, whether they 40 or older (`oldage`

= 1) or younger than 40 (`oldage`

= 0), or their age centered at 65 years old for those who are older than 40 (`yrs65`

). Let’s add `oldage`

and `sex`

as level-2 predictors of the intercept.

Level | Equation |
---|---|

Level 1 | \(lg\_rt_{ij} = \beta_{0j} + \beta_{1j}c\_mean_{ij} + \beta_{2j}c\_sal_{ij} + R_{ij}\) |

Level 2 | \(\beta_{0j} = \gamma_{00} + \gamma_{01}oldage_j + \gamma_{02}sex_j + U_{0j}\) |

\(\beta_{1j} = \gamma_{10}\) | |

\(\beta_{2j} = \gamma_{20}\) | |

Combined | \(lg\_rt_{ij} = \gamma_{00} + \gamma_{01}oldage_j + \gamma_{02}sex_j + \gamma_{10}c\_mean_{ij} + \gamma_{20}c\_sal_{ij} + U_{0j} + R_{ij}\) |

We’re estimating 7 effects:

- \(\gamma_{00}\): the fixed effect for the intercept, controlling for
`c_mean`

and`c_sal`

; - \(\gamma_{10}\): the fixed effect for the slope of
`c_mean`

, controlling for`c_sal`

; - \(\gamma_{20}\): the fixed effect for the slope of
`c_sal`

, controlling for`c_mean`

; - \(\gamma_{01}\): the fixed effect for the slope of
`oldage`

, controlling for`sex`

,`c_mean`

, and`c_sal`

; - \(\gamma_{02}\): the fixed effect for the slope of
`sex`

, controlling for`oldage`

,`c_mean`

and`c_sal`

; - \(\tau_0^2\): a random effect capturing how people’s mean log reaction times vary around the grand mean log reaction time, controlling for
`c_mean`

,`c_sal`

,`oldage`

, and`sex`

; - \(\sigma^2\): a random effect capturing the variance of people around their own mean log reaction time, controlling for
`c_mean`

,`c_sal`

,`oldage`

, and`sex`

.

```
<- lmer(lg_rt ~ 1 + c_mean + c_sal + oldage + sex + (1|id), data = data, REML = FALSE)
l2_model summary(l2_model)
```

```
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: lg_rt ~ 1 + c_mean + c_sal + oldage + sex + (1 | id)
## Data: data
##
## AIC BIC logLik deviance df.resid
## 16269.8 16318.4 -8127.9 16255.8 7639
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6108 -0.7341 -0.1058 0.6151 3.9626
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 0.02424 0.1557
## Residual 0.47852 0.6918
## Number of obs: 7646, groups: id, 153
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.280554 0.025655 153.175094 49.915 <0.0000000000000002 ***
## c_mean -0.051502 0.004304 7494.186660 -11.965 <0.0000000000000002 ***
## c_sal -0.132340 0.007434 7494.765418 -17.801 <0.0000000000000002 ***
## oldage 0.799398 0.030875 153.209862 25.891 <0.0000000000000002 ***
## sex 0.044666 0.030451 152.467294 1.467 0.144
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) c_mean c_sal oldage
## c_mean 0.059
## c_sal -0.017 -0.219
## oldage -0.392 -0.002 -0.003
## sex -0.681 0.001 -0.002 -0.075
```

The intercept of 1.28 is the mean log reaction time across all people at average values of meaning and salience for men (`sex`

= 0) who are younger than 40 (`oldage`

= 40). A one-unit increase in meaning is associated with a decrease in log reaction time of 0.05 (i.e., a faster reaction time), controlling for other variables. A one-unit increase in salience is associated with a decrease in log reaction time of 0.13 controlling for other variables. People older than 40 have 0.80 units longer of a log reaction time on average, controlling for other variables. Women have 0.04 unit-slower log reaction times on average, controlling for other variables. All coefficients are significant except for `sex`

. The term describing how people vary around the grand mean intercept is 0.02. The term describing how people vary around their own intercept is 0.48.

Let’s run a model without the non-significant `sex`

predictor and conduct a deviance test to see if the model fit is negatively impacted.

```
# model
<- lmer(lg_rt ~ 1 + c_mean + c_sal + oldage + (1|id), data = data, REML = FALSE)
l2_model_no_sex
# deviance test
anova(l2_model, l2_model_no_sex)
```

```
## Data: data
## Models:
## l2_model_no_sex: lg_rt ~ 1 + c_mean + c_sal + oldage + (1 | id)
## l2_model: lg_rt ~ 1 + c_mean + c_sal + oldage + sex + (1 | id)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## l2_model_no_sex 6 16270 16312 -8129.0 16258
## l2_model 7 16270 16318 -8127.9 16256 2.1363 1 0.1438
```

There is no significant difference in deviance, so we don’t lose on the model fit front if we don’t estimate the effect of `sex`

.

### 9.2.9 Adding Cross-Level Interactions

For our final model, let’s remove the level-2 term for `sex`

and look at a cross-level interaction between `oldage`

and the slope of `c_mean`

to consider the question: does age alter the effect of meaning on reaction times?

Level | Equation |
---|---|

Level 1 | \(lg\_rt_{ij} = \beta_{0j} + \beta_{1j}c\_mean_{ij} + \beta_{2j}c\_sal_{ij} + R_{ij}\) |

Level 2 | \(\beta_{0j} = \gamma_{00} + \gamma_{01}oldage_j + U_{0j}\) |

\(\beta_{1j} = \gamma_{10} + \gamma_{11}oldage_j\) | |

\(\beta_{2j} = \gamma_{20}\) | |

Combined | \(lg\_rt_{ij} = \gamma_{00} + \gamma_{01}oldage_j + \gamma_{10}c\_mean_{ij} + \gamma_{20}c\_sal_{ij} + \gamma_{11}c\_mean_{ij}*oldage_j + U_{0j} + R_{ij}\) |

We’re estimating 7 effects:

- \(\gamma_{00}\): the fixed effect for the intercept, controlling for
`c_mean`

,`c_sal`

, and`oldage`

; - \(\gamma_{10}\): the fixed effect for the slope of
`c_mean`

, controlling for`c_sal`

and`oldage`

; - \(\gamma_{20}\): the fixed effect for the slope of
`c_sal`

, controlling for`c_mean`

and`oldage`

; - \(\gamma_{01}\): the fixed effect for the slope of
`oldage`

, controlling for`c_mean`

and`c_sal`

; - \(\gamma_{11}\): the fixed effect for the cross-level interaction of
`oldage`

with`c_mean`

, controlling for`c_sal`

; - \(\tau_0^2\): a random effect capturing how people’s mean log reaction times vary around the grand mean log reaction time, controlling for
`c_mean`

,`c_sal`

, and`oldage`

; - \(\sigma^2\): a random effect capturing the variance of people around their own mean log reaction time, controlling for
`c_mean`

,`c_sal`

, and `oldage``.

```
<- lmer(lg_rt ~ 1 + c_mean + c_sal + oldage + oldage:c_mean + (1|id), data = data, REML = FALSE)
crosslevel_model summary(crosslevel_model)
```

```
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: lg_rt ~ 1 + c_mean + c_sal + oldage + oldage:c_mean + (1 | id)
## Data: data
##
## AIC BIC logLik deviance df.resid
## 16253.8 16302.4 -8119.9 16239.8 7639
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6032 -0.7333 -0.0988 0.6125 3.9049
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 0.0247 0.1572
## Residual 0.4774 0.6909
## Number of obs: 7646, groups: id, 153
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.301459 0.018951 154.490610 68.674 < 0.0000000000000002 ***
## c_mean -0.064989 0.005337 7493.066384 -12.176 < 0.0000000000000002 ***
## c_sal -0.132459 0.007425 7494.852621 -17.838 < 0.0000000000000002 ***
## oldage 0.815386 0.031128 156.060542 26.194 < 0.0000000000000002 ***
## c_mean:oldage 0.037168 0.008722 7495.089797 4.261 0.0000206 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) c_mean c_sal oldage
## c_mean 0.100
## c_sal -0.025 -0.174
## oldage -0.608 -0.057 -0.004
## c_mean:oldg -0.058 -0.593 -0.005 0.095
```

The interaction between `oldage`

and `c_mean`

is 0.04, suggesting that people older than 40 have 0.04 added to their (log) reaction times for more meaningful photos. Let’s do some quick calculations to emphasize that point. Remember that lower reaction time is better here (faster response).

- The intercept represents average log reaction time for someone under 40 with a stimulus at average salience and meaning: 1.30
- For people over 40, the average reaction time increases by 0.82 (coefficient for
`oldage`

) to`1.30 + 0.82 = 2.12`

- When photos are related to driving, the log reaction time decreases by -0.06 (the coefficient for
`c_mean`

). For people under 40, that’s`1.30 - 0.06 = 1.24`

- But when people are also older the benefit of the meaning is offset by age it increases by 0.03:
`1.30 + 0.82 - 0.06 + 0.03 = 2.09`

In summary, older people have slower reaction times. Photos being related to driving helps offset the effect of age somewhat, but even when photos are more related to driving they still have slower reaction times.

The other coefficient interpretations are similar to those we discussed in earlier models.

## 9.3 Conclusion

In this chapter, we reviewed our MLM pipeline and applied it to repeated measures without time in the model. In short, MLMs on repeated measures data can be executed in the same way as organizational models, however, the interpretations shift from being about a person clustered within some unit, to being about responses clustered within a person. In an organizational model, level-1 variables tend to measure aspects of a person, whereas these variables are often level-2 variables in a repeated measures model.

In Chapter 10, we will look at longitudinal models, i.e., repeated measures with time in the model.