library(tidyverse)
library(psych)
library(lavaan)
library(semPlot)
library(semPower)
library(knitr)
library(apaTables)
library(stats)
library(dplyr)
library(rstatix)
library(lavaan)
library(semPlot)
teacher2<- read.csv("teacher2.csv")
teacher2<-
separate(data = teacher2, col = Q5, into = c("teach1", "Teach2"), sep = ",")%>%
mutate(Level = case_when(teach1 %in% c("10th Grade", "11th Grade", "12th Grade", "10th Grade", "9th Grade") ~ "High_School",
teach1 %in% c("6th Grade", "7th Grade", "8th Grade") ~ "Middle_School",
teach1 %in% c("Kindergarten", "1st Grade", "2nd Grade", "3rd Grade", "4th Grade", "5th Grade") ~ "Elementary",
teach1 == "Post Birth or Pre-K" ~ "Pre_K",
teach1 == "Other (please explain)" ~ "Other"))
teacher2<- teacher2%>%
mutate(gender = case_when(Q4 == "Female" ~ "Female",
Q4 == "Male" ~ "Male"))
teacher2<- teacher2%>%
mutate(Teach = Q17_1 + Q17_3 + Q17_5)%>%
mutate(Anx = Q19_1 + Q19_2 + Q19_3 + Q19_4 + Q19_5)%>%
mutate(Dep2 = Q20_2 + Q20_3 + Q20_5 + Q20_7 + Q20_8)%>%
mutate(Dep = Q20_1 + Q20_2 + Q20_3 + Q20_4 + Q20_5 + Q20_6 + Q20_7 + Q20_8)%>%
mutate(PROS = Q23_3 + Q23_8 + Q23_9)%>%
mutate(GOV = Q23_5 + Q23_6 + Q23_7) %>%
mutate(COM = Q23_1 + Q23_2 + Q23_4) %>%
mutate(ASSM = Q41_1 + Q41_2 + Q41_4)%>%
mutate(TEFF = Q44_1 + Q44_2 + Q44_3 + Q44_4) %>%
mutate(Leave = Q15_4 + Q21 + Q25 + Q29 + Q41_3)
teacher2<- teacher2%>%
mutate(locale = case_when(Q10 %in% c("Rural community", "Small community, non-rural") ~ "Small Rural",
Q10 %in% c("Other", "Suburban Area", "Traditional public school", "Urban Area", "Small community, non-rural") ~ "Larger Community"))
teacher2<- teacher2%>%
select(ResponseId, Cont1, Level, gender, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q20_1, Q20_2, Q20_3, Q20_4, Q20_5, Q20_6, Q20_7, Q20_8, Q15_4, Q21, Q25, Q29, Q41_3, Anx, Dep, Leave)
library(dplyr)
library(datawizard)
descriptives<- dplyr:: select(teacher2, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q20_1, Q20_2, Q20_3, Q20_4, Q20_5, Q20_6, Q20_7, Q20_8, Q15_4, Q21, Q25, Q29, Q41_3, Anx, Dep, Leave)
descriptivetable<- psych::describe(descriptives)
write.csv(descriptivetable, "descriptives.csv")
descriptivetable
## vars n mean sd median trimmed mad min max range skew kurtosis se
## Q19_1 1 624 2.83 0.92 3 2.90 1.48 1 4 3 -0.36 -0.72 0.04
## Q19_2 2 626 3.12 0.86 3 3.22 1.48 1 4 3 -0.73 -0.20 0.03
## Q19_3 3 623 2.91 0.88 3 2.98 1.48 1 4 3 -0.47 -0.50 0.04
## Q19_4 4 624 2.84 0.88 3 2.89 1.48 1 4 3 -0.32 -0.65 0.04
## Q19_5 5 625 2.43 0.93 2 2.41 1.48 1 4 3 0.15 -0.84 0.04
## Q20_1 6 623 2.37 0.85 2 2.35 1.48 1 4 3 0.09 -0.64 0.03
## Q20_2 7 624 2.29 0.87 2 2.26 1.48 1 4 3 0.16 -0.70 0.03
## Q20_3 8 623 2.77 0.93 3 2.84 1.48 1 4 3 -0.34 -0.73 0.04
## Q20_4 9 619 3.00 0.80 3 3.06 0.00 1 4 3 -0.65 0.21 0.03
## Q20_5 10 623 2.66 0.90 3 2.71 1.48 1 4 3 -0.20 -0.73 0.04
## Q20_6 11 622 2.25 0.92 2 2.19 1.48 1 4 3 0.32 -0.71 0.04
## Q20_7 12 623 2.53 0.90 3 2.53 1.48 1 4 3 -0.05 -0.77 0.04
## Q20_8 13 622 1.87 0.80 2 1.78 1.48 1 4 3 0.80 0.37 0.03
## Q15_4 14 595 2.84 1.10 3 2.92 1.48 1 4 3 -0.48 -1.10 0.05
## Q21 15 621 2.70 0.96 3 2.75 1.48 1 4 3 -0.33 -0.84 0.04
## Q25 16 598 2.94 0.87 3 3.01 1.48 1 4 3 -0.49 -0.44 0.04
## Q29 17 575 2.56 0.87 3 2.57 1.48 1 4 3 -0.08 -0.66 0.04
## Q41_3 18 549 2.60 0.91 3 2.62 1.48 1 4 3 0.07 -0.87 0.04
## Anx 19 620 14.13 3.72 14 14.32 4.45 5 20 15 -0.40 -0.39 0.15
## Dep 20 612 19.70 5.29 20 19.76 4.45 8 32 24 -0.07 0.06 0.21
## Leave 21 484 13.62 3.35 14 13.81 2.97 5 20 15 -0.51 -0.28 0.15
itemanalysis<- descriptives<- dplyr:: select(teacher2, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q20_1, Q20_2, Q20_3, Q20_4, Q20_5, Q20_6, Q20_7, Q20_8, Q15_4, Q21, Q25, Q29, Q41_3)
items<- sjPlot::tab_itemscale(itemanalysis)
items
Component 1
Row
|
Missings
|
Mean
|
SD
|
Skew
|
Item Difficulty
|
Item Discrimination
|
α if deleted
|
Q19_1
|
8.24 %
|
2.83
|
0.92
|
-0.36
|
0.71
|
0.75
|
0.92
|
Q19_2
|
7.94 %
|
3.12
|
0.86
|
-0.73
|
0.78
|
0.65
|
0.92
|
Q19_3
|
8.38 %
|
2.91
|
0.88
|
-0.48
|
0.73
|
0.74
|
0.92
|
Q19_4
|
8.24 %
|
2.84
|
0.88
|
-0.32
|
0.71
|
0.72
|
0.92
|
Q19_5
|
8.09 %
|
2.43
|
0.93
|
0.15
|
0.61
|
0.65
|
0.92
|
Q20_1
|
8.38 %
|
2.37
|
0.85
|
0.09
|
0.59
|
0.66
|
0.92
|
Q20_2
|
8.24 %
|
2.29
|
0.87
|
0.16
|
0.57
|
0.73
|
0.92
|
Q20_3
|
8.38 %
|
2.77
|
0.93
|
-0.34
|
0.69
|
0.64
|
0.92
|
Q20_4
|
8.97 %
|
3
|
0.8
|
-0.65
|
0.75
|
0.63
|
0.92
|
Q20_5
|
8.38 %
|
2.66
|
0.9
|
-0.2
|
0.67
|
0.60
|
0.92
|
Q20_6
|
8.53 %
|
2.25
|
0.92
|
0.32
|
0.56
|
0.65
|
0.92
|
Q20_7
|
8.38 %
|
2.53
|
0.9
|
-0.05
|
0.63
|
0.69
|
0.92
|
Q20_8
|
8.53 %
|
1.87
|
0.8
|
0.8
|
0.47
|
0.51
|
0.92
|
Q15_4
|
12.50 %
|
2.84
|
1.1
|
-0.48
|
0.71
|
0.46
|
0.93
|
Q21
|
8.68 %
|
2.7
|
0.96
|
-0.33
|
0.68
|
0.66
|
0.92
|
Q25
|
12.06 %
|
2.94
|
0.87
|
-0.5
|
0.74
|
0.61
|
0.92
|
Q29
|
15.44 %
|
2.56
|
0.87
|
-0.08
|
0.64
|
0.36
|
0.93
|
Q41_3
|
19.26 %
|
2.6
|
0.91
|
0.08
|
0.65
|
0.37
|
0.93
|
Mean inter-item-correlation=0.410 · Cronbach’s α=0.925
|
gendertable<-with(teacher2, table(gender))
genderprop<- prop.table(gendertable)
teachertable<- with(teacher2, table(Cont1))
teacherprop<- prop.table(teachertable)
gradetable<- with(teacher2, table(Level))
gradeprop<- prop.table(gradetable)
gendern<- as.data.frame(gendertable)
genderprop<- as.data.frame(genderprop)
gen<- left_join(gendern, genderprop, by = "gender")%>%
rename(category = gender)
teachern<- as.data.frame(teachertable)
teacherprop<- as.data.frame(teacherprop)
teach<- left_join(teachern, teacherprop, by = "Cont1")%>%
rename(category = Cont1)
graden<-as.data.frame(gradetable)
gradeprop<- as.data.frame(gradeprop)
gd<- left_join(graden, gradeprop, by = "Level")%>%
rename(category = Level)
frequencies<- rbind(gen, teach, gd)
write.csv(frequencies, "frequencies.csv")
frequencies
## category Freq.x Freq.y
## 1 Female 503 0.76327769
## 2 Male 156 0.23672231
## 3 Elective 87 0.13063063
## 4 English Language Arts 70 0.10510511
## 5 General Elementary 195 0.29279279
## 6 Math 83 0.12462462
## 7 Other 47 0.07057057
## 8 Science 42 0.06306306
## 9 Social Studies 53 0.07957958
## 10 Special Education 89 0.13363363
## 11 Elementary 277 0.41037037
## 12 High_School 166 0.24592593
## 13 Middle_School 173 0.25629630
## 14 Other 34 0.05037037
## 15 Pre_K 25 0.03703704
anxcfa<-
'
ANXs=~ Q19_1 + Q19_2 + Q19_3 + Q19_4 + Q19_5
'
fitanx<- cfa(anxcfa, data=teacher2)
summary(fitanx, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 21 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 10
##
## Used Total
## Number of observations 620 680
##
## Model Test User Model:
##
## Test statistic 19.801
## Degrees of freedom 5
## P-value (Chi-square) 0.001
##
## Model Test Baseline Model:
##
## Test statistic 1703.143
## Degrees of freedom 10
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.991
## Tucker-Lewis Index (TLI) 0.983
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -3205.970
## Loglikelihood unrestricted model (H1) -3196.069
##
## Akaike (AIC) 6431.940
## Bayesian (BIC) 6476.237
## Sample-size adjusted Bayesian (BIC) 6444.489
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.069
## 90 Percent confidence interval - lower 0.039
## 90 Percent confidence interval - upper 0.102
## P-value RMSEA <= 0.05 0.136
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.017
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ANXs =~
## Q19_1 1.000 0.743 0.811
## Q19_2 0.897 0.043 21.094 0.000 0.667 0.774
## Q19_3 1.036 0.042 24.512 0.000 0.770 0.873
## Q19_4 0.934 0.043 21.638 0.000 0.694 0.790
## Q19_5 0.854 0.047 18.036 0.000 0.635 0.684
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q19_1 0.287 0.021 13.745 0.000 0.287 0.342
## .Q19_2 0.297 0.020 14.634 0.000 0.297 0.401
## .Q19_3 0.184 0.017 11.181 0.000 0.184 0.237
## .Q19_4 0.291 0.020 14.306 0.000 0.291 0.377
## .Q19_5 0.458 0.029 15.884 0.000 0.458 0.532
## ANXs 0.552 0.047 11.837 0.000 1.000 1.000
##
## R-Square:
## Estimate
## Q19_1 0.658
## Q19_2 0.599
## Q19_3 0.763
## Q19_4 0.623
## Q19_5 0.468
semPaths(fitanx, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

depcfa<-
'
DEPs=~ Q20_1 + Q20_2 + Q20_3 + Q20_4 + Q20_5 + Q20_6 + Q20_7 + Q20_8
'
fitdep<- cfa(depcfa, data=teacher2)
summary(fitdep, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 22 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 16
##
## Used Total
## Number of observations 612 680
##
## Model Test User Model:
##
## Test statistic 151.926
## Degrees of freedom 20
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 2437.152
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.945
## Tucker-Lewis Index (TLI) 0.923
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5101.736
## Loglikelihood unrestricted model (H1) -5025.773
##
## Akaike (AIC) 10235.472
## Bayesian (BIC) 10306.139
## Sample-size adjusted Bayesian (BIC) 10255.343
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.104
## 90 Percent confidence interval - lower 0.089
## 90 Percent confidence interval - upper 0.120
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.041
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## DEPs =~
## Q20_1 1.000 0.676 0.794
## Q20_2 1.067 0.048 22.386 0.000 0.721 0.829
## Q20_3 0.962 0.053 18.231 0.000 0.650 0.702
## Q20_4 0.804 0.046 17.586 0.000 0.543 0.682
## Q20_5 0.881 0.052 17.009 0.000 0.595 0.663
## Q20_6 0.982 0.052 18.958 0.000 0.664 0.725
## Q20_7 1.007 0.050 20.080 0.000 0.681 0.760
## Q20_8 0.696 0.046 15.043 0.000 0.471 0.596
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q20_1 0.267 0.019 14.312 0.000 0.267 0.369
## .Q20_2 0.236 0.018 13.397 0.000 0.236 0.312
## .Q20_3 0.434 0.028 15.695 0.000 0.434 0.507
## .Q20_4 0.340 0.021 15.892 0.000 0.340 0.535
## .Q20_5 0.453 0.028 16.049 0.000 0.453 0.561
## .Q20_6 0.397 0.026 15.440 0.000 0.397 0.474
## .Q20_7 0.339 0.023 14.958 0.000 0.339 0.422
## .Q20_8 0.401 0.024 16.478 0.000 0.401 0.644
## DEPs 0.457 0.040 11.442 0.000 1.000 1.000
##
## R-Square:
## Estimate
## Q20_1 0.631
## Q20_2 0.688
## Q20_3 0.493
## Q20_4 0.465
## Q20_5 0.439
## Q20_6 0.526
## Q20_7 0.578
## Q20_8 0.356
semPaths(fitdep, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

lvcfa<-
'
lvs=~ Q15_4 + Q21 + Q25 + Q29 + Q41_3
'
fitlv<- cfa(lvcfa, data=teacher2)
summary(fitlv, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 21 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 10
##
## Used Total
## Number of observations 484 680
##
## Model Test User Model:
##
## Test statistic 15.022
## Degrees of freedom 5
## P-value (Chi-square) 0.010
##
## Model Test Baseline Model:
##
## Test statistic 629.151
## Degrees of freedom 10
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.984
## Tucker-Lewis Index (TLI) 0.968
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -2954.509
## Loglikelihood unrestricted model (H1) -2946.998
##
## Akaike (AIC) 5929.018
## Bayesian (BIC) 5970.838
## Sample-size adjusted Bayesian (BIC) 5939.099
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.064
## 90 Percent confidence interval - lower 0.028
## 90 Percent confidence interval - upper 0.103
## P-value RMSEA <= 0.05 0.222
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.027
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## lvs =~
## Q15_4 1.000 0.722 0.657
## Q21 0.980 0.074 13.178 0.000 0.707 0.750
## Q25 1.013 0.074 13.621 0.000 0.731 0.846
## Q29 0.555 0.062 8.974 0.000 0.401 0.470
## Q41_3 0.498 0.065 7.614 0.000 0.360 0.393
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q15_4 0.685 0.053 12.984 0.000 0.685 0.568
## .Q21 0.390 0.036 10.878 0.000 0.390 0.438
## .Q25 0.213 0.030 7.187 0.000 0.213 0.285
## .Q29 0.567 0.039 14.651 0.000 0.567 0.779
## .Q41_3 0.709 0.047 14.980 0.000 0.709 0.846
## lvs 0.522 0.070 7.434 0.000 1.000 1.000
##
## R-Square:
## Estimate
## Q15_4 0.432
## Q21 0.562
## Q25 0.715
## Q29 0.221
## Q41_3 0.154
semPaths(fitlv, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

allcfa<-
'
alls=~ ANXs=~ Q19_1 + Q19_2 + Q19_3 + Q19_4 + Q19_5 + Q20_1 + Q20_2 + Q20_3 + Q20_4 + Q20_5 + Q20_6 + Q20_7 + Q20_8 + Q15_4 + Q21 + Q25 + Q29 + Q41_3
'
fitall<- cfa(allcfa, data=teacher2)
summary(fitall, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 27 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 36
##
## Used Total
## Number of observations 476 680
##
## Model Test User Model:
##
## Test statistic 878.764
## Degrees of freedom 135
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 4586.965
## Degrees of freedom 153
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.832
## Tucker-Lewis Index (TLI) 0.810
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -9307.549
## Loglikelihood unrestricted model (H1) -8868.167
##
## Akaike (AIC) 18687.098
## Bayesian (BIC) 18837.053
## Sample-size adjusted Bayesian (BIC) 18722.794
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.108
## 90 Percent confidence interval - lower 0.101
## 90 Percent confidence interval - upper 0.114
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.067
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alls =~
## Q19_1 1.000 0.732 0.796
## Q19_2 0.809 0.050 16.333 0.000 0.592 0.693
## Q19_3 0.951 0.050 19.201 0.000 0.697 0.787
## Q19_4 0.937 0.050 18.642 0.000 0.686 0.769
## Q19_5 0.895 0.054 16.435 0.000 0.656 0.697
## Q20_1 0.789 0.049 16.115 0.000 0.578 0.686
## Q20_2 0.916 0.049 18.738 0.000 0.671 0.772
## Q20_3 0.855 0.054 15.837 0.000 0.626 0.676
## Q20_4 0.709 0.046 15.318 0.000 0.519 0.658
## Q20_5 0.753 0.052 14.386 0.000 0.551 0.624
## Q20_6 0.836 0.053 15.899 0.000 0.612 0.678
## Q20_7 0.886 0.051 17.449 0.000 0.648 0.731
## Q20_8 0.583 0.048 12.130 0.000 0.427 0.539
## Q15_4 0.666 0.068 9.790 0.000 0.488 0.444
## Q21 0.849 0.056 15.290 0.000 0.622 0.657
## Q25 0.690 0.052 13.277 0.000 0.506 0.583
## Q29 0.404 0.054 7.481 0.000 0.296 0.345
## Q41_3 0.457 0.058 7.943 0.000 0.335 0.365
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q19_1 0.309 0.023 13.695 0.000 0.309 0.366
## .Q19_2 0.379 0.026 14.504 0.000 0.379 0.519
## .Q19_3 0.299 0.022 13.805 0.000 0.299 0.381
## .Q19_4 0.325 0.023 13.980 0.000 0.325 0.408
## .Q19_5 0.455 0.031 14.486 0.000 0.455 0.514
## .Q20_1 0.376 0.026 14.541 0.000 0.376 0.530
## .Q20_2 0.305 0.022 13.952 0.000 0.305 0.404
## .Q20_3 0.465 0.032 14.587 0.000 0.465 0.543
## .Q20_4 0.353 0.024 14.666 0.000 0.353 0.567
## .Q20_5 0.475 0.032 14.790 0.000 0.475 0.610
## .Q20_6 0.440 0.030 14.577 0.000 0.440 0.540
## .Q20_7 0.367 0.026 14.283 0.000 0.367 0.466
## .Q20_8 0.445 0.030 15.020 0.000 0.445 0.710
## .Q15_4 0.968 0.064 15.183 0.000 0.968 0.803
## .Q21 0.509 0.035 14.670 0.000 0.509 0.568
## .Q25 0.496 0.033 14.914 0.000 0.496 0.660
## .Q29 0.647 0.042 15.293 0.000 0.647 0.881
## .Q41_3 0.728 0.048 15.274 0.000 0.728 0.867
## alls 0.536 0.052 10.300 0.000 1.000 1.000
##
## R-Square:
## Estimate
## Q19_1 0.634
## Q19_2 0.481
## Q19_3 0.619
## Q19_4 0.592
## Q19_5 0.486
## Q20_1 0.470
## Q20_2 0.596
## Q20_3 0.457
## Q20_4 0.433
## Q20_5 0.390
## Q20_6 0.460
## Q20_7 0.534
## Q20_8 0.290
## Q15_4 0.197
## Q21 0.432
## Q25 0.340
## Q29 0.119
## Q41_3 0.133
semPaths(fitall, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

threecfa<-
'
ANXs=~ Q19_1 + Q19_2 + Q19_3 + Q19_4 + Q19_5
DEPs=~ Q20_1 + Q20_2 + Q20_3 + Q20_4 + Q20_5 + Q20_6 + Q20_7 + Q20_8
QT=~ Q15_4 + Q21 + Q25 + Q29 + Q41_3
'
fitthree<- cfa(threecfa, data=teacher2)
summary(fitthree, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 40 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 39
##
## Used Total
## Number of observations 476 680
##
## Model Test User Model:
##
## Test statistic 373.569
## Degrees of freedom 132
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 4586.965
## Degrees of freedom 153
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.946
## Tucker-Lewis Index (TLI) 0.937
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -9054.951
## Loglikelihood unrestricted model (H1) -8868.167
##
## Akaike (AIC) 18187.902
## Bayesian (BIC) 18350.354
## Sample-size adjusted Bayesian (BIC) 18226.573
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.062
## 90 Percent confidence interval - lower 0.055
## 90 Percent confidence interval - upper 0.069
## P-value RMSEA <= 0.05 0.004
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.042
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ANXs =~
## Q19_1 1.000 0.765 0.832
## Q19_2 0.849 0.045 18.938 0.000 0.650 0.761
## Q19_3 0.993 0.044 22.546 0.000 0.760 0.858
## Q19_4 0.935 0.046 20.424 0.000 0.715 0.802
## Q19_5 0.874 0.051 17.249 0.000 0.669 0.711
## DEPs =~
## Q20_1 1.000 0.647 0.768
## Q20_2 1.102 0.059 18.815 0.000 0.713 0.821
## Q20_3 0.992 0.064 15.483 0.000 0.642 0.694
## Q20_4 0.832 0.055 15.193 0.000 0.538 0.682
## Q20_5 0.897 0.062 14.573 0.000 0.581 0.658
## Q20_6 0.990 0.062 15.892 0.000 0.641 0.710
## Q20_7 1.050 0.061 17.353 0.000 0.680 0.766
## Q20_8 0.708 0.056 12.635 0.000 0.458 0.578
## QT =~
## Q15_4 1.000 0.697 0.634
## Q21 1.084 0.081 13.405 0.000 0.755 0.798
## Q25 1.001 0.074 13.459 0.000 0.697 0.804
## Q29 0.569 0.065 8.749 0.000 0.397 0.463
## Q41_3 0.552 0.069 8.009 0.000 0.384 0.419
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ANXs ~~
## DEPs 0.401 0.036 11.017 0.000 0.811 0.811
## QT 0.371 0.041 9.095 0.000 0.696 0.696
## DEPs ~~
## QT 0.295 0.034 8.626 0.000 0.655 0.655
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q19_1 0.260 0.021 12.224 0.000 0.260 0.308
## .Q19_2 0.307 0.023 13.484 0.000 0.307 0.421
## .Q19_3 0.207 0.018 11.448 0.000 0.207 0.264
## .Q19_4 0.284 0.022 12.865 0.000 0.284 0.357
## .Q19_5 0.438 0.031 13.990 0.000 0.438 0.495
## .Q20_1 0.292 0.022 13.322 0.000 0.292 0.410
## .Q20_2 0.246 0.020 12.394 0.000 0.246 0.326
## .Q20_3 0.444 0.032 14.071 0.000 0.444 0.519
## .Q20_4 0.332 0.023 14.155 0.000 0.332 0.534
## .Q20_5 0.442 0.031 14.315 0.000 0.442 0.567
## .Q20_6 0.404 0.029 13.942 0.000 0.404 0.496
## .Q20_7 0.325 0.024 13.346 0.000 0.325 0.413
## .Q20_8 0.417 0.028 14.695 0.000 0.417 0.665
## .Q15_4 0.721 0.053 13.545 0.000 0.721 0.598
## .Q21 0.325 0.031 10.361 0.000 0.325 0.363
## .Q25 0.266 0.026 10.151 0.000 0.266 0.354
## .Q29 0.577 0.039 14.677 0.000 0.577 0.786
## .Q41_3 0.693 0.047 14.842 0.000 0.693 0.824
## ANXs 0.585 0.054 10.887 0.000 1.000 1.000
## DEPs 0.419 0.043 9.646 0.000 1.000 1.000
## QT 0.485 0.068 7.173 0.000 1.000 1.000
##
## R-Square:
## Estimate
## Q19_1 0.692
## Q19_2 0.579
## Q19_3 0.736
## Q19_4 0.643
## Q19_5 0.505
## Q20_1 0.590
## Q20_2 0.674
## Q20_3 0.481
## Q20_4 0.466
## Q20_5 0.433
## Q20_6 0.504
## Q20_7 0.587
## Q20_8 0.335
## Q15_4 0.402
## Q21 0.637
## Q25 0.646
## Q29 0.214
## Q41_3 0.176
threefit<- standardizedsolution(fitthree, type = "std.all")
threefit
## lhs op rhs est.std se z pvalue ci.lower ci.upper
## 1 ANXs =~ Q19_1 0.832 0.017 49.294 0 0.799 0.865
## 2 ANXs =~ Q19_2 0.761 0.022 35.016 0 0.718 0.803
## 3 ANXs =~ Q19_3 0.858 0.015 56.847 0 0.828 0.887
## 4 ANXs =~ Q19_4 0.802 0.019 42.383 0 0.765 0.839
## 5 ANXs =~ Q19_5 0.711 0.025 28.444 0 0.662 0.760
## 6 DEPs =~ Q20_1 0.768 0.021 35.942 0 0.726 0.810
## 7 DEPs =~ Q20_2 0.821 0.018 46.247 0 0.786 0.856
## 8 DEPs =~ Q20_3 0.694 0.026 26.543 0 0.643 0.745
## 9 DEPs =~ Q20_4 0.682 0.027 25.421 0 0.630 0.735
## 10 DEPs =~ Q20_5 0.658 0.028 23.218 0 0.602 0.713
## 11 DEPs =~ Q20_6 0.710 0.025 28.237 0 0.661 0.759
## 12 DEPs =~ Q20_7 0.766 0.021 35.652 0 0.724 0.808
## 13 DEPs =~ Q20_8 0.578 0.033 17.662 0 0.514 0.643
## 14 QT =~ Q15_4 0.634 0.032 19.789 0 0.572 0.697
## 15 QT =~ Q21 0.798 0.023 34.265 0 0.752 0.844
## 16 QT =~ Q25 0.804 0.023 34.974 0 0.759 0.849
## 17 QT =~ Q29 0.463 0.040 11.513 0 0.384 0.541
## 18 QT =~ Q41_3 0.419 0.042 10.004 0 0.337 0.501
## 19 Q19_1 ~~ Q19_1 0.308 0.028 10.973 0 0.253 0.363
## 20 Q19_2 ~~ Q19_2 0.421 0.033 12.739 0 0.356 0.486
## 21 Q19_3 ~~ Q19_3 0.264 0.026 10.200 0 0.213 0.315
## 22 Q19_4 ~~ Q19_4 0.357 0.030 11.747 0 0.297 0.416
## 23 Q19_5 ~~ Q19_5 0.495 0.036 13.931 0 0.425 0.564
## 24 Q20_1 ~~ Q20_1 0.410 0.033 12.513 0 0.346 0.475
## 25 Q20_2 ~~ Q20_2 0.326 0.029 11.202 0 0.269 0.383
## 26 Q20_3 ~~ Q20_3 0.519 0.036 14.293 0 0.447 0.590
## 27 Q20_4 ~~ Q20_4 0.534 0.037 14.582 0 0.462 0.606
## 28 Q20_5 ~~ Q20_5 0.567 0.037 15.226 0 0.494 0.640
## 29 Q20_6 ~~ Q20_6 0.496 0.036 13.898 0 0.426 0.566
## 30 Q20_7 ~~ Q20_7 0.413 0.033 12.556 0 0.349 0.478
## 31 Q20_8 ~~ Q20_8 0.665 0.038 17.568 0 0.591 0.740
## 32 Q15_4 ~~ Q15_4 0.598 0.041 14.696 0 0.518 0.677
## 33 Q21 ~~ Q21 0.363 0.037 9.776 0 0.290 0.436
## 34 Q25 ~~ Q25 0.354 0.037 9.563 0 0.281 0.426
## 35 Q29 ~~ Q29 0.786 0.037 21.131 0 0.713 0.859
## 36 Q41_3 ~~ Q41_3 0.824 0.035 23.482 0 0.756 0.893
## 37 ANXs ~~ ANXs 1.000 0.000 NA NA 1.000 1.000
## 38 DEPs ~~ DEPs 1.000 0.000 NA NA 1.000 1.000
## 39 QT ~~ QT 1.000 0.000 NA NA 1.000 1.000
## 40 ANXs ~~ DEPs 0.811 0.021 38.191 0 0.769 0.852
## 41 ANXs ~~ QT 0.696 0.032 22.086 0 0.634 0.758
## 42 DEPs ~~ QT 0.655 0.034 19.238 0 0.588 0.721
write.csv(threefit, "threefactmodel.csv")
semPaths(fitthree, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

teacher2<- teacher2%>%
mutate(gender2 = case_when(gender == "Female" ~ 1,
gender == "Male" ~ 0))
mentalSEM<-
'
ANXs=~ Q19_1 + Q19_2 + Q19_3 + Q19_4 + Q19_5
DEPs=~ Q20_1 + Q20_2 + Q20_3 + Q20_4 + Q20_5 + Q20_6 + Q20_7 + Q20_8
QT=~ Q15_4 + Q21 + Q25 + Q29 + Q41_3
GEN=~ gender2
DEPs~a*GEN
GEN~b*QT
DEPs~c*QT
ANXs~d*GEN
ANXs~e*QT
Depmed:= a*b
Deptot:= c + (a*b)
Anxmed:= d*b
Anxtot:= e + (d*b)
'
fithealth<- sem(mentalSEM, data=teacher2, ordered = "GEN")
summary(fithealth, fit.measures=TRUE, standardized = TRUE, rsquare = T)
## lavaan 0.6-12 ended normally after 43 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 62
##
## Used Total
## Number of observations 468 680
##
## Model Test User Model:
## Standard Robust
## Test Statistic 112.391 283.596
## Degrees of freedom 147 147
## P-value (Chi-square) 0.985 0.000
## Scaling correction factor 0.474
## Shift parameter 46.308
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 11201.804 2734.586
## Degrees of freedom 171 171
## P-value 0.000 0.000
## Scaling correction factor 4.303
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000 0.947
## Tucker-Lewis Index (TLI) 1.004 0.938
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000 0.045
## 90 Percent confidence interval - lower 0.000 0.037
## 90 Percent confidence interval - upper 0.000 0.052
## P-value RMSEA <= 0.05 1.000 0.870
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.037 0.037
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ANXs =~
## Q19_1 1.000 0.777 0.844
## Q19_2 0.799 0.049 16.150 0.000 0.621 0.726
## Q19_3 0.957 0.045 21.421 0.000 0.744 0.835
## Q19_4 0.935 0.051 18.421 0.000 0.727 0.812
## Q19_5 0.881 0.053 16.763 0.000 0.685 0.726
## DEPs =~
## Q20_1 1.000 0.615 0.728
## Q20_2 1.156 0.052 22.177 0.000 0.711 0.816
## Q20_3 1.061 0.070 15.057 0.000 0.652 0.707
## Q20_4 0.881 0.061 14.406 0.000 0.542 0.688
## Q20_5 0.955 0.063 15.251 0.000 0.587 0.663
## Q20_6 1.057 0.064 16.566 0.000 0.650 0.717
## Q20_7 1.129 0.062 18.072 0.000 0.694 0.777
## Q20_8 0.730 0.058 12.638 0.000 0.449 0.565
## QT =~
## Q15_4 1.000 0.656 0.596
## Q21 1.229 0.121 10.191 0.000 0.806 0.847
## Q25 1.013 0.089 11.444 0.000 0.664 0.769
## Q29 0.580 0.079 7.346 0.000 0.380 0.442
## Q41_3 0.673 0.082 8.159 0.000 0.441 0.481
## GEN =~
## gender2 1.000 0.428 1.000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## DEPs ~
## GEN (a) 0.079 0.060 1.322 0.186 0.055 0.055
## GEN ~
## QT (b) 0.061 0.034 1.817 0.069 0.093 0.093
## DEPs ~
## QT (c) 0.610 0.063 9.632 0.000 0.651 0.651
## ANXs ~
## GEN (d) 0.271 0.076 3.553 0.000 0.149 0.149
## QT (e) 0.818 0.081 10.059 0.000 0.690 0.690
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ANXs ~~
## .DEPs 0.168 0.023 7.344 0.000 0.671 0.671
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q19_1 2.812 0.043 66.106 0.000 2.812 3.056
## .Q19_2 3.143 0.040 79.526 0.000 3.143 3.676
## .Q19_3 2.921 0.041 70.984 0.000 2.921 3.281
## .Q19_4 2.844 0.041 68.786 0.000 2.844 3.180
## .Q19_5 2.415 0.044 55.371 0.000 2.415 2.560
## .Q20_1 2.368 0.039 60.673 0.000 2.368 2.805
## .Q20_2 2.288 0.040 56.858 0.000 2.288 2.628
## .Q20_3 2.791 0.043 65.437 0.000 2.791 3.025
## .Q20_4 2.994 0.036 82.326 0.000 2.994 3.806
## .Q20_5 2.665 0.041 65.083 0.000 2.665 3.008
## .Q20_6 2.252 0.042 53.712 0.000 2.252 2.483
## .Q20_7 2.519 0.041 60.995 0.000 2.519 2.820
## .Q20_8 1.840 0.037 50.077 0.000 1.840 2.315
## .Q15_4 2.865 0.051 56.380 0.000 2.865 2.606
## .Q21 2.701 0.044 61.456 0.000 2.701 2.841
## .Q25 2.921 0.040 73.193 0.000 2.921 3.383
## .Q29 2.558 0.040 64.334 0.000 2.558 2.974
## .Q41_3 2.568 0.042 60.583 0.000 2.568 2.800
## .gender2 0.759 0.020 38.303 0.000 0.759 1.771
## .ANXs 0.000 0.000 0.000
## .DEPs 0.000 0.000 0.000
## QT 0.000 0.000 0.000
## .GEN 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Q19_1 0.243 0.033 7.413 0.000 0.243 0.287
## .Q19_2 0.346 0.033 10.612 0.000 0.346 0.473
## .Q19_3 0.239 0.023 10.241 0.000 0.239 0.302
## .Q19_4 0.272 0.030 9.085 0.000 0.272 0.340
## .Q19_5 0.421 0.033 12.629 0.000 0.421 0.473
## .Q20_1 0.335 0.027 12.508 0.000 0.335 0.469
## .Q20_2 0.253 0.024 10.381 0.000 0.253 0.334
## .Q20_3 0.426 0.032 13.115 0.000 0.426 0.500
## .Q20_4 0.325 0.028 11.637 0.000 0.325 0.526
## .Q20_5 0.440 0.037 11.741 0.000 0.440 0.560
## .Q20_6 0.400 0.035 11.381 0.000 0.400 0.486
## .Q20_7 0.317 0.029 11.028 0.000 0.317 0.397
## .Q20_8 0.430 0.030 14.557 0.000 0.430 0.681
## .Q15_4 0.779 0.066 11.766 0.000 0.779 0.644
## .Q21 0.255 0.066 3.877 0.000 0.255 0.282
## .Q25 0.304 0.039 7.852 0.000 0.304 0.408
## .Q29 0.595 0.040 14.727 0.000 0.595 0.805
## .Q41_3 0.646 0.045 14.282 0.000 0.646 0.769
## .gender2 0.000 0.000 0.000
## .ANXs 0.291 0.037 7.946 0.000 0.482 0.482
## .DEPs 0.214 0.026 8.206 0.000 0.567 0.567
## QT 0.430 0.069 6.235 0.000 1.000 1.000
## .GEN 0.182 0.010 17.826 0.000 0.991 0.991
##
## R-Square:
## Estimate
## Q19_1 0.713
## Q19_2 0.527
## Q19_3 0.698
## Q19_4 0.660
## Q19_5 0.527
## Q20_1 0.531
## Q20_2 0.666
## Q20_3 0.500
## Q20_4 0.474
## Q20_5 0.440
## Q20_6 0.514
## Q20_7 0.603
## Q20_8 0.319
## Q15_4 0.356
## Q21 0.718
## Q25 0.592
## Q29 0.195
## Q41_3 0.231
## gender2 1.000
## ANXs 0.518
## DEPs 0.433
## GEN 0.009
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depmed 0.005 0.004 1.143 0.253 0.005 0.005
## Deptot 0.615 0.064 9.675 0.000 0.656 0.656
## Anxmed 0.016 0.009 1.743 0.081 0.014 0.014
## Anxtot 0.834 0.083 10.051 0.000 0.704 0.704
semfit<- standardizedsolution(fithealth, type = "std.all")
write.csv(semfit, "anxSEMModel.csv")
semfit
## lhs op rhs label est.std se z pvalue ci.lower ci.upper
## 1 ANXs =~ Q19_1 0.844 0.023 36.016 0.000 0.798 0.890
## 2 ANXs =~ Q19_2 0.726 0.031 23.176 0.000 0.665 0.788
## 3 ANXs =~ Q19_3 0.835 0.019 42.926 0.000 0.797 0.874
## 4 ANXs =~ Q19_4 0.812 0.024 33.638 0.000 0.765 0.860
## 5 ANXs =~ Q19_5 0.726 0.027 26.462 0.000 0.672 0.780
## 6 DEPs =~ Q20_1 0.728 0.027 26.714 0.000 0.675 0.782
## 7 DEPs =~ Q20_2 0.816 0.021 38.940 0.000 0.775 0.857
## 8 DEPs =~ Q20_3 0.707 0.029 23.970 0.000 0.649 0.765
## 9 DEPs =~ Q20_4 0.688 0.033 21.177 0.000 0.625 0.752
## 10 DEPs =~ Q20_5 0.663 0.035 19.016 0.000 0.595 0.731
## 11 DEPs =~ Q20_6 0.717 0.029 24.408 0.000 0.659 0.774
## 12 DEPs =~ Q20_7 0.777 0.024 31.799 0.000 0.729 0.825
## 13 DEPs =~ Q20_8 0.565 0.033 17.070 0.000 0.500 0.630
## 14 QT =~ Q15_4 0.596 0.044 13.691 0.000 0.511 0.682
## 15 QT =~ Q21 0.847 0.042 20.383 0.000 0.766 0.929
## 16 QT =~ Q25 0.769 0.034 22.872 0.000 0.704 0.835
## 17 QT =~ Q29 0.442 0.048 9.187 0.000 0.348 0.536
## 18 QT =~ Q41_3 0.481 0.047 10.143 0.000 0.388 0.574
## 19 GEN =~ gender2 1.000 0.000 NA NA 1.000 1.000
## 20 DEPs ~ GEN a 0.055 0.042 1.323 0.186 -0.027 0.137
## 21 GEN ~ QT b 0.093 0.050 1.849 0.064 -0.006 0.192
## 22 DEPs ~ QT c 0.651 0.036 18.187 0.000 0.581 0.721
## 23 ANXs ~ GEN d 0.149 0.042 3.590 0.000 0.068 0.231
## 24 ANXs ~ QT e 0.690 0.037 18.791 0.000 0.618 0.762
## 25 Q19_1 ~~ Q19_1 0.287 0.040 7.248 0.000 0.209 0.365
## 26 Q19_2 ~~ Q19_2 0.473 0.045 10.391 0.000 0.384 0.562
## 27 Q19_3 ~~ Q19_3 0.302 0.033 9.289 0.000 0.238 0.366
## 28 Q19_4 ~~ Q19_4 0.340 0.039 8.660 0.000 0.263 0.417
## 29 Q19_5 ~~ Q19_5 0.473 0.040 11.880 0.000 0.395 0.551
## 30 Q20_1 ~~ Q20_1 0.469 0.040 11.819 0.000 0.392 0.547
## 31 Q20_2 ~~ Q20_2 0.334 0.034 9.765 0.000 0.267 0.401
## 32 Q20_3 ~~ Q20_3 0.500 0.042 11.987 0.000 0.418 0.582
## 33 Q20_4 ~~ Q20_4 0.526 0.045 11.749 0.000 0.438 0.614
## 34 Q20_5 ~~ Q20_5 0.560 0.046 12.116 0.000 0.470 0.651
## 35 Q20_6 ~~ Q20_6 0.486 0.042 11.557 0.000 0.404 0.569
## 36 Q20_7 ~~ Q20_7 0.397 0.038 10.448 0.000 0.322 0.471
## 37 Q20_8 ~~ Q20_8 0.681 0.037 18.231 0.000 0.608 0.754
## 38 Q15_4 ~~ Q15_4 0.644 0.052 12.407 0.000 0.543 0.746
## 39 Q21 ~~ Q21 0.282 0.070 4.003 0.000 0.144 0.420
## 40 Q25 ~~ Q25 0.408 0.052 7.880 0.000 0.306 0.509
## 41 Q29 ~~ Q29 0.805 0.042 18.942 0.000 0.722 0.888
## 42 Q41_3 ~~ Q41_3 0.769 0.046 16.844 0.000 0.679 0.858
## 43 gender2 ~~ gender2 0.000 0.000 NA NA 0.000 0.000
## 44 ANXs ~~ ANXs 0.482 0.051 9.503 0.000 0.383 0.582
## 45 DEPs ~~ DEPs 0.567 0.047 12.092 0.000 0.475 0.658
## 46 QT ~~ QT 1.000 0.000 NA NA 1.000 1.000
## 47 GEN ~~ GEN 0.991 0.009 105.602 0.000 0.973 1.010
## 48 ANXs ~~ DEPs 0.671 0.043 15.680 0.000 0.587 0.755
## 49 Q19_1 ~1 3.056 0.102 30.091 0.000 2.857 3.255
## 50 Q19_2 ~1 3.676 0.150 24.462 0.000 3.382 3.971
## 51 Q19_3 ~1 3.281 0.120 27.343 0.000 3.046 3.516
## 52 Q19_4 ~1 3.180 0.109 29.261 0.000 2.967 3.393
## 53 Q19_5 ~1 2.560 0.072 35.684 0.000 2.419 2.700
## 54 Q20_1 ~1 2.805 0.085 32.859 0.000 2.637 2.972
## 55 Q20_2 ~1 2.628 0.078 33.529 0.000 2.475 2.782
## 56 Q20_3 ~1 3.025 0.104 29.072 0.000 2.821 3.229
## 57 Q20_4 ~1 3.806 0.158 24.066 0.000 3.496 4.115
## 58 Q20_5 ~1 3.008 0.099 30.367 0.000 2.814 3.203
## 59 Q20_6 ~1 2.483 0.070 35.468 0.000 2.346 2.620
## 60 Q20_7 ~1 2.820 0.088 31.914 0.000 2.646 2.993
## 61 Q20_8 ~1 2.315 0.070 33.214 0.000 2.178 2.451
## 62 Q15_4 ~1 2.606 0.093 28.171 0.000 2.425 2.787
## 63 Q21 ~1 2.841 0.098 29.131 0.000 2.650 3.032
## 64 Q25 ~1 3.383 0.123 27.537 0.000 3.143 3.624
## 65 Q29 ~1 2.974 0.096 31.111 0.000 2.787 3.161
## 66 Q41_3 ~1 2.800 0.080 35.139 0.000 2.644 2.957
## 67 gender2 ~1 1.771 0.096 18.517 0.000 1.583 1.958
## 68 ANXs ~1 0.000 0.000 NA NA 0.000 0.000
## 69 DEPs ~1 0.000 0.000 NA NA 0.000 0.000
## 70 QT ~1 0.000 0.000 NA NA 0.000 0.000
## 71 GEN ~1 0.000 0.000 NA NA 0.000 0.000
## 72 Depmed := a*b Depmed 0.005 0.004 1.146 0.252 -0.004 0.014
## 73 Deptot := c+(a*b) Deptot 0.656 0.036 18.400 0.000 0.586 0.726
## 74 Anxmed := d*b Anxmed 0.014 0.008 1.783 0.075 -0.001 0.029
## 75 Anxtot := e+(d*b) Anxtot 0.704 0.037 19.251 0.000 0.632 0.776
semPaths(fithealth, whatLabels = "std.all", structural = FALSE, edge.label.cex = .8, node.label.cex = .8,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = TRUE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = TRUE)

semPaths(fithealth,
whatLabels = "std.all", structural = TRUE, edge.label.cex = 1, node.label.cex = 1.5,
label.prop=0.9, edge.label.color = "black", rotation = 2,
equalizeManifests = FALSE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c", title = FALSE, intercepts = FALSE, residuals = FALSE)

ANXAlpha<- dplyr:: select(teacher2, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5)
DEPAlpha2<- dplyr:: select(teacher2, Q20_1, Q20_2, Q20_3, Q20_4, Q20_5, Q20_7, Q20_8)
LeaveAlpha<-dplyr::select(teacher2, Q15_4, Q21, Q25, Q29, Q41_3)
totalAlpha2<- dplyr:: select(teacher2, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5,
Q20_1, Q20_2, Q20_3, Q20_4, Q20_5, Q20_7, Q20_8,
Q15_4, Q21, Q25, Q29, Q41_3)
bannerCommenter::banner("Anxiety Alpha and Omega")
##
## #################################################################
## ## Anxiety Alpha and Omega ##
## #################################################################
omega(ANXAlpha)

## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.89
## G.6: 0.87
## Omega Hierarchical: 0.87
## Omega H asymptotic: 0.96
## Omega Total 0.91
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## Q19_1 0.85 0.74 0.26 0.98
## Q19_2 0.79 0.20 0.65 0.35 0.95
## Q19_3 0.83 0.35 0.82 0.18 0.84
## Q19_4 0.74 0.30 0.64 0.36 0.85
## Q19_5 0.67 0.51 0.49 0.90
##
## With Sums of squares of:
## g F1* F2* F3*
## 3.03 0.00 0.23 0.10
##
## general/max 13.21 max/min = 118.19
## mean percent general = 0.9 with sd = 0.06 and cv of 0.07
## Explained Common Variance of the general factor = 0.9
##
## The degrees of freedom are -2 and the fit is 0
## The number of observations was 680 with Chi Square = 0 with prob < NA
## The root mean square of the residuals is 0
## The df corrected root mean square of the residuals is NA
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5 and the fit is 0.07
## The number of observations was 680 with Chi Square = 47.05 with prob < 5.5e-09
## The root mean square of the residuals is 0.04
## The df corrected root mean square of the residuals is 0.06
##
## RMSEA index = 0.111 and the 10 % confidence intervals are 0.084 0.141
## BIC = 14.44
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.94 0.05 0.56 0.46
## Multiple R square of scores with factors 0.88 0.00 0.31 0.21
## Minimum correlation of factor score estimates 0.77 -0.99 -0.38 -0.58
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.91 NA 0.84 0.82
## Omega general for total scores and subscales 0.87 NA 0.72 0.82
## Omega group for total scores and subscales 0.02 NA 0.12 0.00
bannerCommenter::banner("Depression Alpha and Omega")
##
## ##################################################################
## ## Depression Alpha and Omega ##
## ##################################################################
omega(DEPAlpha2)

## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.88
## G.6: 0.88
## Omega Hierarchical: 0.76
## Omega H asymptotic: 0.83
## Omega Total 0.92
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## Q20_1 0.72 0.21 0.21 0.62 0.38 0.85
## Q20_2 0.86 0.50 1.00 0.00 0.75
## Q20_3 0.63 0.36 0.54 0.46 0.74
## Q20_4 0.62 0.52 0.65 0.35 0.58
## Q20_5 0.59 0.40 0.51 0.49 0.67
## Q20_7 0.68 0.22 0.25 0.58 0.42 0.79
## Q20_8 0.58 0.60 0.70 0.30 0.48
##
## With Sums of squares of:
## g F1* F2* F3*
## 3.18 0.65 0.30 0.45
##
## general/max 4.87 max/min = 2.19
## mean percent general = 0.69 with sd = 0.13 and cv of 0.18
## Explained Common Variance of the general factor = 0.69
##
## The degrees of freedom are 3 and the fit is 0.01
## The number of observations was 680 with Chi Square = 4.18 with prob < 0.24
## The root mean square of the residuals is 0.01
## The df corrected root mean square of the residuals is 0.02
## RMSEA index = 0.024 and the 10 % confidence intervals are 0 0.073
## BIC = -15.39
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 14 and the fit is 0.32
## The number of observations was 680 with Chi Square = 219.01 with prob < 7e-39
## The root mean square of the residuals is 0.1
## The df corrected root mean square of the residuals is 0.12
##
## RMSEA index = 0.147 and the 10 % confidence intervals are 0.13 0.164
## BIC = 127.7
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.91 0.70 0.68 0.72
## Multiple R square of scores with factors 0.83 0.49 0.46 0.52
## Minimum correlation of factor score estimates 0.65 -0.01 -0.07 0.04
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.92 0.79 0.87 0.75
## Omega general for total scores and subscales 0.76 0.53 0.73 0.51
## Omega group for total scores and subscales 0.10 0.26 0.14 0.24
bannerCommenter::banner("Quitting")
##
## ##################################################################
## ## Quitting ##
## ##################################################################
omega(LeaveAlpha)

## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.75
## G.6: 0.73
## Omega Hierarchical: 0.74
## Omega H asymptotic: 0.94
## Omega Total 0.79
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## Q15_4 0.66 0.20 0.49 0.51 0.90
## Q21 0.72 0.54 0.46 0.98
## Q25 0.87 0.77 0.23 0.99
## Q29 0.45 0.34 0.32 0.68 0.64
## Q41_3 0.36 0.35 0.28 0.72 0.46
##
## With Sums of squares of:
## g F1* F2* F3*
## 2.05 0.00 0.20 0.15
##
## general/max 10.42 max/min = Inf
## mean percent general = 0.79 with sd = 0.23 and cv of 0.3
## Explained Common Variance of the general factor = 0.85
##
## The degrees of freedom are -2 and the fit is 0
## The number of observations was 680 with Chi Square = 0 with prob < NA
## The root mean square of the residuals is 0
## The df corrected root mean square of the residuals is NA
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5 and the fit is 0.03
## The number of observations was 680 with Chi Square = 23.11 with prob < 0.00032
## The root mean square of the residuals is 0.04
## The df corrected root mean square of the residuals is 0.05
##
## RMSEA index = 0.073 and the 10 % confidence intervals are 0.045 0.104
## BIC = -9.5
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.92 0 0.52 0.41
## Multiple R square of scores with factors 0.85 0 0.27 0.16
## Minimum correlation of factor score estimates 0.71 -1 -0.45 -0.67
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.79 NA 0.78 0.32
## Omega general for total scores and subscales 0.74 NA 0.75 0.20
## Omega group for total scores and subscales 0.03 NA 0.03 0.11
bannerCommenter::banner("Total")
##
## #################################################################
## ## Total ##
## #################################################################
omega(totalAlpha2)

## Omega
## Call: omegah(m = m, nfactors = nfactors, fm = fm, key = key, flip = flip,
## digits = digits, title = title, sl = sl, labels = labels,
## plot = plot, n.obs = n.obs, rotate = rotate, Phi = Phi, option = option,
## covar = covar)
## Alpha: 0.92
## G.6: 0.93
## Omega Hierarchical: 0.78
## Omega H asymptotic: 0.83
## Omega Total 0.94
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* h2 u2 p2
## Q19_1 0.72 0.36 0.67 0.33 0.78
## Q19_2 0.65 0.44 0.62 0.38 0.68
## Q19_3 0.74 0.48 0.78 0.22 0.71
## Q19_4 0.71 0.33 0.62 0.38 0.80
## Q19_5 0.63 0.26 0.48 0.52 0.82
## Q20_1 0.65 0.49 0.68 0.32 0.63
## Q20_2 0.72 0.41 0.69 0.31 0.75
## Q20_3 0.64 0.30 0.53 0.47 0.77
## Q20_4 0.62 0.30 0.48 0.52 0.79
## Q20_5 0.57 0.33 0.44 0.56 0.75
## Q20_7 0.67 0.36 0.58 0.42 0.76
## Q20_8 0.50 0.33 0.35 0.65 0.69
## Q15_4 0.44 0.52 0.46 0.54 0.41
## Q21 0.62 0.44 0.59 0.41 0.65
## Q25 0.54 0.60 0.66 0.34 0.45
## Q29 0.31 0.37 0.24 0.76 0.39
## Q41_3 0.32 0.25 0.17 0.83 0.61
##
## With Sums of squares of:
## g F1* F2* F3*
## 6.21 0.99 0.81 1.04
##
## general/max 5.96 max/min = 1.28
## mean percent general = 0.67 with sd = 0.14 and cv of 0.2
## Explained Common Variance of the general factor = 0.69
##
## The degrees of freedom are 88 and the fit is 0.41
## The number of observations was 680 with Chi Square = 277.33 with prob < 1.8e-21
## The root mean square of the residuals is 0.03
## The df corrected root mean square of the residuals is 0.03
## RMSEA index = 0.056 and the 10 % confidence intervals are 0.049 0.064
## BIC = -296.61
##
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 119 and the fit is 1.77
## The number of observations was 680 with Chi Square = 1187.05 with prob < 1.9e-175
## The root mean square of the residuals is 0.1
## The df corrected root mean square of the residuals is 0.1
##
## RMSEA index = 0.115 and the 10 % confidence intervals are 0.109 0.121
## BIC = 410.92
##
## Measures of factor score adequacy
## g F1* F2* F3*
## Correlation of scores with factors 0.89 0.68 0.67 0.78
## Multiple R square of scores with factors 0.80 0.46 0.44 0.61
## Minimum correlation of factor score estimates 0.60 -0.08 -0.11 0.21
##
## Total, General and Subset omega for each subset
## g F1* F2* F3*
## Omega total for total scores and subscales 0.94 0.88 0.89 0.77
## Omega general for total scores and subscales 0.78 0.66 0.68 0.39
## Omega group for total scores and subscales 0.11 0.22 0.20 0.37
library(diagram)
dataplot3 <- c(0, "'.15'", 0,
0, 0, 0,
"'.09'", "'.69*+(.01)=[.70*]'", 0)
M<- matrix (nrow=3, ncol=3, byrow = TRUE, data=dataplot3)
plot<- plotmat (M, pos=c(1,2),
name= c( "Gender","Anxiety", "Desire to Quit"),
box.type = "rect", box.size = 0.12, box.prop=0.5, curve=0)

library(diagram)
dataplot3 <- c(0, "'.06'", 0,
0, 0, 0,
"'.09'", "'.65*+(.01)=[.66*]'", 0)
M<- matrix (nrow=3, ncol=3, byrow = TRUE, data=dataplot3)
plot<- plotmat (M, pos=c(1,2),
name= c( "Gender","Depression", "Desire to Quit"),
box.type = "rect", box.size = 0.12, box.prop=0.5, curve=0)

matrix<- dplyr::select(teacher2, Anx, Dep, Leave)
matrix2<-na.omit(matrix)
apa.cor.table(matrix, filename = "correlation.doc")
##
##
## Means, standard deviations, and correlations with confidence intervals
##
##
## Variable M SD 1 2
## 1. Anx 14.13 3.72
##
## 2. Dep 19.70 5.29 .74**
## [.71, .78]
##
## 3. Leave 13.62 3.35 .58** .53**
## [.51, .63] [.47, .59]
##
##
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
##
#Anxiety and Gender
anxgender<-lm(Anx ~ gender, data = teacher2)
apa.aov.table(anxgender,"anxgenderanova.doc")
##
##
## ANOVA results using Anx as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 97478.69 1 97478.69 7352.12 .000
## gender 351.61 1 351.61 26.52 .000 .04 [.02, .07]
## Error 8008.18 604 13.26
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Anx~gender)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Anx Female Male 0.477 503 156 small
GenAnx<- na.omit(dplyr::select(teacher2, ResponseId, Anx, gender))
GenAnx<- GenAnx %>%
group_by(gender) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Anx),
SD = sd(Anx, .75))
#Anxiety and Grade Level
anxgrade<-lm(Anx ~ Level, data = teacher2)
apa.aov.table(anxgrade,"anxlevelanova.doc")
##
##
## ANOVA results using Anx as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 54484.68 1 54484.68 3990.84 .000
## Level 189.80 4 47.45 3.48 .008 .02 [.00, .04]
## Error 8382.60 614 13.65
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Anx~Level)
## # A tibble: 10 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Anx Elementary High_School 0.365 277 166 small
## 2 Anx Elementary Middle_School 0.0897 277 173 negligible
## 3 Anx Elementary Other -0.0418 277 34 negligible
## 4 Anx Elementary Pre_K 0.102 277 25 negligible
## 5 Anx High_School Middle_School -0.265 166 173 small
## 6 Anx High_School Other -0.420 166 34 small
## 7 Anx High_School Pre_K -0.298 166 25 small
## 8 Anx Middle_School Other -0.133 173 34 negligible
## 9 Anx Middle_School Pre_K 0.000748 173 25 negligible
## 10 Anx Other Pre_K 0.152 34 25 negligible
ANXLevel<- na.omit(dplyr::select(teacher2, ResponseId, Anx, Level))
ANXLevel<- ANXLevel %>%
group_by(Level) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Anx),
SD = sd(Anx, .75))
#Anxiety and Content
anxcont<-lm(Anx ~ Cont1, data = teacher2)
apa.aov.table(anxcont,"anxcontanova.doc")
##
##
## ANOVA results using Anx as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 17718.57 1 17718.57 1329.87 .000
## Cont1 388.64 7 55.52 4.17 .000 .05 [.01, .07]
## Error 8047.42 604 13.32
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Anx~Cont1)
## # A tibble: 28 x 7
## .y. group1 group2 effsize n1 n2 magni~1
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Anx Elective English Language Ar~ -0.118 87 70 neglig~
## 2 Anx Elective General Elementary 0.00932 87 195 neglig~
## 3 Anx Elective Math 0.430 87 83 small
## 4 Anx Elective Other 0.485 87 47 small
## 5 Anx Elective Science 0.544 87 42 modera~
## 6 Anx Elective Social Studies 0.468 87 53 small
## 7 Anx Elective Special Education 0.270 87 89 small
## 8 Anx English Language Arts General Elementary 0.121 70 195 neglig~
## 9 Anx English Language Arts Math 0.528 70 83 modera~
## 10 Anx English Language Arts Other 0.582 70 47 modera~
## # ... with 18 more rows, and abbreviated variable name 1: magnitude
ContAnx<- na.omit(dplyr::select(teacher2, ResponseId, Anx, Cont1))
ContAnx<- ContAnx %>%
group_by(Cont1) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Anx),
SD = sd(Anx, .75))
GenAnx<- as.data.frame(GenAnx)%>%
rename(category = gender)
ANXLevel<- as.data.frame(ANXLevel)%>%
rename(category = Level)
ContAnx<- as.data.frame(ContAnx)%>%
rename(category = Cont1)
anovameansanxiety<- rbind(GenAnx, ANXLevel, ContAnx)
anovameansanxiety
## category n Avg SD
## 1 Female 459 14.57298 3.564228
## 2 Male 147 12.79592 3.872875
## 3 Elementary 257 14.56031 3.692960
## 4 High_School 158 13.22152 3.633923
## 5 Middle_School 150 14.22000 3.894360
## 6 Other 31 14.70968 3.446675
## 7 Pre_K 23 14.21739 3.029499
## 8 Elective 81 14.79012 3.235414
## 9 English Language Arts 61 15.18033 3.398569
## 10 General Elementary 182 14.75824 3.593551
## 11 Math 79 13.24051 3.932818
## 12 Other 43 13.04651 3.915497
## 13 Science 40 13.05000 3.161872
## 14 Social Studies 49 13.16327 3.704428
## 15 Special Education 77 13.79221 4.104996
#Depression and Gender
Depgender<-lm(Dep ~ gender, data = teacher2)
apa.aov.table(Depgender,"Depgenderanova.doc")
##
##
## ANOVA results using Dep as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2
## (Intercept) 182721.73 1 182721.73 6640.82 .000
## gender 217.01 1 217.01 7.89 .005 .01
## Error 16398.91 596 27.51
## CI_90_partial_eta2
##
## [.00, .03]
##
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Dep~gender)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Dep Female Male 0.267 503 156 small
GenDep<- na.omit(dplyr::select(teacher2, ResponseId, Dep, gender))
GenDep<- GenDep %>%
group_by(gender) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Dep),
SD = sd(Dep, .75))
#Depression and Grade Level
Depgrade<-lm(Dep ~ Level, data = teacher2)
apa.aov.table(Depgrade,"Deplevelanova.doc")
##
##
## ANOVA results using Dep as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2
## (Intercept) 103807.94 1 103807.94 3734.41 .000
## Level 238.73 4 59.68 2.15 .074 .01
## Error 16845.42 606 27.80
## CI_90_partial_eta2
##
## [.00, .03]
##
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Dep~Level)
## # A tibble: 10 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Dep Elementary High_School 0.286 277 166 small
## 2 Dep Elementary Middle_School 0.0450 277 173 negligible
## 3 Dep Elementary Other 0.0716 277 34 negligible
## 4 Dep Elementary Pre_K 0.0356 277 25 negligible
## 5 Dep High_School Middle_School -0.241 166 173 small
## 6 Dep High_School Other -0.220 166 34 small
## 7 Dep High_School Pre_K -0.267 166 25 small
## 8 Dep Middle_School Other 0.0256 173 34 negligible
## 9 Dep Middle_School Pre_K -0.0122 173 25 negligible
## 10 Dep Other Pre_K -0.0397 34 25 negligible
DEPLevel<- na.omit(dplyr::select(teacher2, ResponseId, Dep, Level))
DEPLevel<- DEPLevel %>%
group_by(Level) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Dep),
SD = sd(Dep, .75))
#Depression and Content
Depcont<-lm(Dep ~ Cont1, data = teacher2)
apa.aov.table(Depcont,"Depcontanova.doc")
##
##
## ANOVA results using Dep as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 35028.45 1 35028.45 1277.41 .000
## Cont1 445.53 7 63.65 2.32 .024 .03 [.00, .04]
## Error 16343.23 596 27.42
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Dep~Cont1)
## # A tibble: 28 x 7
## .y. group1 group2 effsize n1 n2 magni~1
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Dep Elective English Language Arts 0.0847 87 70 neglig~
## 2 Dep Elective General Elementary 0.162 87 195 neglig~
## 3 Dep Elective Math 0.379 87 83 small
## 4 Dep Elective Other 0.523 87 47 modera~
## 5 Dep Elective Science 0.510 87 42 modera~
## 6 Dep Elective Social Studies 0.378 87 53 small
## 7 Dep Elective Special Education 0.230 87 89 small
## 8 Dep English Language Arts General Elementary 0.0843 70 195 neglig~
## 9 Dep English Language Arts Math 0.312 70 83 small
## 10 Dep English Language Arts Other 0.464 70 47 small
## # ... with 18 more rows, and abbreviated variable name 1: magnitude
ContDep<- na.omit(dplyr::select(teacher2, ResponseId, Dep, Cont1))
ContDep<- ContDep %>%
group_by(Cont1) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Dep),
SD = sd(Dep, .75))
GenDep<- as.data.frame(GenDep)%>%
rename(category = gender)
DEPLevel<- as.data.frame(DEPLevel)%>%
rename(category = Level)
ContDep<- as.data.frame(ContDep)%>%
rename(category = Cont1)
anovameansdep<- rbind(GenDep, DEPLevel, ContDep)
write.csv(anovameansdep, "anovameansdep.csv")
anovameansdep
## category n Avg SD
## 1 Female 454 20.06167 5.213811
## 2 Male 144 18.65278 5.344521
## 3 Elementary 255 20.17647 5.244066
## 4 High_School 154 18.64935 5.419081
## 5 Middle_School 148 19.93919 5.290508
## 6 Other 31 19.80645 5.088676
## 7 Pre_K 23 20.00000 4.651490
## 8 Elective 80 20.92500 5.120757
## 9 English Language Arts 59 20.50847 4.702798
## 10 General Elementary 181 20.09392 5.124778
## 11 Math 75 18.90667 5.526773
## 12 Other 43 18.02326 5.946141
## 13 Science 40 18.35000 4.969394
## 14 Social Studies 47 19.08511 4.595980
## 15 Special Education 79 19.67089 5.752862
#leave and Gender
LVgender<-lm(Leave ~ gender, data = teacher2)
apa.aov.table(LVgender,"Leavegenderanova.doc")
##
##
## ANOVA results using Leave as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 68478.63 1 68478.63 6093.94 .000
## gender 35.99 1 35.99 3.20 .074 .01 [.00, .02]
## Error 5326.42 474 11.24
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Leave~gender)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Leave Female Male 0.192 503 156 negligible
LVGen<- na.omit(dplyr::select(teacher2, ResponseId, Leave, gender))
LVGen<- LVGen %>%
group_by(gender) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Leave),
SD = sd(Leave, .75))
#leave and Grade Level
LVgrade<-lm(Leave ~ Level, data = teacher2)
apa.aov.table(LVgrade,"Leavelevelanova.doc")
##
##
## ANOVA results using Leave as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 39761.10 1 39761.10 3591.05 .000
## Level 121.11 4 30.28 2.73 .028 .02 [.00, .04]
## Error 5292.55 478 11.07
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Leave~Level)
## # A tibble: 10 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Leave Elementary High_School 0.303 277 166 small
## 2 Leave Elementary Middle_School 0.0483 277 173 negligible
## 3 Leave Elementary Other 0.350 277 34 small
## 4 Leave Elementary Pre_K -0.284 277 25 small
## 5 Leave High_School Middle_School -0.249 166 173 small
## 6 Leave High_School Other 0.0496 166 34 negligible
## 7 Leave High_School Pre_K -0.620 166 25 moderate
## 8 Leave Middle_School Other 0.295 173 34 small
## 9 Leave Middle_School Pre_K -0.330 173 25 small
## 10 Leave Other Pre_K -0.669 34 25 moderate
LVLevel<- na.omit(dplyr::select(teacher2, ResponseId, Leave, Level))
LVLevel<- LVLevel %>%
group_by(Level) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Leave),
SD = sd(Leave, .75))
#Leave and Content
LVcont<-lm(Leave ~ Cont1, data = teacher2)
apa.aov.table(LVcont,"LVcontanova.doc")
##
##
## ANOVA results using Leave as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 12742.93 1 12742.93 1143.76 .000
## Cont1 159.02 7 22.72 2.04 .049 .03 [.00, .04]
## Error 5225.23 469 11.14
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
cohens_d(teacher2, Leave~Cont1)
## # A tibble: 28 x 7
## .y. group1 group2 effsize n1 n2 magni~1
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 Leave Elective English Language Ar~ 0.0305 87 70 neglig~
## 2 Leave Elective General Elementary -0.158 87 195 neglig~
## 3 Leave Elective Math 0.142 87 83 neglig~
## 4 Leave Elective Other 0.181 87 47 neglig~
## 5 Leave Elective Science 0.478 87 42 small
## 6 Leave Elective Social Studies 0.00212 87 53 neglig~
## 7 Leave Elective Special Education 0.216 87 89 small
## 8 Leave English Language Arts General Elementary -0.191 70 195 neglig~
## 9 Leave English Language Arts Math 0.116 70 83 neglig~
## 10 Leave English Language Arts Other 0.156 70 47 neglig~
## # ... with 18 more rows, and abbreviated variable name 1: magnitude
ContLV<- na.omit(dplyr::select(teacher2, ResponseId, Leave, Cont1))
ContLV<- ContLV %>%
group_by(Cont1) %>%
summarize(
n = n_distinct(ResponseId),
Avg = mean(Leave),
SD = sd(Leave, .75))
LVGen<- as.data.frame(LVGen)%>%
rename(category = gender)
LVLevel<- as.data.frame(LVLevel)%>%
rename(category = Level)
ContLV<- as.data.frame(ContLV)%>%
rename(category = Cont1)
anovameanslv<- rbind(LVGen, LVLevel, ContLV)
write.csv(anovameanslv, "anovameanslv.csv")
anovameanslv
## category n Avg SD
## 1 Female 361 13.77285 3.352186
## 2 Male 115 13.13043 3.352197
## 3 Elementary 205 13.92683 3.334242
## 4 High_School 120 12.92500 3.267262
## 5 Middle_School 118 13.76271 3.460838
## 6 Other 21 12.76190 3.315189
## 7 Pre_K 19 14.78947 2.719864
## 8 Elective 67 13.79104 3.259194
## 9 English Language Arts 49 13.69388 3.110494
## 10 General Elementary 140 14.30714 3.293544
## 11 Math 57 13.29825 3.659454
## 12 Other 33 13.18182 3.459178
## 13 Science 31 12.22581 3.283389
## 14 Social Studies 37 13.78378 3.591155
## 15 Special Education 63 13.09524 3.191290
## Anxiety and Gender
TukeyHSD(aov(Anx~gender, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Anx ~ gender, data = teacher2)
##
## $gender
## diff lwr upr p adj
## Male-Female -1.777066 -2.454769 -1.099364 4e-07
## Anxiety and Level
TukeyHSD(aov(Anx ~ Level, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Anx ~ Level, data = teacher2)
##
## $Level
## diff lwr upr p adj
## High_School-Elementary -1.338792297 -2.3607539 -0.3168307 0.0033475
## Middle_School-Elementary -0.340311284 -1.3790126 0.6983900 0.8982336
## Other-Elementary 0.149366135 -1.7726388 2.0713710 0.9995452
## Pre_K-Elementary -0.342919980 -2.5430796 1.8572396 0.9930958
## Middle_School-High_School 0.998481013 -0.1539285 2.1508905 0.1248514
## Other-High_School 1.488158432 -0.4976034 3.4739203 0.2434066
## Pre_K-High_School 0.995872317 -1.2601972 3.2519418 0.7469556
## Other-Middle_School 0.489677419 -1.5047510 2.4841059 0.9624258
## Pre_K-Middle_School -0.002608696 -2.2663102 2.2610928 1.0000000
## Pre_K-Other -0.492286115 -3.2742902 2.2897180 0.9888043
## Anxiety and Content
TukeyHSD(aov(Anx~Cont1, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Anx ~ Cont1, data = teacher2)
##
## $Cont1
## diff lwr upr
## English Language Arts-Elective 0.390204412 -1.491908 2.27231690
## General Elementary-Elective -0.031881699 -1.514770 1.45100682
## Math-Elective -1.549617128 -3.305165 0.20593111
## Other-Elective -1.743611829 -3.838414 0.35118996
## Science-Elective -1.740123457 -3.885626 0.40537897
## Social Studies-Elective -1.626858151 -3.636136 0.38241952
## Special Education-Elective -0.997915665 -2.764968 0.76913704
## General Elementary-English Language Arts -0.422086111 -2.064609 1.22043650
## Math-English Language Arts -1.939821540 -3.832141 -0.04750239
## Other-English Language Arts -2.133816241 -4.344499 0.07686617
## Science-English Language Arts -2.130327869 -4.389111 0.12845562
## Social Studies-English Language Arts -2.017062563 -4.146879 0.11275408
## Special Education-English Language Arts -1.388120077 -3.291117 0.51487688
## Math-General Elementary -1.517735429 -3.013557 -0.02191368
## Other-General Elementary -1.711730130 -3.594209 0.17074899
## Science-General Elementary -1.708241758 -3.646982 0.23049850
## Social Studies-General Elementary -1.594976452 -3.381798 0.19184471
## Special Education-General Elementary -0.966033966 -2.475341 0.54327328
## Other-Math -0.193994701 -2.297972 1.90998222
## Science-Math -0.190506329 -2.344968 1.96395533
## Social Studies-Math -0.077241023 -2.096083 1.94160051
## Special Education-Math 0.551701463 -1.226219 2.32962149
## Science-Other 0.003488372 -2.435354 2.44233030
## Social Studies-Other 0.116753678 -2.203153 2.43666015
## Special Education-Other 0.745696164 -1.367890 2.85928187
## Social Studies-Science 0.113265306 -2.252523 2.47905316
## Special Education-Science 0.742207792 -1.421638 2.90605406
## Special Education-Social Studies 0.628942486 -1.399911 2.65779604
## p adj
## English Language Arts-Elective 0.9984498
## General Elementary-Elective 1.0000000
## Math-Elective 0.1291958
## Other-Elective 0.1841406
## Science-Elective 0.2117836
## Social Studies-Elective 0.2136716
## Special Education-Elective 0.6757195
## General Elementary-English Language Arts 0.9940142
## Math-English Language Arts 0.0399422
## Other-English Language Arts 0.0674155
## Science-English Language Arts 0.0809055
## Social Studies-English Language Arts 0.0783580
## Special Education-English Language Arts 0.3419234
## Math-General Elementary 0.0438968
## Other-General Elementary 0.1057372
## Science-General Elementary 0.1307133
## Social Studies-General Elementary 0.1200039
## Special Education-General Elementary 0.5191317
## Other-Math 0.9999933
## Science-Math 0.9999950
## Social Studies-Math 1.0000000
## Special Education-Math 0.9815758
## Science-Other 1.0000000
## Social Studies-Other 0.9999999
## Special Education-Other 0.9621620
## Social Studies-Science 0.9999999
## Special Education-Science 0.9675729
## Special Education-Social Studies 0.9816811
## Depression and Gender
TukeyHSD(aov(Dep~gender, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Dep ~ gender, data = teacher2)
##
## $gender
## diff lwr upr p adj
## Male-Female -1.408896 -2.39417 -0.4236229 0.0051426
#Depression and Content
TukeyHSD(aov(Dep~Cont1, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Dep ~ Cont1, data = teacher2)
##
## $Cont1
## diff lwr upr
## English Language Arts-Elective -0.4165254 -3.149916 2.3168653
## General Elementary-Elective -0.8310773 -2.969538 1.3073835
## Math-Elective -2.0183333 -4.578425 0.5417585
## Other-Elective -2.9017442 -5.913631 0.1101427
## Science-Elective -2.5750000 -5.659473 0.5094729
## Social Studies-Elective -1.8398936 -4.767234 1.0874470
## Special Education-Elective -1.2541139 -3.780533 1.2723049
## General Elementary-English Language Arts -0.4145519 -2.802394 1.9732904
## Math-English Language Arts -1.6018079 -4.373603 1.1699869
## Other-English Language Arts -2.4852188 -5.679000 0.7085625
## Science-English Language Arts -2.1584746 -5.420797 1.1038481
## Social Studies-English Language Arts -1.4233682 -4.537545 1.6908090
## Special Education-English Language Arts -0.8375885 -3.578313 1.9031356
## Math-General Elementary -1.1872560 -3.374591 1.0000794
## Other-General Elementary -2.0706668 -4.772856 0.6315228
## Science-General Elementary -1.7439227 -4.526788 1.0389426
## Social Studies-General Elementary -1.0088163 -3.616438 1.5988051
## Special Education-General Elementary -0.4230366 -2.570863 1.7247898
## Other-Math -0.8834109 -3.930193 2.1633718
## Science-Math -0.5566667 -3.675223 2.5618898
## Social Studies-Math 0.1784397 -2.784792 3.1416719
## Special Education-Math 0.7642194 -1.803701 3.3321395
## Science-Other 0.3267442 -3.172225 3.8257136
## Social Studies-Other 1.0618506 -2.299420 4.4231207
## Special Education-Other 1.6476303 -1.370913 4.6661739
## Social Studies-Science 0.7351064 -2.691356 4.1615692
## Special Education-Science 1.3208861 -1.770087 4.4118594
## Special Education-Social Studies 0.5857797 -2.348410 3.5199689
## p adj
## English Language Arts-Elective 0.9997949
## General Elementary-Elective 0.9368821
## Math-Elective 0.2441226
## Other-Elective 0.0684366
## Science-Elective 0.1810809
## Social Studies-Elective 0.5432839
## Special Education-Elective 0.8020887
## General Elementary-English Language Arts 0.9995122
## Math-English Language Arts 0.6489722
## Other-English Language Arts 0.2597233
## Science-English Language Arts 0.4741989
## Social Studies-English Language Arts 0.8616615
## Special Education-English Language Arts 0.9831255
## Math-General Elementary 0.7188159
## Other-General Elementary 0.2785270
## Science-General Elementary 0.5471875
## Social Studies-General Elementary 0.9383389
## Special Education-General Elementary 0.9988862
## Other-Math 0.9876002
## Science-Math 0.9994142
## Social Studies-Math 0.9999996
## Special Education-Math 0.9855449
## Science-Other 0.9999927
## Social Studies-Other 0.9795742
## Special Education-Other 0.7129399
## Social Studies-Science 0.9980689
## Special Education-Science 0.8988588
## Special Education-Social Studies 0.9987844
## Leave and Gender
TukeyHSD(aov(Leave~gender, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Leave ~ gender, data = teacher2)
##
## $gender
## diff lwr upr p adj
## Male-Female -0.6424184 -1.347741 0.06290423 0.0741348
### Leave Level
TukeyHSD(aov(Leave ~ Level, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Leave ~ Level, data = teacher2)
##
## $Level
## diff lwr upr p adj
## High_School-Elementary -1.0018293 -2.0491047 0.04544616 0.0684507
## Middle_School-Elementary -0.1641174 -1.2169762 0.88874136 0.9930652
## Other-Elementary -1.1649245 -3.2525588 0.92270982 0.5447502
## Pre_K-Elementary 0.8626444 -1.3223839 3.04767272 0.8162949
## Middle_School-High_School 0.8377119 -0.3435431 2.01896681 0.2966399
## Other-High_School -0.1630952 -2.3183374 1.99214692 0.9995890
## Pre_K-High_School 1.8644737 -0.3852375 4.11418486 0.1567244
## Other-Middle_School -1.0008071 -3.1587678 1.15715363 0.7098481
## Pre_K-Middle_School 1.0267618 -1.2255539 3.27907754 0.7229428
## Pre_K-Other 2.0275689 -0.8573282 4.91246608 0.3056881
## Leave Given Level
TukeyHSD(aov(Leave~Cont1, data = teacher2))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Leave ~ Cont1, data = teacher2)
##
## $Cont1
## diff lwr upr
## English Language Arts-Elective -0.097167225 -2.0074582 1.81312373
## General Elementary-Elective 0.516098081 -0.9935987 2.02579483
## Math-Elective -0.492799162 -2.3240253 1.33842698
## Other-Elective -0.609226594 -2.7705094 1.55205620
## Science-Elective -1.565238325 -3.7727385 0.64226190
## Social Studies-Elective -0.007260992 -2.0887991 2.07427715
## Special Education-Elective -0.695806681 -2.4792938 1.08768040
## General Elementary-English Language Arts 0.613265306 -1.0735783 2.30010888
## Math-English Language Arts -0.395631937 -2.3754416 1.58417769
## Other-English Language Arts -0.512059369 -2.8005961 1.77647734
## Science-English Language Arts -1.468071099 -3.8003048 0.86416264
## Social Studies-English Language Arts 0.089906233 -2.1234753 2.30328781
## Special Education-English Language Arts -0.598639456 -2.5343778 1.33709893
## Math-General Elementary -1.008897243 -2.6056499 0.58785536
## Other-General Elementary -1.125324675 -3.0918884 0.84123908
## Science-General Elementary -2.081336406 -4.0985838 -0.06408904
## Social Studies-General Elementary -0.523359073 -2.4019305 1.35521239
## Special Education-General Elementary -1.211904762 -2.7536751 0.32986560
## Other-Math -0.116427432 -2.3393934 2.10653859
## Science-Math -1.072439162 -3.3403659 1.19548761
## Social Studies-Math 0.485538170 -1.6599771 2.63105341
## Special Education-Math -0.203007519 -2.0607644 1.65474940
## Science-Other -0.956011730 -3.4979098 1.58588637
## Social Studies-Other 0.601965602 -1.8313428 3.03527400
## Special Education-Other -0.086580087 -2.2703875 2.09722734
## Social Studies-Science 1.557977332 -0.9164728 4.03242751
## Special Education-Science 0.869431644 -1.3601263 3.09898963
## Special Education-Social Studies -0.688545689 -2.7934620 1.41637061
## p adj
## English Language Arts-Elective 0.9999999
## General Elementary-Elective 0.9679252
## Math-Elective 0.9919990
## Other-Elective 0.9894276
## Science-Elective 0.3788962
## Social Studies-Elective 1.0000000
## Special Education-Elective 0.9352072
## General Elementary-English Language Arts 0.9551982
## Math-English Language Arts 0.9987652
## Other-English Language Arts 0.9974534
## Science-English Language Arts 0.5401774
## Social Studies-English Language Arts 1.0000000
## Special Education-English Language Arts 0.9817848
## Math-General Elementary 0.5351921
## Other-General Elementary 0.6594261
## Science-General Elementary 0.0376133
## Social Studies-General Elementary 0.9901435
## Special Education-General Elementary 0.2470243
## Other-Math 0.9999999
## Science-Math 0.8382919
## Social Studies-Math 0.9972638
## Special Education-Math 0.9999782
## Science-Other 0.9463977
## Social Studies-Other 0.9952219
## Special Education-Other 1.0000000
## Social Studies-Science 0.5398503
## Special Education-Science 0.9353611
## Special Education-Social Studies 0.9749141