if (!require("ggplot2")) install.packages("ggplot2"); library(ggplot2)
## Loading required package: ggplot2
if (!require("base")) install.packages("base"); library(base)
if (require(lavaan) == FALSE){install.packages("lavaan")};library(lavaan)
## Loading required package: lavaan
## This is lavaan 0.5-23.1097
## lavaan is BETA software! Please report any bugs.
dataFullItems0 = read.csv("~/Dropbox/Zhao/ePIRL16USA/FinalConfidenceFixedMissing.csv")
# View(dataFullItems0)

dataFullItems1=dataFullItems0[,-c(1:4)]
# View(dataFullItems1)
  
dataFullItems1$sex[dataFullItems1$sex == "0"] <-"Boy"
dataFullItems1$sex[dataFullItems1$sex == "1"] <-"Girl"
#In the original ePIRLS file, are coded as 0, and girls are coded 1.
dat = dataFullItems1
# View(dat)
attach(dat)
ePIRLS Confidence Scale Items:

Item # 1:

Plotting Confidence Item_1 (Con1):

ggplot(dat, aes(x= con1, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender", labels=c("Boys", "Girls"))+
  labs(x = "Confidence Scale: Item_1", y ="Frequency")+
  ggtitle('Item_1: "I usually do well in reading."')+
  theme_bw()

Conducting t-Test between males vs females: Item_1

item1Model <- lm(con1 ~ sex, data = dat)
summary(item1Model)
## 
## Call:
## lm(formula = con1 ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.5163 -0.4548  0.4837  0.5452  0.5452 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.45485    0.01729 199.766   <2e-16 ***
## sexGirl      0.06146    0.02428   2.531   0.0114 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.737 on 3685 degrees of freedom
## Multiple R-squared:  0.001736,   Adjusted R-squared:  0.001465 
## F-statistic: 6.408 on 1 and 3685 DF,  p-value: 0.0114

Findings: There is a significant difference between boys and girls on item#1 at alpha .05 (p-value: 0.0114).

Item # 2:

Plotting Confidence Item_2 (Con2):

ggplot(dat, aes(x= con2, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender", labels = c("Boys", "Girls"))+
  labs(x = "Confidence Scale: Item_2", y ="Frequency")+
  ggtitle('Item_2: "Reading is easy for me."')+
  theme_classic()

Conducting t-Test between males vs females: Item_2

item2Model <- lm(con2 ~ sex, data = dat)
summary(item2Model)
## 
## Call:
## lm(formula = con2 ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4693 -0.4626  0.5307  0.5374  0.5374 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 3.462555   0.018665 185.508   <2e-16 ***
## sexGirl     0.006713   0.026202   0.256    0.798    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7954 on 3685 degrees of freedom
## Multiple R-squared:  1.781e-05,  Adjusted R-squared:  -0.0002536 
## F-statistic: 0.06563 on 1 and 3685 DF,  p-value: 0.7978

Findings: there is NO significant difference between meales and females on item#2 (p-value: 0.7978).

Item # 3:(reversed):

Plotting Confidence Item_3 (Con3):

ggplot(dat, aes(x= con3r, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender", labels=c("Boys", "Girls"))+
  labs(x = "Confidence Scale: Item_3", y ="Frequency")+
  ggtitle('Item_3r: "I have trouble reading stories with difficult words."')+
  theme_bw()

Conducting t-Test between males vs females: Item_3

item3rModel <- lm(con3r ~ sex, data = dat)
summary(item3rModel)
## 
## Call:
## lm(formula = con3r ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.6481 -0.6481  0.3519  1.3519  1.4420 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.64813    0.02613 101.339   <2e-16 ***
## sexGirl     -0.09014    0.03668  -2.457    0.014 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.114 on 3685 degrees of freedom
## Multiple R-squared:  0.001636,   Adjusted R-squared:  0.001365 
## F-statistic: 6.038 on 1 and 3685 DF,  p-value: 0.01405

Findings: There is a statistical significant difference between meales and females on item#3 at alpha .05 (p-value: 0.01405).

Item # 4:(reversed):

Plotting Confidence Item_4r (Con4r):

ggplot(dat, aes(x= con4r, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender", labels = c("Boys", "Girls"))+
  labs(x = "Confidence Scale: Item_4r", y ="Frequency")+
  ggtitle('Item_4r: "Reading is harder for me than for many of my classmates." ')+
  theme_classic()

Conducting t-Test between males vs females: Item_4

item4rModel <- lm(con4r ~ sex, data = dat)
summary(item4rModel)
## 
## Call:
## lm(formula = con4r ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.2298 -1.1762  0.7702  0.8238  0.8238 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.17621    0.02452 129.546   <2e-16 ***
## sexGirl      0.05361    0.03442   1.558    0.119    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.045 on 3685 degrees of freedom
## Multiple R-squared:  0.000658,   Adjusted R-squared:  0.0003868 
## F-statistic: 2.426 on 1 and 3685 DF,  p-value: 0.1194

Findings: There is NO significant difference between meales and females on item#4r (p-value: 0.1194).

Item # 5:(reversed):

Plotting Confidence Item_5r (Con5r):

ggplot(dat, aes(x= con5r, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender",labels=c("Boys", "Girls")) +
  labs(x = "Confidence Scale: Item_5r", y ="Frequency")+
  ggtitle('Item_5r: "Reading is harder for me than any other subject."')+
  theme_linedraw()

Conducting t-Test between males vs females: Item_5

item5rModel <- lm(con5r ~ sex, data = dat)
summary(item5rModel)
## 
## Call:
## lm(formula = con5r ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.3330 -0.3330  0.6670  0.7478  0.7478 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.25220    0.02428  133.93   <2e-16 ***
## sexGirl      0.08077    0.03409    2.37   0.0179 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.035 on 3685 degrees of freedom
## Multiple R-squared:  0.001521,   Adjusted R-squared:  0.00125 
## F-statistic: 5.615 on 1 and 3685 DF,  p-value: 0.01786

There is a significant difference between meales and females on item#5r at alpha .05 (p-value: 0.01786). .

Item # 6:(reversed):

Plotting Confidence Item_6r (Con6r):

ggplot(dat, aes(x= con6r, fill = sex))+
  geom_density(alpha = .45)+
  xlim(-.1,5)+
  scale_fill_discrete("Gender",labels=c("Boys", "Girls")) +
  labs(x = "Confidence Scale: Item_6r", y ="Frequency")+
  ggtitle('Item_6r: "I am just not good at reading."')+
  theme_classic()

Conducting t-Test between males vs females: Item_6

item6rModel <- lm(con6r ~ sex, data = dat)
summary(item6rModel)
## 
## Call:
## lm(formula = con6r ~ sex, data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4564 -0.4367  0.5436  0.5633  0.5633 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.43667    0.02261 152.000   <2e-16 ***
## sexGirl      0.01977    0.03174   0.623    0.533    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9635 on 3685 degrees of freedom
## Multiple R-squared:  0.0001052,  Adjusted R-squared:  -0.0001661 
## F-statistic: 0.3879 on 1 and 3685 DF,  p-value: 0.5335

Findings: There is NO significant difference between meales and females on item#6r (p-value: 0.5335).

** End of Analyses **