Installing and Checking Packages

library("lavaan")
library("effects")
library("psych")
library("lme4")
library("lmerTest")
library("sjstats")
library("sjmisc")
library("lattice")

Importing and Attaching Data

library("sjmisc")
setwd("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2")
REDmasterPassageCombined <- read.csv("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2/REDmasterPassageCombined.csv")
View(REDmasterPassageCombined)
attach(REDmasterPassageCombined)

Checking Variable Distributions

histogram(Delta_DSyM_Sum_Combined)

boxplot(Delta_DSyM_Sum_Combined)

histogram(rc3_wj_br_ss_age)

boxplot(rc3_wj_br_ss_age)

histogram(CWPM_E)

boxplot(CWPM_E)

histogram(CWPM_N)

boxplot(CWPM_N)

histogram(rc3_age)

boxplot(rc3_age)

Basic Reading

NullE <- lm(rc3_wj_br_ss_age ~ CWPM_E,  data = REDmasterPassageCombined)
summary(NullE)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E, data = REDmasterPassageCombined)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -22.6877  -5.2226  -0.1916   5.6572  17.0930 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 81.27224    1.74766   46.50   <2e-16 ***
## CWPM_E       0.28467    0.01766   16.12   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.76 on 150 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.6341, Adjusted R-squared:  0.6317 
## F-statistic:   260 on 1 and 150 DF,  p-value: < 2.2e-16
NullN <- lm(rc3_wj_br_ss_age ~ CWPM_N,  data = REDmasterPassageCombined)
summary(NullN)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_N, data = REDmasterPassageCombined)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -21.7427  -6.0862   0.3508   5.6966  21.6311 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 82.44366    1.85521   44.44   <2e-16 ***
## CWPM_N       0.22430    0.01545   14.52   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.271 on 150 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.5843, Adjusted R-squared:  0.5815 
## F-statistic: 210.8 on 1 and 150 DF,  p-value: < 2.2e-16
M1 <- lm(rc3_wj_br_ss_age~ CWPM_E + DeltaDSyM_E_Sum ,  data = REDmasterPassageCombined)
summary(M1)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E + DeltaDSyM_E_Sum, data = REDmasterPassageCombined)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -21.0403  -5.2204  -0.5376   5.2748  16.7166 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     89.36673    2.18579  40.885  < 2e-16 ***
## CWPM_E           0.22596    0.01945  11.619  < 2e-16 ***
## DeltaDSyM_E_Sum -0.28984    0.05326  -5.442 2.12e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.111 on 149 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.6948, Adjusted R-squared:  0.6907 
## F-statistic: 169.6 on 2 and 149 DF,  p-value: < 2.2e-16
M2 <- lm(rc3_wj_br_ss_age~ CWPM_N +  DeltaDSyM_N_Sum ,  data = REDmasterPassageCombined)
summary(M2)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_N + DeltaDSyM_N_Sum, data = REDmasterPassageCombined)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -20.8016  -6.3350  -0.1194   4.7234  30.5875 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     89.66602    2.36256  37.953  < 2e-16 ***
## CWPM_N           0.18276    0.01718  10.641  < 2e-16 ***
## DeltaDSyM_N_Sum -0.26286    0.05797  -4.534 1.18e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.78 on 149 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.6347, Adjusted R-squared:  0.6298 
## F-statistic: 129.5 on 2 and 149 DF,  p-value: < 2.2e-16
M3 <- lm(rc3_wj_br_ss_age~ CWPM_E*DeltaDSyM_E_Sum ,  data = REDmasterPassageCombined)
summary(M3)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E * DeltaDSyM_E_Sum, data = REDmasterPassageCombined)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -21.0294  -5.1819  -0.5504   5.0560  15.3662 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            89.793397   2.175652  41.272   <2e-16 ***
## CWPM_E                  0.234371   0.019727  11.881   <2e-16 ***
## DeltaDSyM_E_Sum        -0.144267   0.090708  -1.590   0.1139    
## CWPM_E:DeltaDSyM_E_Sum -0.004284   0.002172  -1.973   0.0504 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.043 on 148 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.7026, Adjusted R-squared:  0.6966 
## F-statistic: 116.5 on 3 and 148 DF,  p-value: < 2.2e-16
plot(allEffects(M3), multiline=TRUE)

M4 <- lm(rc3_wj_br_ss_age~ CWPM_N*DeltaDSyM_N_Sum ,  data = REDmasterPassageCombined)
summary(M4)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_N * DeltaDSyM_N_Sum, data = REDmasterPassageCombined)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -22.817  -5.221  -0.723   5.474  27.380 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            89.161153   2.332015  38.234   <2e-16 ***
## CWPM_N                  0.202187   0.018627  10.854   <2e-16 ***
## DeltaDSyM_N_Sum        -0.052294   0.102495  -0.510   0.6107    
## CWPM_N:DeltaDSyM_N_Sum -0.004679   0.001893  -2.472   0.0146 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.65 on 148 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.6492, Adjusted R-squared:  0.6421 
## F-statistic:  91.3 on 3 and 148 DF,  p-value: < 2.2e-16
plot(allEffects(M4), multiline=TRUE)

Model comparisons an r squared

r2(NullE)
## Warning: 'r2' is deprecated.
## Use 'performance::r2()' instead.
## See help("Deprecated")
## # R2 for Linear Regression
## 
##        R2: 0.634
##   adj. R2: 0.632
r2(M1)
## Warning: 'r2' is deprecated.
## Use 'performance::r2()' instead.
## See help("Deprecated")
## # R2 for Linear Regression
## 
##        R2: 0.695
##   adj. R2: 0.691
r2(NullN)
## Warning: 'r2' is deprecated.
## Use 'performance::r2()' instead.
## See help("Deprecated")
## # R2 for Linear Regression
## 
##        R2: 0.584
##   adj. R2: 0.582
r2(M2)
## Warning: 'r2' is deprecated.
## Use 'performance::r2()' instead.
## See help("Deprecated")
## # R2 for Linear Regression
## 
##        R2: 0.635
##   adj. R2: 0.630
anova(NullE,M1)
anova(NullN,M2)

Looking at regions of significance

library("reghelper")
## 
## Attaching package: 'reghelper'
## The following object is masked from 'package:psych':
## 
##     ICC
## The following object is masked from 'package:base':
## 
##     beta
simple_slopes(M4)

Analysis of Poor Readers 25%ile <72 WCPM for Expository passage

detach(REDmasterPassageCombined)
REDmasterPassage25percentileE <- read.csv("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2/REDmasterPassage25percentileE.csv")
View(REDmasterPassage25percentileE)
attach(REDmasterPassage25percentileE)

P25 <- lm(rc3_wj_br_ss_age ~ CWPM_E,  data = REDmasterPassage25percentileE)
summary(P25)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E, data = REDmasterPassage25percentileE)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -16.9693  -5.0653   0.7464   5.4387  17.1698 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 76.41592    3.75615   20.34  < 2e-16 ***
## CWPM_E       0.35383    0.06911    5.12 5.36e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.324 on 48 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.3532, Adjusted R-squared:  0.3397 
## F-statistic: 26.21 on 1 and 48 DF,  p-value: 5.36e-06
M25 <- lm(rc3_wj_br_ss_age~ CWPM_E + DeltaDSyM_E_Sum ,  data = REDmasterPassage25percentileE)
summary(M25)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E + DeltaDSyM_E_Sum, data = REDmasterPassage25percentileE)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -9.691 -5.113 -1.248  5.228 16.279 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     89.57388    4.36392  20.526  < 2e-16 ***
## CWPM_E           0.18568    0.06996   2.654   0.0108 *  
## DeltaDSyM_E_Sum -0.24267    0.05491  -4.419 5.81e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.221 on 47 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.5431, Adjusted R-squared:  0.5236 
## F-statistic: 27.93 on 2 and 47 DF,  p-value: 1.016e-08
anova(P25,M25)

analysis for kids above 75percentile

detach(REDmasterPassage25percentileE)
REDmasterPassage75above <- read.csv("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2/REDmasterPassage75above.csv")
View(REDmasterPassage75above)
attach(REDmasterPassage75above)

P75 <- lm(rc3_wj_br_ss_age ~ CWPM_E,  data = REDmasterPassage75above)
summary(P75)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E, data = REDmasterPassage75above)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -20.5621  -5.4271  -0.2034   7.0202  17.7966 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  92.6425    20.9072   4.431 8.82e-05 ***
## CWPM_E        0.1941     0.1491   1.301    0.202    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.955 on 35 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.04616,    Adjusted R-squared:  0.0189 
## F-statistic: 1.694 on 1 and 35 DF,  p-value: 0.2016
M75 <- lm(rc3_wj_br_ss_age~ CWPM_E + DeltaDSyM_E_Sum ,  data = REDmasterPassage75above)
summary(M75)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E + DeltaDSyM_E_Sum, data = REDmasterPassage75above)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -19.3693  -6.1890  -0.6407   6.5549  16.1425 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     104.8243    24.5705   4.266  0.00015 ***
## CWPM_E            0.1234     0.1670   0.739  0.46513    
## DeltaDSyM_E_Sum  -0.8263     0.8721  -0.947  0.35010    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.968 on 34 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.07069,    Adjusted R-squared:  0.01603 
## F-statistic: 1.293 on 2 and 34 DF,  p-value: 0.2876
anova(P75,M75)

analysis of 26-50 percentile

detach(REDmasterPassage75above)
REDmasterPassage50percentileE <- read.csv("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2/REDmasterPassage50percentileE.csv")
View(REDmasterPassage50percentileE)
attach(REDmasterPassage50percentileE)

P50 <- lm(rc3_wj_br_ss_age ~ CWPM_E,  data = REDmasterPassage50percentileE)
summary(P50)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E, data = REDmasterPassage50percentileE)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -15.0887  -4.9256  -0.4337   4.9450  13.2563 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 100.18873   12.28053   8.158 2.03e-09 ***
## CWPM_E        0.08625    0.14445   0.597    0.555    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.166 on 33 degrees of freedom
## Multiple R-squared:  0.01069,    Adjusted R-squared:  -0.01929 
## F-statistic: 0.3565 on 1 and 33 DF,  p-value: 0.5545
M50 <- lm(rc3_wj_br_ss_age~ CWPM_E + DeltaDSyM_E_Sum ,  data = REDmasterPassage50percentileE)
summary(M50)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E + DeltaDSyM_E_Sum, data = REDmasterPassage50percentileE)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -14.298  -4.864  -1.429   4.853  11.163 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     110.8943    11.5700   9.585 6.34e-11 ***
## CWPM_E            0.0231     0.1312   0.176  0.86136    
## DeltaDSyM_E_Sum  -0.7331     0.2436  -3.010  0.00507 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.424 on 32 degrees of freedom
## Multiple R-squared:  0.2289, Adjusted R-squared:  0.1808 
## F-statistic: 4.751 on 2 and 32 DF,  p-value: 0.01561
anova(P50, M50)

analysis of kids in 50th-75th percentile

detach(REDmasterPassage50percentileE)
REDmasterPassage75percentile <- read.csv("~/Dropbox/Vanderbilt/Cutting Lab/Reading Error Measure (RED)/PCRC/Poster Data/Wide Data Y2/REDmasterPassage75percentile.csv")
View(REDmasterPassage75percentile)
attach(REDmasterPassage75percentile)

P5075 <- lm(rc3_wj_br_ss_age ~ CWPM_E,  data = REDmasterPassage75percentile)
summary(P5075)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E, data = REDmasterPassage75percentile)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -13.252  -4.771  -0.330   4.488  15.384 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 107.95351   21.20911   5.090 1.81e-05 ***
## CWPM_E        0.05195    0.19288   0.269     0.79    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.802 on 30 degrees of freedom
## Multiple R-squared:  0.002412,   Adjusted R-squared:  -0.03084 
## F-statistic: 0.07253 on 1 and 30 DF,  p-value: 0.7895
M5075 <- lm(rc3_wj_br_ss_age~ CWPM_E + DeltaDSyM_E_Sum ,  data = REDmasterPassage75percentile)
summary(M5075)
## 
## Call:
## lm(formula = rc3_wj_br_ss_age ~ CWPM_E + DeltaDSyM_E_Sum, data = REDmasterPassage75percentile)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -9.9751 -4.9307 -0.3394  3.4825 11.9616 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     114.40270   18.42220   6.210 8.97e-07 ***
## CWPM_E            0.02966    0.16675   0.178  0.86005    
## DeltaDSyM_E_Sum  -0.84864    0.25355  -3.347  0.00227 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.875 on 29 degrees of freedom
## Multiple R-squared:  0.2804, Adjusted R-squared:  0.2308 
## F-statistic:  5.65 on 2 and 29 DF,  p-value: 0.008468
anova(P5075, M5075)