Attaching Data
Checking Packages
Centering Variables
Null Model
NullModel = glmer(GatesScore ~ (1|ID) ,data = Brussels, family = binomial)
summary(NullModel)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ (1 | ID)
## Data: Brussels
##
## AIC BIC logLik deviance df.resid
## 7807.7 7821.5 -3901.8 7803.7 7582
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5978 -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.83 <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 = Brussels, family = binomial)
summary(Model1)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: GatesScore ~ zAge + (1 | ID)
## Data: Brussels
##
## AIC BIC logLik deviance df.resid
## 7809.0 7829.8 -3901.5 7803.0 7581
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.6469 -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.847 <2e-16 ***
## zAge 0.08918 0.10631 0.839 0.402
## ---
## 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 = Brussels, 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: Brussels
##
## AIC BIC logLik deviance df.resid
## 7728.7 7756.4 -3860.3 7720.7 7580
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5382 -0.6523 0.3733 0.5611 2.4102
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.8889 0.9428
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.14621 0.08201 13.977 < 2e-16 ***
## zAge 0.34106 0.08545 3.991 6.57e-05 ***
## zWordAttack 0.86639 0.08517 10.172 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge
## zAge 0.029
## zWordAttack 0.055 0.301
Model3 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + (1|ID) ,data = Brussels, 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: Brussels
##
## AIC BIC logLik deviance df.resid
## 7697.4 7732.1 -3843.7 7687.4 7579
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.8685 -0.6387 0.3650 0.5704 2.4263
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.6893 0.8302
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.14554 0.07387 15.507 < 2e-16 ***
## zAge 0.35106 0.07692 4.564 5.01e-06 ***
## zWordAttack 0.72327 0.07968 9.078 < 2e-16 ***
## zKnowIt 0.46323 0.07675 6.035 1.59e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) zAge zWrdAt
## zAge 0.036
## zWordAttack 0.051 0.283
## zKnowIt 0.043 0.037 -0.269
Adding passage-level coh-metrix variables and arousal
Model4 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zSyntacticSimplicity + zRefCohesion + zDeepCohesion + (1|ID) ,data = Brussels, family = binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00170964 (tol = 0.001, component 1)
summary(Model4)
## 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: Brussels
##
## AIC BIC logLik deviance df.resid
## 7440.0 7509.3 -3710.0 7420.0 7574
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.2130 -0.5934 0.3308 0.5379 2.8425
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7544 0.8686
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.20166 0.07716 15.574 < 2e-16 ***
## zAge 0.36197 0.08010 4.519 6.22e-06 ***
## zWordAttack 0.74313 0.08316 8.936 < 2e-16 ***
## zKnowIt 0.48331 0.08006 6.037 1.57e-09 ***
## zNarrativity 0.20025 0.04316 4.640 3.49e-06 ***
## zWordConcreteness -0.39432 0.04709 -8.374 < 2e-16 ***
## zSyntacticSimplicity -0.40345 0.05100 -7.911 2.55e-15 ***
## zRefCohesion -0.19243 0.04787 -4.020 5.82e-05 ***
## zDeepCohesion 0.35186 0.03141 11.202 < 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.035
## zWordAttack 0.050 0.283
## zKnowIt 0.043 0.036 -0.272
## zNarrativty 0.027 0.006 0.012 0.008
## zWrdCncrtns -0.052 -0.009 -0.018 -0.014 0.395
## zSyntctcSmp -0.052 -0.008 -0.017 -0.013 -0.100 0.616
## zRefCohesin -0.027 -0.004 -0.010 -0.006 -0.588 0.048 0.578
## zDeepCohesn 0.063 0.013 0.025 0.020 0.026 -0.235 -0.162 -0.190
## convergence code: 0
## Model failed to converge with max|grad| = 0.00170964 (tol = 0.001, component 1)
Model5 = glmer(GatesScore ~ zAge + zWordAttack + zKnowIt + zNarrativity + zWordConcreteness + zSyntacticSimplicity + zRefCohesion + zDeepCohesion + zArousal + (1|ID) ,data = Brussels, family = binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00143498 (tol = 0.001, component 1)
summary(Model5)
## 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: Brussels
##
## AIC BIC logLik deviance df.resid
## 7412.5 7488.7 -3695.2 7390.5 7573
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.0054 -0.5878 0.3250 0.5332 2.7560
##
## Random effects:
## Groups Name Variance Std.Dev.
## ID (Intercept) 0.7619 0.8729
## Number of obs: 7584, groups: ID, 158
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.20807 0.07753 15.582 < 2e-16 ***
## zAge 0.36338 0.08046 4.516 6.29e-06 ***
## zWordAttack 0.74635 0.08354 8.934 < 2e-16 ***
## zKnowIt 0.48549 0.08042 6.037 1.57e-09 ***
## zNarrativity 0.23942 0.04424 5.412 6.23e-08 ***
## zWordConcreteness -0.43974 0.04743 -9.272 < 2e-16 ***
## zSyntacticSimplicity -0.32362 0.05230 -6.188 6.10e-10 ***
## zRefCohesion -0.08278 0.05164 -1.603 0.109
## zDeepCohesion 0.27222 0.03428 7.941 2.00e-15 ***
## zArousal 0.22873 0.04194 5.453 4.95e-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.035
## zWordAttack 0.050 0.283
## zKnowIt 0.043 0.036 -0.272
## zNarrativty 0.035 0.006 0.014 0.009
## zWrdCncrtns -0.055 -0.010 -0.021 -0.016 0.339
## zSyntctcSmp -0.042 -0.006 -0.013 -0.010 -0.063 0.527
## zRefCohesin -0.014 -0.001 -0.004 -0.002 -0.477 -0.033 0.615
## zDeepCohesn 0.044 0.009 0.017 0.014 -0.037 -0.119 -0.241 -0.312
## zArousal 0.031 0.007 0.014 0.010 0.175 -0.199 0.248 0.370 -0.411
## convergence code: 0
## Model failed to converge with max|grad| = 0.00143498 (tol = 0.001, component 1)
^ 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.
Converge checks
isSingular(Model4)
## [1] FALSE
isSingular(Model5)
## [1] FALSE
Model Comparisons
anova(NullModel, Model1)
anova(Model1, Model2)
anova(Model2, Model3)
anova(Model3, Model4)
anova(Model4, Model5)
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.3302967
## delta 0 0.2521677
r.squaredGLMM(Model1)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.001618497 0.3305459
## delta 0.001235763 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.1429456 0.3252498
## delta 0.1089387 0.2478727
r.squaredGLMM(Model3)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.1824610 0.3240744
## delta 0.1389959 0.2468746
r.squaredGLMM(Model4)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2308235 0.3743015
## delta 0.1790063 0.2902751
r.squaredGLMM(Model5)
## Warning: The null model is correct only if all variables used by the original
## model remain unchanged.
## R2m R2c
## theoretical 0.2361685 0.3797995
## delta 0.1835134 0.2951210
Proportional Effect Sizes
library(r2glmm)
r2beta(model=Model5, method= 'sgv', data=Brussels)
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.98397, p-value = 0.06452
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.53699, p-value = 0.1665
ks.test(ranef(Model5)$ID [,1],pnorm)
##
## One-sample Kolmogorov-Smirnov test
##
## data: ranef(Model5)$ID[, 1]
## D = 0.080708, p-value = 0.2548
## alternative hypothesis: two-sided
agostino.test(ranef(Model5)$ID [,1])
##
## D'Agostino skewness test
##
## data: ranef(Model5)$ID[, 1]
## skew = -0.097745, z = -0.522000, p-value = 0.6017
## alternative hypothesis: data have a skewness