Exercise 10: Mixed effects#
This homework assignment is designed to give you practice fitting and interpreting mixed effects models.
We will be using the LexicalData.csv and Items.csv files from the Homework/lexDat folder in the class GitHub repository again.
This data is a subset of the English Lexicon Project database. It provides the reaction times (in milliseconds) of many subjects as they are presented with letter strings and asked to decide, as quickly and as accurately as possible, whether the letter string is a word or not. The Items.csv provides characteristics of the words used, namely frequency (how common is this word?) and length (how many letters?). Unlike in the previous homework, there isn’t any missing data in the LexicalData.csv file.
Data courtesy of Balota, D.A., Yap, M.J., Cortese, M.J., Hutchison, K.A., Kessler, B., Loftis, B., Neely, J.H., Nelson, D.L., Simpson, G.B., & Treiman, R. (2007). The English Lexicon Project. Behavior Research Methods, 39, 445-459.
1. Loading and formatting the data (1 point)#
Load in data from the LexicalData.csv and Items.csv files. As in the previous homeworks, remove the commas from the reaction times and convert them from strings to numbers. Use left_join
to add word characteristics Length
and Log_Freq_Hal
from Items to LexicalData.
Note: the Freq_HAL
variable in Items.csv has a similar formatting issue, using string values with commas. We’re not going to worry about fixing this since we’re only using Log_Freq_HAL
, which is the natural log transformation of Freq_HAL
, in this homework.
# WRITE YOUR CODE HERE
2. Model fitting (4 points)#
First, fit a linear model with Log_Freq_HAL
and Length
as predictors, and D_RT
as the output. Include an interaction term. Use summary()
to look at the model output.
# WRITE YOUR CODE HERE
Now, install lme4
using install.packages()
and then load the library.
# WRITE YOUR CODE HERE
Now fit a mixed effects model that includes the same predictors as the linear model above, as well as random intercepts for Sub_ID
(i.e., cases where subject ID shifts the RT mean). Use summary()
to look at the model output.
# WRITE YOUR CODE HERE
3. Model assessment (4 points)#
Compare the three t-values for the fixed effects and the mixed effects models. How do they differ, and why?
Write your response here
Use the Aikeke Information Criterion (AIC) to compare these two models. Which one is better?
# WRITE YOUR CODE HERE
Write your response here
4. Reflection (1 point)#
What other random effects could be controlled for in this data set?
Write your response here
DUE: 5pm EST, March 18, 2024
IMPORTANT Did you collaborate with anyone on this assignment? If so, list their names here.
Someone’s Name