lmer(DV~ A*B + (1+A*B:Subjects) + (1+A*B:Items))
Bates et al. (2015) [RePsychLing
package] &
Matuschek et al. (2017) provide a principled approach to finding the
best random structure for your data. Bates et al. suggest the
convergence issues are because the random effects are too complex for
the actual data (and overparameterized non-convergent LMM are not
interpretable). They provide the example of in a 2x2 within-subject
design you will have [(2X2 subjects) + (2X2 items) + 1 / 2] = 10 random
parameters. When you go to 2x2x2, we will get 36 random parameters. A
warning sign that your model is overparameterized are high random
correlations, \(r > [-.8 ,
.8]\).
They suggest conducting a PCA analysis of the random effects (of the maximal model) to determine how random components are really needed explaining and if we need all the parameters we are using (like in factor analysis we can examine a scree plot). Even if the maximal model converges does not mean we need all those random parameters. The benefit of pruning the random effects back allows us to protect our Type I error but increase our power (Matuschek et al., 2017).
Once we figure out the most complex structure the data can sustain, we can use model fit comparisons of nested models to find the best random effects.
: Fully crossed:
(1+C1*C2|Subject) + (1+C1*C2|Item) + (1|Subject:Item)
(1|Subject:Item)
for simplicity
todaySim8.csv
]DataSim8<-read.csv("Mixed/Sim8.csv")
DataSim8$C1<-factor(DataSim8$Condition1)
DataSim8$C2<-as.factor(DataSim8$Condition2)
DataSim8$Item<-as.factor(DataSim8$Item)
DataSim8$Subject<-as.factor(DataSim8$Subject)
(1+C1*C2|Subject) + (1+C1*C2|Item)
library(lme4)
FullMax.SSNoise<-lmer(DV_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1*Condition2|Item),
data=DataSim8, REML=FALSE)
summary(FullMax.SSNoise, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 |
## Subject) + (1 + Condition1 * Condition2 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4045.5 4172.7 -1997.7 3995.5 1175
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.95067 -0.66431 0.01886 0.66489 3.13739
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 0.000212 0.01456
## Condition1 0.059057 0.24302 1.00
## Condition2 0.006627 0.08141 1.00 1.00
## Condition1:Condition2 0.068101 0.26096 1.00 1.00 1.00
## Item (Intercept) 0.004994 0.07066
## Condition1 0.012173 0.11033 0.44
## Condition2 0.024671 0.15707 -0.83 0.13
## Condition1:Condition2 0.062291 0.24958 -0.09 -0.94 -0.47
## Residual 1.604201 1.26657
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 9.93133 0.04293 15.31430 231.32 < 2e-16 ***
## Condition1 3.97857 0.09238 18.67659 43.07 < 2e-16 ***
## Condition2 -3.88643 0.08964 13.92792 -43.36 2.93e-16 ***
## Condition1:Condition2 4.09045 0.17288 16.22527 23.66 5.24e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
library(RePsychLing)
FullMax.SSNoise.PCA<-rePCA(FullMax.SSNoise)
summary(FullMax.SSNoise.PCA)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 0.289 0.0007822 5.401e-05 3.246e-06
## Proportion of Variance 1.000 0.0000100 0.000e+00 0.000e+00
## Cumulative Proportion 1.000 1.0000000 1.000e+00 1.000e+00
##
## $Item
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 0.2221 0.1247 4.451e-05 1.171e-05
## Proportion of Variance 0.7603 0.2397 0.000e+00 0.000e+00
## Cumulative Proportion 0.7603 1.0000 1.000e+00 1.000e+00
Subject
: we see the first component captures 100%
of the random variance.Item
: we see the first two components capture 100%
of the random variance.FullMax.SSNoise.2<-lmer(DV_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2||Subject)
+(1+Condition1*Condition2||Item),
data=DataSim8, REML=FALSE)
summary(FullMax.SSNoise.2, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula:
## DV_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 ||
## Subject) + (1 + Condition1 * Condition2 || Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4026.2 4092.4 -2000.1 4000.2 1187
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.93808 -0.67371 0.01669 0.64739 3.14696
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 0.000e+00 0.000e+00
## Subject.1 Condition1 4.845e-02 2.201e-01
## Subject.2 Condition2 7.051e-10 2.655e-05
## Subject.3 Condition1:Condition2 9.043e-10 3.007e-05
## Item (Intercept) 2.898e-04 1.702e-02
## Item.1 Condition1 0.000e+00 0.000e+00
## Item.2 Condition2 8.432e-03 9.182e-02
## Item.3 Condition1:Condition2 2.042e-03 4.519e-02
## Residual 1.629e+00 1.276e+00
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 9.93133 0.03723 10.00456 266.76 < 2e-16 ***
## Condition1 3.97857 0.08392 29.99973 47.41 < 2e-16 ***
## Condition2 -3.88643 0.07919 9.99973 -49.08 2.98e-13 ***
## Condition1:Condition2 4.09045 0.14805 9.97458 27.63 9.34e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
FullMax.SSNoise.PCA2<-rePCA(FullMax.SSNoise.2)
summary(FullMax.SSNoise.PCA2)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 0.1725 2.356e-05 2.081e-05 0
## Proportion of Variance 1.0000 0.000e+00 0.000e+00 0
## Cumulative Proportion 1.0000 1.000e+00 1.000e+00 1
##
## $Item
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 0.07195 0.03541 0.01334 0
## Proportion of Variance 0.78338 0.18970 0.02692 0
## Cumulative Proportion 0.78338 0.97308 1.00000 1
FullMax.SSNoise.3<-lmer(DV_SSNoise ~ Condition1*Condition2
+(1+Condition1||Subject)
+(1+Condition2||Item),
data=DataSim8, REML=FALSE)
summary(FullMax.SSNoise.3, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 || Subject) +
## (1 + Condition2 || Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4018.2 4064.0 -2000.1 4000.2 1191
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.93921 -0.67450 0.01678 0.64702 3.14649
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 0.0000000 0.00000
## Subject.1 Condition1 0.0484452 0.22010
## Item (Intercept) 0.0002885 0.01698
## Item.1 Condition2 0.0084285 0.09181
## Residual 1.6286530 1.27619
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 9.93133 0.03723 10.00135 266.76 < 2e-16 ***
## Condition1 3.97857 0.08393 30.00000 47.41 < 2e-16 ***
## Condition2 -3.88643 0.07919 10.00007 -49.08 2.98e-13 ***
## Condition1:Condition2 4.09045 0.14736 1150.00164 27.76 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
FullMax.SSNoise.PCA3<-rePCA(FullMax.SSNoise.3)
summary(FullMax.SSNoise.PCA3)
## $Subject
## Importance of components:
## [,1] [,2]
## Standard deviation 0.1725 0
## Proportion of Variance 1.0000 0
## Cumulative Proportion 1.0000 1
##
## $Item
## Importance of components:
## [,1] [,2]
## Standard deviation 0.07194 0.01331
## Proportion of Variance 0.96691 0.03309
## Cumulative Proportion 0.96691 1.00000
FullMax.SSNoise.4<-lmer(DV_SSNoise ~ Condition1*Condition2
+(1|Subject)
+(1|Item),
data=DataSim8, REML=FALSE)
summary(FullMax.SSNoise.4, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SSNoise ~ Condition1 * Condition2 + (1 | Subject) + (1 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4015.4 4051.0 -2000.7 4001.4 1193
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8825 -0.6529 0.0059 0.6545 3.1948
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 0.0000000 0.00000
## Item (Intercept) 0.0001682 0.01297
## Residual 1.6429917 1.28179
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 9.93133 0.03723 9.97956 266.76 <2e-16 ***
## Condition1 3.97857 0.07400 1189.97847 53.76 <2e-16 ***
## Condition2 -3.88643 0.07400 1189.97847 -52.52 <2e-16 ***
## Condition1:Condition2 4.09045 0.14801 1189.97847 27.64 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
## Data: DataSim8
## Models:
## FullMax.SSNoise.4: DV_SSNoise ~ Condition1 * Condition2 + (1 | Subject) + (1 | Item)
## FullMax.SSNoise.3: DV_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 || Subject) + (1 + Condition2 || Item)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## FullMax.SSNoise.4 7 4015.4 4051 -2000.7 4001.4
## FullMax.SSNoise.3 9 4018.2 4064 -2000.1 4000.2 1.175 2 0.5557
Random Intercepts model is as good a fit as that last overparameterized model. As would expect, there are no random slopes or item level effects (LMM is not needed, but the process told us that pretty clearly)
(1+C1*C2|Subject) + (1|Item)
(1+C1*C2|Subject) + (1+C1*C2|Item)
DV_SS_RSlope_SSNoise.M1<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1*Condition2|Item),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M1, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 + Condition1 * Condition2 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4539.2 4666.4 -2244.6 4489.2 1175
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8240 -0.6370 0.0118 0.6150 3.7034
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.436815 4.84116
## Condition1 4.416334 2.10151 -0.20
## Condition2 4.036480 2.00910 0.39 0.08
## Condition1:Condition2 13.515658 3.67636 0.03 0.27 0.05
## Item (Intercept) 0.006239 0.07898
## Condition1 0.022577 0.15026 0.15
## Condition2 0.029861 0.17280 -0.93 0.23
## Condition1:Condition2 2.707920 1.64558 0.39 -0.85 -0.71
## Residual 1.624477 1.27455
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8850 30.0546 11.380 2.03e-12 ***
## Condition1 3.8278 0.3936 30.7373 9.726 6.77e-11 ***
## Condition2 -3.7412 0.3781 31.0274 -9.895 4.08e-11 ***
## Condition1:Condition2 7.5843 0.8620 33.4311 8.799 3.22e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
DV_SS_RSlope_SSNoise.M1.PCA<-rePCA(DV_SS_RSlope_SSNoise.M1)
summary(DV_SS_RSlope_SSNoise.M1.PCA)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 3.8711 2.9343 1.61133 1.32623
## Proportion of Variance 0.5361 0.3080 0.09289 0.06293
## Cumulative Proportion 0.5361 0.8442 0.93707 1.00000
##
## $Item
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 1.2988 0.12740 0.0001189 3.64e-20
## Proportion of Variance 0.9905 0.00953 0.0000000 0.00e+00
## Cumulative Proportion 0.9905 1.00000 1.0000000 1.00e+00
For Subject
: we see all components capture some
random variance, but the last term is rather a small amount. Maybe we
don’t need the interaction (we will check this later)?
For Item
: we see the first two components capture
100% of the random variance. So we really don’t need all that
complexity.
Step 3: Reduce complexity Cycle
DV_SS_RSlope_SSNoise.M2<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1*Condition2||Item),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M2, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 + Condition1 * Condition2 || Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4534.5 4631.2 -2248.2 4496.5 1181
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.7800 -0.6295 0.0127 0.6215 3.5679
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.432281 4.84069
## Condition1 4.410880 2.10021 -0.20
## Condition2 4.034431 2.00859 0.39 0.08
## Condition1:Condition2 13.508926 3.67545 0.03 0.27 0.05
## Item (Intercept) 0.001747 0.04179
## Item.1 Condition1 0.000000 0.00000
## Item.2 Condition2 0.014630 0.12095
## Item.3 Condition1:Condition2 2.708513 1.64576
## Residual 1.639378 1.28038
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8847 30.0274 11.384 2.03e-12 ***
## Condition1 3.8278 0.3905 30.0135 9.802 7.24e-11 ***
## Condition2 -3.7412 0.3760 30.3695 -9.949 4.52e-11 ***
## Condition1:Condition2 7.5843 0.8620 33.3288 8.799 3.31e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
DV_SS_RSlope_SSNoise.M2.PCA<-rePCA(DV_SS_RSlope_SSNoise.M2)
summary(DV_SS_RSlope_SSNoise.M2.PCA)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 3.8530 2.9208 1.60211 1.31972
## Proportion of Variance 0.5362 0.3081 0.09271 0.06291
## Cumulative Proportion 0.5362 0.8444 0.93709 1.00000
##
## $Item
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 1.285 0.09447 0.03264 0
## Proportion of Variance 0.994 0.00537 0.00064 0
## Cumulative Proportion 0.994 0.99936 1.00000 1
DV_SS_RSlope_SSNoise.M3<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1||Item),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M3, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 + Condition1 || Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4617.4 4703.9 -2291.7 4583.4 1183
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9268 -0.6401 0.0307 0.6732 2.9642
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 2.343e+01 4.840e+00
## Condition1 4.394e+00 2.096e+00 -0.20
## Condition2 4.015e+00 2.004e+00 0.39 0.08
## Condition1:Condition2 1.326e+01 3.642e+00 0.03 0.27 0.05
## Item (Intercept) 2.245e-04 1.498e-02
## Item.1 Condition1 3.258e-09 5.708e-05
## Residual 1.822e+00 1.350e+00
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8846 30.0105 11.38 2.05e-12 ***
## Condition1 3.8278 0.3906 29.9989 9.80 7.30e-11 ***
## Condition2 -3.7412 0.3741 29.9974 -10.00 4.56e-11 ***
## Condition1:Condition2 7.5843 0.6829 30.0137 11.11 3.75e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
DV_SS_RSlope_SSNoise.M3.PCA<-rePCA(DV_SS_RSlope_SSNoise.M3)
summary(DV_SS_RSlope_SSNoise.M3.PCA)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 3.6544 2.7471 1.51483 1.24734
## Proportion of Variance 0.5395 0.3049 0.09271 0.06286
## Cumulative Proportion 0.5395 0.8444 0.93714 1.00000
##
## $Item
## Importance of components:
## [,1] [,2]
## Standard deviation 0.0111 4.229e-05
## Proportion of Variance 1.0000 1.000e-05
## Cumulative Proportion 1.0000 1.000e+00
DV_SS_RSlope_SSNoise.M4<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1|Item),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M4, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4615.4 4696.8 -2291.7 4583.4 1184
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9268 -0.6401 0.0307 0.6732 2.9642
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 2.343e+01 4.84031
## Condition1 4.393e+00 2.09593 -0.20
## Condition2 4.016e+00 2.00398 0.39 0.08
## Condition1:Condition2 1.326e+01 3.64178 0.03 0.27 0.05
## Item (Intercept) 2.215e-04 0.01488
## Residual 1.822e+00 1.34992
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8846 30.0137 11.385 2.04e-12 ***
## Condition1 3.8278 0.3905 30.0100 9.802 7.25e-11 ***
## Condition2 -3.7412 0.3741 29.9897 -10.001 4.58e-11 ***
## Condition1:Condition2 7.5843 0.6829 30.0172 11.106 3.74e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00236296 (tol = 0.002, component 1)
## Data: DataSim8
## Models:
## DV_SS_RSlope_SSNoise.M4: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 | Subject) + (1 | Item)
## DV_SS_RSlope_SSNoise.M3: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 | Subject) + (1 + Condition1 || Item)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## DV_SS_RSlope_SSNoise.M4 16 4615.4 4696.8 -2291.7 4583.4
## DV_SS_RSlope_SSNoise.M3 17 4617.4 4703.9 -2291.7 4583.4 0 1 0.9982
DV_SS_RSlope_SSNoise.M5<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1+Condition2|Subject)
+(1|Item),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M5, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 +
## Condition2 | Subject) + (1 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4965.2 5026.2 -2470.6 4941.2 1188
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.86669 -0.66924 0.02599 0.64881 2.87445
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.411 4.838
## Condition1 4.304 2.075 -0.20
## Condition2 3.925 1.981 0.39 0.09
## Item (Intercept) 0.000 0.000
## Residual 2.719 1.649
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8847 30.0032 11.384 2.05e-12 ***
## Condition1 3.8278 0.3905 30.0073 9.801 7.27e-11 ***
## Condition2 -3.7412 0.3740 30.0015 -10.002 4.55e-11 ***
## Condition1:Condition2 7.5843 0.1904 1109.9980 39.833 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
Items is gone now as well, but removing the interaction hurt us?
Check fit
## Data: DataSim8
## Models:
## DV_SS_RSlope_SSNoise.M5: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 + Condition2 | Subject) + (1 | Item)
## DV_SS_RSlope_SSNoise.M4: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 | Subject) + (1 | Item)
## npar AIC BIC logLik deviance Chisq Df
## DV_SS_RSlope_SSNoise.M5 12 4965.2 5026.2 -2470.6 4941.2
## DV_SS_RSlope_SSNoise.M4 16 4615.4 4696.8 -2291.7 4583.4 357.76 4
## Pr(>Chisq)
## DV_SS_RSlope_SSNoise.M5
## DV_SS_RSlope_SSNoise.M4 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
DV_SS_RSlope_SSNoise.M6<-lmer(DV_SS_RSlope_SSNoise ~ Condition1*Condition2
+(1+Condition1*Condition2||Subject),
data=DataSim8, REML=FALSE)
summary(DV_SS_RSlope_SSNoise.M6, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 || Subject)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4610.5 4656.3 -2296.2 4592.5 1191
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.92704 -0.62995 0.03026 0.67443 2.97098
##
## Random effects:
## Groups Name Variance Std.Dev.
## Subject (Intercept) 23.435 4.841
## Subject.1 Condition1 4.394 2.096
## Subject.2 Condition2 4.015 2.004
## Subject.3 Condition1:Condition2 13.267 3.642
## Residual 1.822 1.350
## Number of obs: 1200, groups: Subject, 30
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.0711 0.8847 30.0002 11.384 2.06e-12 ***
## Condition1 3.8278 0.3906 30.0000 9.801 7.30e-11 ***
## Condition2 -3.7412 0.3740 30.0001 -10.002 4.55e-11 ***
## Condition1:Condition2 7.5843 0.6830 30.0003 11.104 3.78e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Data: DataSim8
## Models:
## DV_SS_RSlope_SSNoise.M6: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 || Subject)
## DV_SS_RSlope_SSNoise.M4: DV_SS_RSlope_SSNoise ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 | Subject) + (1 | Item)
## npar AIC BIC logLik deviance Chisq Df
## DV_SS_RSlope_SSNoise.M6 9 4610.5 4656.3 -2296.2 4592.5
## DV_SS_RSlope_SSNoise.M4 16 4615.4 4696.8 -2291.7 4583.4 9.0836 7
## Pr(>Chisq)
## DV_SS_RSlope_SSNoise.M6
## DV_SS_RSlope_SSNoise.M4 0.2467
(1+C1*C2|Subject) + (1+C1*C2|Item)
(1+C1*C2|Subject) + (1+C1*C2|Item)
Max.M1<-lmer(DV_SS_RSlope_SSNoise_Items ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1*Condition2|Item),
data=DataSim8, REML=FALSE)
summary(Max.M1, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula:
## DV_SS_RSlope_SSNoise_Items ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 + Condition1 * Condition2 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4619.4 4746.6 -2284.7 4569.4 1175
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9978 -0.6342 0.0002 0.6443 3.5752
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.551 4.853
## Condition1 4.507 2.123 -0.20
## Condition2 4.096 2.024 0.38 0.09
## Condition1:Condition2 3.489 1.868 0.10 0.21 0.09
## Item (Intercept) 2.194 1.481
## Condition1 5.177 2.275 0.25
## Condition2 2.256 1.502 -0.32 0.47
## Condition1:Condition2 2.599 1.612 0.23 -0.60 -0.69
## Residual 1.640 1.281
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.1912 1.0029 39.2576 10.162 1.50e-12 ***
## Condition1 4.7773 0.8206 16.0111 5.822 2.59e-05 ***
## Condition2 -2.9977 0.6063 22.2226 -4.944 5.87e-05 ***
## Condition1:Condition2 3.9174 0.6309 18.3156 6.209 6.81e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00415805 (tol = 0.002, component 1)
Max.M1.PCA<-rePCA(Max.M1)
summary(Max.M1.PCA)
## $Subject
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 3.8626 1.7788 1.40911 1.29085
## Proportion of Variance 0.6864 0.1456 0.09135 0.07666
## Cumulative Proportion 0.6864 0.8320 0.92334 1.00000
##
## $Item
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 2.1269 1.4167 0.7041 0.65489
## Proportion of Variance 0.6068 0.2692 0.0665 0.05752
## Cumulative Proportion 0.6068 0.8760 0.9425 1.00000
For Subject
& Item
: we see all
components capture some random variance.
Step 3: Reduce complexity Cycle
Max.M2<-lmer(DV_SS_RSlope_SSNoise_Items ~ Condition1*Condition2
+(1+Condition1*Condition2|Subject)
+(1+Condition1*Condition2||Item),
data=DataSim8, REML=FALSE)
summary(Max.M2, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula:
## DV_SS_RSlope_SSNoise_Items ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 | Subject) + (1 + Condition1 * Condition2 || Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4621.1 4717.8 -2291.5 4583.1 1181
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9004 -0.6446 0.0127 0.6317 3.5407
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.608 4.859
## Condition1 4.527 2.128 -0.20
## Condition2 4.115 2.028 0.38 0.08
## Condition1:Condition2 3.514 1.875 0.10 0.22 0.09
## Item (Intercept) 2.240 1.497
## Item.1 Condition1 5.197 2.280
## Item.2 Condition2 2.273 1.508
## Item.3 Condition1:Condition2 2.619 1.618
## Residual 1.640 1.281
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.1912 1.0061 38.8892 10.129 1.84e-12 ***
## Condition1 4.7773 0.8223 15.9698 5.810 2.68e-05 ***
## Condition2 -2.9977 0.6082 22.0265 -4.929 6.24e-05 ***
## Condition1:Condition2 3.9174 0.6332 18.1802 6.187 7.37e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
npar | AIC | BIC | logLik | deviance | Chisq | Df | Pr(>Chisq) | |
---|---|---|---|---|---|---|---|---|
Max.M2 | 19 | 4621.094 | 4717.806 | -2291.547 | 4583.094 | NA | NA | NA |
Max.M1 | 25 | 4619.369 | 4746.621 | -2284.685 | 4569.369 | 13.72516 | 6 | 0.0328616 |
Max.M3<-lmer(DV_SS_RSlope_SSNoise_Items ~ Condition1*Condition2
+(1+Condition1*Condition2||Subject)
+(1+Condition1*Condition2|Item),
data=DataSim8, REML=FALSE)
summary(Max.M3, corr=FALSE)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula:
## DV_SS_RSlope_SSNoise_Items ~ Condition1 * Condition2 + (1 + Condition1 *
## Condition2 || Subject) + (1 + Condition1 * Condition2 | Item)
## Data: DataSim8
##
## AIC BIC logLik deviance df.resid
## 4615.5 4712.2 -2288.7 4577.5 1181
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9901 -0.6311 0.0072 0.6479 3.5794
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Subject (Intercept) 23.583 4.856
## Subject.1 Condition1 4.522 2.126
## Subject.2 Condition2 4.105 2.026
## Subject.3 Condition1:Condition2 3.494 1.869
## Item (Intercept) 2.212 1.487
## Condition1 5.194 2.279 0.26
## Condition2 2.267 1.506 -0.33 0.46
## Condition1:Condition2 2.606 1.614 0.23 -0.61 -0.69
## Residual 1.640 1.281
## Number of obs: 1200, groups: Subject, 30; Item, 10
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 10.1912 1.0043 39.1091 10.148 1.63e-12 ***
## Condition1 4.7773 0.8219 15.9698 5.812 2.67e-05 ***
## Condition2 -2.9977 0.6074 22.0934 -4.935 6.10e-05 ***
## Condition1:Condition2 3.9174 0.6316 18.2527 6.202 7.02e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Data: DataSim8
## Models:
## Max.M3: DV_SS_RSlope_SSNoise_Items ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 || Subject) + (1 + Condition1 * Condition2 | Item)
## Max.M1: DV_SS_RSlope_SSNoise_Items ~ Condition1 * Condition2 + (1 + Condition1 * Condition2 | Subject) + (1 + Condition1 * Condition2 | Item)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## Max.M3 19 4615.5 4712.2 -2288.7 4577.5
## Max.M1 25 4619.4 4746.6 -2284.7 4569.4 8.088 6 0.2317
Model 3 is no worse a fit than Model 1.