The following data is from the Adult Cognition Study in the Wicha Lab.
In this experiment, participants are asked to verify if the word they hear matches the picture they see on screen. While performing this task, we measure continuous EEG activity (not in the current dataset) as well as their accuracy and reaction times. We also are sure to collect measures of their cognitive performance and demographics offline in a separate setting.
With this analysis, I am interested in learning if any of the factors we collected can explain why some people would have a faster reaction time (RT; measured in miliseconds) than others.
library(lme4)
## Loading required package: Matrix
load("D:/Behavioral_Data/N400.Rdata")
fit0<-lmer(RT~1+(1|Subject), data = N400, subset = complete.cases(N400))
summary(fit0)
## Linear mixed model fit by REML ['lmerMod']
## Formula: RT ~ 1 + (1 | Subject)
## Data: N400
## Subset: complete.cases(N400)
##
## REML criterion at convergence: 17542.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1493 -0.4501 -0.1322 0.2550 11.0970
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 16926 130.1
## Residual 50682 225.1
## Number of obs: 1280, groups: Subject, 16
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 597.87 33.13 18.05
The NULL model does tell us that there are differences in RTs between participants.
library(sjstats)
icc(fit0)
##
## Linear mixed model
##
## Family : gaussian (identity)
## Formula: RT ~ 1 + (1 | Subject)
##
## ICC (Subject): 0.2504
##calculating manually
subjvar<-16929
residvar<-50682
subjvar/(subjvar+residvar)
## [1] 0.2503883
In the NULL model, the factors of Subjects had a varaince of 16,926 ms, giving a standard deviation of 130.1 ms. The residual varaince was 50,682 ms, with a standard deviation of 225.1 ms.
Next, I will create a fixed effects model, using several online and offline measures, in hopes to better explain the variance between subjects.
Online measures
Syllables - no. of syllables of word
digit_first - order of experiments
rightfinger - right finger indicated “correct” response
correct_trial - the trial had a matching word and picture
N400ListA - version of the experimenet
accurate_resp - the participant responded accurately
Offline measures
Age - age of paritipant (in years)
LQ - handedness quotient
PicVoc_SS - picture vocabulary score
OralComp_SS - ora comprehension score
NumRev_SS - numbers reversed score
IncWord_SS - incomplete word score
Add_SS - addition score
Sub_SS - subtraction score
Mult_SS - multiplication score
female - the participant was female
fit1<-lmer(RT~Syllables+Age+LQ+PicVoc_SS+OralComp_SS+NumRev_SS+IncWord_SS+Add_SS+Sub_SS+Mult_SS+female+digit_first+rightfinger+N400ListA+correct_trial+accurate_resp+(1|Subject), data=N400, REML=T,subset = complete.cases(N400))
summary(fit1)
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## RT ~ Syllables + Age + LQ + PicVoc_SS + OralComp_SS + NumRev_SS +
## IncWord_SS + Add_SS + Sub_SS + Mult_SS + female + digit_first +
## rightfinger + N400ListA + correct_trial + accurate_resp +
## (1 | Subject)
## Data: N400
## Subset: complete.cases(N400)
##
## REML criterion at convergence: 17402.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2427 -0.4384 -0.1241 0.2643 11.0496
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 28902 170
## Residual 50609 225
## Number of obs: 1280, groups: Subject, 16
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 1070.5451 1319.6836 0.811
## Syllables -12.3655 9.6907 -1.276
## Age 14.6817 48.7426 0.301
## LQ 77.5055 948.8151 0.082
## PicVoc_SS -2.3865 17.6189 -0.135
## OralComp_SS -1.6190 10.0331 -0.161
## NumRev_SS -3.7573 10.9517 -0.343
## IncWord_SS 1.3811 5.8672 0.235
## Add_SS -2.4554 13.3164 -0.184
## Sub_SS 2.5448 10.8475 0.235
## Mult_SS 0.6049 19.3547 0.031
## female -87.8040 364.7993 -0.241
## digit_first -211.5352 204.7582 -1.033
## rightfinger -16.9732 234.7836 -0.072
## N400ListA 41.9035 195.8830 0.214
## correct_trial -17.2003 12.6028 -1.365
## accurate_resp -42.3776 35.0772 -1.208
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
This second model incorporates fixed effects to help explain more of the variance. While this model did help explain more of the variance, it does not appear that any of the measures I included accounted for a significant amount of the variance. If one of my fixed effects significantly explained a portion of variance, I would expect the T-value magnitude to be greater than 2.
The largest effect is “correct_trial”, with a T-value of -1.365, which might be explained because participants are slower at responded when the accurate response would be “incorrect”.
anova(fit0,fit1)
## refitting model(s) with ML (instead of REML)
## Data: N400
## Subset: complete.cases(N400)
## Models:
## fit0: RT ~ 1 + (1 | Subject)
## fit1: RT ~ Syllables + Age + LQ + PicVoc_SS + OralComp_SS + NumRev_SS +
## fit1: IncWord_SS + Add_SS + Sub_SS + Mult_SS + female + digit_first +
## fit1: rightfinger + N400ListA + correct_trial + accurate_resp +
## fit1: (1 | Subject)
## Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
## fit0 3 17557 17573 -8775.6 17551
## fit1 19 17561 17659 -8761.3 17523 28.737 16 0.02577 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The fixed effects model (fit1) did explain a significantly higher amount of variance than the NULL model (fit0), \(X^2\)(1) = 29.607, p <0.05.
icc(fit0)
##
## Linear mixed model
##
## Family : gaussian (identity)
## Formula: RT ~ 1 + (1 | Subject)
##
## ICC (Subject): 0.2504
icc(fit1)
##
## Linear mixed model
##
## Family : gaussian (identity)
## Formula: RT ~ Syllables + Age + LQ + PicVoc_SS + OralComp_SS + NumRev_SS + IncWord_SS + Add_SS + Sub_SS + Mult_SS + female + digit_first + rightfinger + N400ListA + correct_trial + accurate_resp + (1 | Subject)
##
## ICC (Subject): 0.3635
The ICC in the second model increased because more factors were included to better fit the data, meaning that more variance in the data was explained.