Attaching Data
Checking Packages
Centering Variables
Null Model
NullModel = glmer(GatesScore ~ (1|ID) ,data = Brussels3, family = binomial)
summary(NullModel)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7807.7 7821.5 -3901.8 7803.7 7582
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5977 -0.6803 0.3613 0.5463 2.4572
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 1.623 1.274
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.1558 0.1068 10.82 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Model Build Up, Person-Level Variables
Model1 = glmer(GatesScore ~ zAge + (1|ID) ,data = Brussels3, family = binomial)
summary(Model1)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ zAge + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7809.0 7829.8 -3901.5 7803.0 7581
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.6468 -0.6777 0.3633 0.5485 2.4488
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 1.616 1.271
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.15623 0.10659 10.848 <2e-16 ***
## zAge 0.08918 0.10630 0.839 0.401
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## zAge 0.009
Model2 = glmer(GatesScore ~ zAge + zWordAttack + (1|ID) ,data = Brussels3, family = binomial)
summary(Model2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ zAge + zWordAttack + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7733.0 7760.7 -3862.5 7725.0 7580
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5192 -0.6526 0.3738 0.5613 2.4073
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.8823 0.9393
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.14468 0.08173 14.005 < 2e-16 ***
## zAge 0.33621 0.08516 3.948 7.88e-05 ***
## zWordAttack 0.85423 0.08535 10.009 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge
## zAge 0.028
## zWordAttack 0.052 0.301
Model3 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + (1|ID) ,data = Brussels3, family = binomial)
summary(Model3)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ zAge + zWordAttack + zKnowIt + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7699.1 7733.7 -3844.5 7689.1 7579
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.8598 -0.6378 0.3638 0.5709 2.4235
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.6722 0.8199
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.14406 0.07312 15.646 < 2e-16 ***
## zAge 0.34956 0.07613 4.592 4.40e-06 ***
## zWordAttack 0.71718 0.07892 9.087 < 2e-16 ***
## zKnowIt 0.47553 0.07564 6.287 3.24e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt
## zAge 0.036
## zWordAttack 0.050 0.283
## zKnowIt 0.046 0.042 -0.253
Adding passage-level coh-metrix variables and arousal
Model4 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zRefCohesion + zDeepCohesion + (1|ID) ,data = Brussels3, family = binomial)
summary(Model4)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness +
## zRefCohesion + zDeepCohesion + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7501.2 7563.6 -3741.6 7483.2 7575
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.7544 -0.6135 0.3339 0.5452 3.0179
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7214 0.8493
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.18272 0.07560 15.644 < 2e-16 ***
## zAge 0.36051 0.07858 4.588 4.48e-06 ***
## zWordAttack 0.74026 0.08148 9.085 < 2e-16 ***
## zKnowIt 0.49092 0.07811 6.285 3.28e-10 ***
## zNarrativity 0.17200 0.04280 4.018 5.86e-05 ***
## zWordConcreteness -0.17328 0.03774 -4.591 4.41e-06 ***
## zRefCohesion 0.02908 0.03949 0.736 0.462
## zDeepCohesion 0.31812 0.03053 10.419 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt zKnwIt zNrrtv zWrdCn zRfChs
## zAge 0.036
## zWordAttack 0.050 0.283
## zKnowIt 0.046 0.042 -0.253
## zNarrativty 0.017 0.006 0.011 0.008
## zWrdCncrtns -0.026 -0.006 -0.012 -0.008 0.589
## zRefCohesin 0.007 0.000 0.001 0.001 -0.653 -0.481
## zDeepCohesn 0.051 0.014 0.029 0.020 -0.033 -0.161 -0.093
Model5 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zRefCohesion + zDeepCohesion + zArousal + (1|ID) ,data = Brussels3, family = binomial)
summary(Model5)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness +
## zRefCohesion + zDeepCohesion + zArousal + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7448.7 7518.1 -3714.4 7428.7 7574
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.3799 -0.5961 0.3290 0.5390 2.8345
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7341 0.8568
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.19515 0.07625 15.673 < 2e-16 ***
## zAge 0.36317 0.07920 4.585 4.53e-06 ***
## zWordAttack 0.74632 0.08213 9.087 < 2e-16 ***
## zKnowIt 0.49479 0.07874 6.284 3.30e-10 ***
## zNarrativity 0.22444 0.04393 5.109 3.23e-07 ***
## zWordConcreteness -0.29040 0.04064 -7.145 8.99e-13 ***
## zRefCohesion 0.11575 0.04100 2.823 0.00476 **
## zDeepCohesion 0.22681 0.03279 6.916 4.64e-12 ***
## zArousal 0.29129 0.03970 7.337 2.18e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt zKnwIt zNrrtv zWrdCn zRfChs zDpChs
## zAge 0.036
## zWordAttack 0.050 0.283
## zKnowIt 0.045 0.042 -0.253
## zNarrativty 0.028 0.007 0.014 0.010
## zWrdCncrtns -0.038 -0.009 -0.020 -0.013 0.454
## zRefCohesin 0.017 0.003 0.007 0.005 -0.565 -0.534
## zDeepCohesn 0.033 0.010 0.019 0.014 -0.074 0.014 -0.195
## zArousal 0.041 0.009 0.020 0.014 0.179 -0.395 0.282 -0.367
With syntactic simplicity, just in case we want to include in the appendix.
Model6 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zSyntacticSimplicity + zRefCohesion + zDeepCohesion + (1|ID) ,data = Brussels3, family = binomial)
summary(Model6)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness +
## zSyntacticSimplicity + zRefCohesion + zDeepCohesion + (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7439.0 7508.4 -3709.5 7419.0 7574
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.2316 -0.5931 0.3312 0.5387 2.8489
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7346 0.8571
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.20043 0.07632 15.728 < 2e-16 ***
## zAge 0.36307 0.07922 4.583 4.59e-06 ***
## zWordAttack 0.74692 0.08216 9.091 < 2e-16 ***
## zKnowIt 0.49486 0.07877 6.283 3.33e-10 ***
## zNarrativity 0.20013 0.04315 4.638 3.51e-06 ***
## zWordConcreteness -0.39633 0.04708 -8.418 < 2e-16 ***
## zSyntacticSimplicity -0.40513 0.05099 -7.945 1.94e-15 ***
## zRefCohesion -0.19235 0.04785 -4.020 5.83e-05 ***
## zDeepCohesion 0.35344 0.03140 11.254 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt zKnwIt zNrrtv zWrdCn zSyntS zRfChs
## zAge 0.036
## zWordAttack 0.050 0.283
## zKnowIt 0.045 0.042 -0.253
## zNarrativty 0.028 0.006 0.012 0.008
## zWrdCncrtns -0.052 -0.010 -0.022 -0.015 0.395
## zSyntctcSmp -0.053 -0.009 -0.021 -0.013 -0.100 0.616
## zRefCohesin -0.028 -0.004 -0.010 -0.007 -0.587 0.048 0.578
## zDeepCohesn 0.064 0.014 0.030 0.020 0.026 -0.235 -0.162 -0.191
Model7 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zSyntacticSimplicity+ zRefCohesion + zDeepCohesion + zArousal + (1|ID) ,data = Brussels3, family = binomial)
summary(Model7)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness +
## zSyntacticSimplicity + zRefCohesion + zDeepCohesion + zArousal +
## (1 | ID)
## Data: Brussels3
##
## AIC BIC logLik deviance df.resid
## 7411.5 7487.7 -3694.7 7389.5 7573
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.0276 -0.5868 0.3255 0.5341 2.7576
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7419 0.8613
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.20687 0.07669 15.737 < 2e-16 ***
## zAge 0.36461 0.07958 4.582 4.61e-06 ***
## zWordAttack 0.75036 0.08253 9.091 < 2e-16 ***
## zKnowIt 0.49708 0.07912 6.282 3.34e-10 ***
## zNarrativity 0.23937 0.04422 5.413 6.21e-08 ***
## zWordConcreteness -0.44177 0.04742 -9.316 < 2e-16 ***
## zSyntacticSimplicity -0.32535 0.05229 -6.222 4.90e-10 ***
## zRefCohesion -0.08275 0.05162 -1.603 0.109
## zDeepCohesion 0.27382 0.03427 7.990 1.35e-15 ***
## zArousal 0.22880 0.04194 5.456 4.88e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt zKnwIt zNrrtv zWrdCn zSyntS zRfChs zDpChs
## zAge 0.036
## zWordAttack 0.050 0.283
## zKnowIt 0.045 0.042 -0.253
## zNarrativty 0.036 0.006 0.014 0.009
## zWrdCncrtns -0.055 -0.011 -0.025 -0.017 0.339
## zSyntctcSmp -0.042 -0.007 -0.016 -0.010 -0.063 0.527
## zRefCohesin -0.015 -0.001 -0.004 -0.002 -0.476 -0.033 0.615
## zDeepCohesn 0.045 0.010 0.022 0.014 -0.037 -0.118 -0.241 -0.312
## zArousal 0.031 0.007 0.015 0.010 0.175 -0.199 0.248 0.370 -0.411
^ syntactic simplicity and referential cohesion have a 0.615 correlation ^ We are down to 158 participants because 6 were missing KnowIt Scores and one (4102) due to missing WA.
Model Comparisons
anova(NullModel, Model1)
anova(Model1, Model2)
anova(Model2, Model3)
anova(Model3, Model4)
anova(Model4, Model5)
anova(Model6, Model7)
anova(Model3, Model6)
r squared
library("MuMIn")
r.squaredGLMM(NullModel)
## Warning: 'r.squaredGLMM' now calculates a revised statistic. See the help page.
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0 0.3302951
## delta 0 0.2521663
r.squaredGLMM(Model1)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.001618431 0.3305459
## delta 0.001235713 0.2523802
r.squaredGLMM(Model2)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.1398047 0.3217206
## delta 0.1064127 0.2448784
r.squaredGLMM(Model3)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.1826135 0.3212971
## delta 0.1389760 0.2445196
r.squaredGLMM(Model4)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2183441 0.3589121
## delta 0.1683986 0.2768121
r.squaredGLMM(Model5)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2290952 0.3697288
## delta 0.1773750 0.2862593
r.squaredGLMM(Model6)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2333807 0.3733139
## delta 0.1809254 0.2894067
r.squaredGLMM(Model7)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2387858 0.3788631
## delta 0.1854847 0.2942944
Proportional Effect Sizes
library(r2glmm)
r2beta(model=Model4, method= 'sgv', data=Brussels3)
r4=r2beta(model=Model4, partial=TRUE, method= 'sgv' )
plot(r4, maxcov=8)
r2beta(model=Model5, method= 'sgv', data=Brussels3)
r5=r2beta(model=Model5, partial=TRUE, method= 'sgv' )
plot(r5, maxcov=8)
Statistical Assumptions Tests
shapiro.test(ranef(Model5)$ID[,1])
##
## Shapiro-Wilk normality test
##
## data: ranef(Model5)$ID[, 1]
## W = 0.98234, p-value = 0.04109
library("dplyr")
library("ggpubr")
## Loading required package: magrittr
##
## Attaching package: 'magrittr'
## The following object is masked from 'package:purrr':
##
## set_names
## The following object is masked from 'package:tidyr':
##
## extract
ggdensity(ranef(Model5)$ID[,1])
library("moments")
library("nortest")
ad.test(ranef(Model5)$ID [,1])
##
## Anderson-Darling normality test
##
## data: ranef(Model5)$ID[, 1]
## A = 0.60308, p-value = 0.1154
ks.test(ranef(Model5)$ID [,1],pnorm)
##
## One-sample Kolmogorov-Smirnov test
##
## data: ranef(Model5)$ID[, 1]
## D = 0.078985, p-value = 0.2778
## alternative hypothesis: two-sided
agostino.test(ranef(Model5)$ID [,1])
##
## D'Agostino skewness test
##
## data: ranef(Model5)$ID[, 1]
## skew = -0.14393, z = -0.76681, p-value = 0.4432
## alternative hypothesis: data have a skewness
shapiro.test(ranef(Model7)$ID[,1])
##
## Shapiro-Wilk normality test
##
## data: ranef(Model7)$ID[, 1]
## W = 0.9822, p-value = 0.0395
ggdensity(ranef(Model7)$ID[,1])
ad.test(ranef(Model7)$ID [,1])
##
## Anderson-Darling normality test
##
## data: ranef(Model7)$ID[, 1]
## A = 0.61046, p-value = 0.1107
ks.test(ranef(Model7)$ID [,1],pnorm)
##
## One-sample Kolmogorov-Smirnov test
##
## data: ranef(Model7)$ID[, 1]
## D = 0.077416, p-value = 0.3
## alternative hypothesis: two-sided
agostino.test(ranef(Model7)$ID [,1])
##
## D'Agostino skewness test
##
## data: ranef(Model7)$ID[, 1]
## skew = -0.14739, z = -0.78508, p-value = 0.4324
## alternative hypothesis: data have a skewness
```