#Reading in the data
library(haven)
## Warning: package 'haven' was built under R version 4.3.3
csek12 <- as.data.frame(read_sav("RegRep_K12 Sex Ed_De-Id Data_Clean_11-24-23.sav"))
#Making variables nominal
csek12$Vote <- factor(csek12$Vote, levels = c(1:3))
csek12$Gender_3cat <- factor(csek12$Gender_3cat, levels = c(1:3))
csek12$Gender_5cat <- factor(csek12$Gender_5cat, levels = c(1:5))
csek12$Race_cat <- factor(csek12$Race_cat, levels = c(1:7))
csek12$SO <- factor(csek12$SO, levels = c(1:6))
csek12$Geo <- factor(csek12$Geo, levels = c(1:4))
csek12$Parent <- factor(csek12$Parent, levels = c(1:3))

#setting "I don't know" responses to NA
csek12$PolAff <- ifelse(csek12$Politic == 8, NA, csek12$Politic)

#setting "I would abstain (not vote)" responses to NA
csek12$Vote1 <- ifelse(csek12$Vote == 3, NA, csek12$Vote)
#Descriptive statistics
library(psych)
## Warning: package 'psych' was built under R version 4.3.3
library(summarytools)
describe(csek12$Age)
##    vars   n  mean    sd median trimmed   mad min max range skew kurtosis   se
## X1    1 298 45.23 15.68     43      45 20.76  19  77    58  0.1    -1.19 0.91
describe(csek12$Income)
##    vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 298 4.98 2.86      4    4.98 2.97   1  10     9 0.41    -1.02 0.17
describe(csek12$Edu)
##    vars   n mean   sd median trimmed  mad min max range  skew kurtosis   se
## X1    1 298 6.24 1.34      7    6.24 1.48   2   9     7 -0.28     -0.7 0.08
describe(csek12$Important_Middle)
##    vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 298 1.86 1.14    1.5    1.86 0.74   1   5     4 1.38     0.92 0.07
describe(csek12$Important_High)
##    vars   n mean   sd median trimmed mad min max range skew kurtosis   se
## X1    1 298  1.3 0.84      1     1.3   0   1   5     4 3.39     11.4 0.05
describe(csek12$Politic)
##    vars   n mean   sd median trimmed  mad min max range  skew kurtosis   se
## X1    1 298    5 1.99      6       5 1.48   1   8     7 -0.56     -0.9 0.12
freq(csek12$Gender_5cat)
## Frequencies  
## csek12$Gender_5cat  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1    145     50.00          50.00     48.66          48.66
##           2      0      0.00          50.00      0.00          48.66
##           3    134     46.21          96.21     44.97          93.62
##           4      3      1.03          97.24      1.01          94.63
##           5      8      2.76         100.00      2.68          97.32
##        <NA>      8                               2.68         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Gender_3cat)
## Frequencies  
## csek12$Gender_3cat  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1    145     50.00          50.00     48.66          48.66
##           2    137     47.24          97.24     45.97          94.63
##           3      8      2.76         100.00      2.68          97.32
##        <NA>      8                               2.68         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Race_cat)
## Frequencies  
## csek12$Race_cat  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1     19      6.42           6.42      6.38           6.38
##           2     35     11.82          18.24     11.74          18.12
##           3     13      4.39          22.64      4.36          22.48
##           4      0      0.00          22.64      0.00          22.48
##           5      1      0.34          22.97      0.34          22.82
##           6    201     67.91          90.88     67.45          90.27
##           7     27      9.12         100.00      9.06          99.33
##        <NA>      2                               0.67         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Edu)
## Frequencies  
## csek12$Edu  
## Label: What is the highest level of education you have completed?  
## Type: Numeric  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           2      1      0.34           0.34      0.34           0.34
##           4     35     11.74          12.08     11.74          12.08
##           5     66     22.15          34.23     22.15          34.23
##           6     33     11.07          45.30     11.07          45.30
##           7    122     40.94          86.24     40.94          86.24
##           8     33     11.07          97.32     11.07          97.32
##           9      8      2.68         100.00      2.68         100.00
##        <NA>      0                               0.00         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$SO)
## Frequencies  
## csek12$SO  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1    234     78.52          78.52     78.52          78.52
##           2     11      3.69          82.21      3.69          82.21
##           3     35     11.74          93.96     11.74          93.96
##           4      1      0.34          94.30      0.34          94.30
##           5     15      5.03          99.33      5.03          99.33
##           6      2      0.67         100.00      0.67         100.00
##        <NA>      0                               0.00         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Geo)
## Frequencies  
## csek12$Geo  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1     33     11.15          11.15     11.07          11.07
##           2     63     21.28          32.43     21.14          32.21
##           3    134     45.27          77.70     44.97          77.18
##           4     66     22.30         100.00     22.15          99.33
##        <NA>      2                               0.67         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Politic)
## Frequencies  
## csek12$Politic  
## Label: How would you describe your political affiliations?  
## Type: Numeric  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1     21      7.05           7.05      7.05           7.05
##           2     26      8.72          15.77      8.72          15.77
##           3     22      7.38          23.15      7.38          23.15
##           4     49     16.44          39.60     16.44          39.60
##           5     29      9.73          49.33      9.73          49.33
##           6     53     17.79          67.11     17.79          67.11
##           7     93     31.21          98.32     31.21          98.32
##           8      5      1.68         100.00      1.68         100.00
##        <NA>      0                               0.00         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Parent)
## Frequencies  
## csek12$Parent  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1     75     25.17          25.17     25.17          25.17
##           2     66     22.15          47.32     22.15          47.32
##           3    157     52.68         100.00     52.68         100.00
##        <NA>      0                               0.00         100.00
##       Total    298    100.00         100.00    100.00         100.00
freq(csek12$Vote)
## Frequencies  
## csek12$Vote  
## Type: Factor  
## 
##               Freq   % Valid   % Valid Cum.   % Total   % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
##           1     36     12.08          12.08     12.08          12.08
##           2    243     81.54          93.62     81.54          93.62
##           3     19      6.38         100.00      6.38         100.00
##        <NA>      0                               0.00         100.00
##       Total    298    100.00         100.00    100.00         100.00
CSEK12_ItemDescriptives <- describe(csek12[,c(5:45)])
write.csv(CSEK12_ItemDescriptives, "CSEK12_ItemDescriptives.csv")
SexPos_ItemDescriptives <- describe(csek12[,c(46:54, 85)])
write.csv(SexPos_ItemDescriptives, "SexPos_ItemDescriptives.csv")
SexNeg_ItemDescriptives <- describe(csek12[,c(58:65, 86)])
write.csv(SexNeg_ItemDescriptives, "SexNeg_ItemDescriptives.csv")
#Interitem correlations
library(performance)
## Warning: package 'performance' was built under R version 4.3.3
library(Hmisc)
## Warning: package 'Hmisc' was built under R version 4.3.3
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:summarytools':
## 
##     label, label<-
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
CSEK12_Items <- as.data.frame(csek12[,c(5:13, 15:36, 38:45)])
summary(CSEK12_Items)
##       Q2_1            Q2_2            Q2_3           Q2_4            Q2_5      
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.00   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.00   Median :5.000   Median :5.000  
##  Mean   :4.275   Mean   :4.208   Mean   :4.44   Mean   :4.282   Mean   :4.289  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.00   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.00   Max.   :5.000   Max.   :5.000  
##                                                                                
##       Q2_6            Q2_7            Q2_8            Q2_9      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.369   Mean   :4.456   Mean   :4.349   Mean   :4.453  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##                                                                 
##       Q3_1            Q3_2            Q3_3            Q3_4            Q3_5     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.00  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.00  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000   Median :5.00  
##  Mean   :4.369   Mean   :4.403   Mean   :4.483   Mean   :4.386   Mean   :4.46  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.00  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.00  
##                                                                                
##       Q3_6            Q3_7            Q3_8            Q3_9      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:3.000   1st Qu.:3.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :4.500  
##  Mean   :4.492   Mean   :4.228   Mean   :4.074   Mean   :3.815  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##  NA's   :1                                                      
##      Q3_10            Q4_1            Q4_2            Q4_3      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.248   Mean   :4.419   Mean   :4.322   Mean   :4.463  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##                                                                 
##       Q4_4            Q4_5            Q4_6            Q4_7            Q4_8     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.00  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:5.00  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000   Median :5.00  
##  Mean   :4.463   Mean   :4.497   Mean   :4.406   Mean   :4.228   Mean   :4.54  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.00  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.00  
##                                                                                
##       Q4_9           Q4_10            Q5_1            Q5_2      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.205   Mean   :4.406   Mean   :4.322   Mean   :4.369  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##                                                                 
##       Q5_4            Q5_5            Q5_6           Q5_7            Q5_8      
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.00   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.00   Median :5.000   Median :5.000  
##  Mean   :4.503   Mean   :4.419   Mean   :4.51   Mean   :4.423   Mean   :4.362  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.00   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.00   Max.   :5.000   Max.   :5.000  
##                                                                                
##       Q5_9           Q5_10           Q5_11      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.557   Mean   :4.379   Mean   :4.477  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000  
## 
View(psych::describe(CSEK12_Items))
intercor_CSEK12 <- item_intercor(CSEK12_Items) #mean interitem correlation = 0.72
itemcor_CSEK12 <- cor(CSEK12_Items, use = "complete.obs")
psych::alpha(CSEK12_Items)
## 
## Reliability analysis   
## Call: psych::alpha(x = CSEK12_Items)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N     ase mean   sd median_r
##       0.99      0.99    0.99      0.72 101 0.00087  4.4 0.88     0.74
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.99  0.99  0.99
## Duhachek  0.99  0.99  0.99
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## Q2_1       0.99      0.99    0.99      0.72  98  0.00090 0.0099  0.74
## Q2_2       0.99      0.99    0.99      0.73 101  0.00087 0.0093  0.75
## Q2_3       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q2_4       0.99      0.99    0.99      0.72  98  0.00089 0.0099  0.74
## Q2_5       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q2_6       0.99      0.99    0.99      0.72  99  0.00089 0.0099  0.75
## Q2_7       0.99      0.99    0.99      0.72  98  0.00089 0.0099  0.74
## Q2_8       0.99      0.99    0.99      0.72  99  0.00089 0.0100  0.75
## Q2_9       0.99      0.99    0.99      0.72 100  0.00088 0.0098  0.75
## Q3_1       0.99      0.99    0.99      0.72  97  0.00090 0.0097  0.74
## Q3_2       0.99      0.99    0.99      0.72  97  0.00090 0.0097  0.74
## Q3_3       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q3_4       0.99      0.99    0.99      0.72  97  0.00091 0.0096  0.74
## Q3_5       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q3_6       0.99      0.99    0.99      0.72  98  0.00089 0.0098  0.74
## Q3_7       0.99      0.99    0.99      0.72  99  0.00089 0.0097  0.74
## Q3_8       0.99      0.99    0.99      0.73 101  0.00085 0.0091  0.75
## Q3_9       0.99      0.99    0.99      0.73 102  0.00084 0.0089  0.75
## Q3_10      0.99      0.99    0.99      0.72  99  0.00089 0.0099  0.75
## Q4_1       0.99      0.99    0.99      0.72  97  0.00091 0.0096  0.74
## Q4_2       0.99      0.99    0.99      0.72  97  0.00090 0.0098  0.74
## Q4_3       0.99      0.99    0.99      0.72  96  0.00091 0.0094  0.74
## Q4_4       0.99      0.99    0.99      0.72  97  0.00091 0.0096  0.74
## Q4_5       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q4_6       0.99      0.99    0.99      0.72  97  0.00091 0.0096  0.74
## Q4_7       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q4_8       0.99      0.99    0.99      0.72  98  0.00089 0.0098  0.74
## Q4_9       0.99      0.99    0.99      0.73 104  0.00084 0.0072  0.75
## Q4_10      0.99      0.99    0.99      0.72  97  0.00090 0.0097  0.74
## Q5_1       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q5_2       0.99      0.99    0.99      0.72  98  0.00089 0.0098  0.74
## Q5_4       0.99      0.99    0.99      0.72  97  0.00090 0.0096  0.74
## Q5_5       0.99      0.99    0.99      0.72  99  0.00089 0.0099  0.75
## Q5_6       0.99      0.99    0.99      0.72  98  0.00090 0.0098  0.74
## Q5_7       0.99      0.99    0.99      0.72  97  0.00090 0.0096  0.74
## Q5_8       0.99      0.99    0.99      0.73 102  0.00086 0.0087  0.75
## Q5_9       0.99      0.99    0.99      0.72  97  0.00090 0.0098  0.74
## Q5_10      0.99      0.99    0.99      0.72 100  0.00088 0.0097  0.75
## Q5_11      0.99      0.99    0.99      0.72  97  0.00090 0.0096  0.74
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean   sd
## Q2_1  298  0.86  0.86  0.86   0.86  4.3 1.05
## Q2_2  298  0.74  0.74  0.73   0.72  4.2 1.11
## Q2_3  298  0.88  0.88  0.88   0.87  4.4 0.95
## Q2_4  298  0.86  0.86  0.85   0.85  4.3 1.06
## Q2_5  298  0.87  0.87  0.86   0.86  4.3 1.07
## Q2_6  298  0.83  0.83  0.83   0.82  4.4 1.06
## Q2_7  298  0.86  0.86  0.85   0.85  4.5 0.95
## Q2_8  298  0.84  0.85  0.84   0.84  4.3 0.97
## Q2_9  298  0.80  0.80  0.80   0.79  4.5 0.89
## Q3_1  298  0.91  0.90  0.90   0.90  4.4 1.03
## Q3_2  298  0.91  0.91  0.91   0.91  4.4 1.01
## Q3_3  298  0.88  0.89  0.88   0.88  4.5 0.92
## Q3_4  298  0.93  0.93  0.93   0.92  4.4 1.04
## Q3_5  298  0.89  0.89  0.89   0.88  4.5 0.97
## Q3_6  297  0.84  0.85  0.84   0.84  4.5 0.97
## Q3_7  298  0.84  0.83  0.83   0.82  4.2 1.18
## Q3_8  298  0.74  0.73  0.73   0.72  4.1 1.34
## Q3_9  298  0.72  0.71  0.70   0.70  3.8 1.44
## Q3_10 298  0.83  0.83  0.83   0.82  4.2 1.06
## Q4_1  298  0.92  0.92  0.92   0.92  4.4 1.00
## Q4_2  298  0.89  0.89  0.89   0.88  4.3 1.06
## Q4_3  298  0.94  0.94  0.94   0.94  4.5 0.97
## Q4_4  298  0.92  0.92  0.92   0.92  4.5 1.00
## Q4_5  298  0.87  0.87  0.87   0.86  4.5 0.97
## Q4_6  298  0.92  0.92  0.92   0.92  4.4 1.03
## Q4_7  298  0.87  0.87  0.87   0.86  4.2 1.17
## Q4_8  298  0.87  0.87  0.87   0.86  4.5 0.98
## Q4_9  298  0.60  0.60  0.59   0.58  4.2 1.09
## Q4_10 298  0.90  0.90  0.90   0.90  4.4 1.00
## Q5_1  298  0.88  0.88  0.88   0.87  4.3 1.03
## Q5_2  298  0.86  0.86  0.86   0.85  4.4 1.07
## Q5_4  298  0.91  0.92  0.92   0.91  4.5 0.94
## Q5_5  298  0.83  0.84  0.83   0.82  4.4 0.98
## Q5_6  298  0.88  0.88  0.88   0.87  4.5 0.90
## Q5_7  298  0.91  0.91  0.91   0.91  4.4 1.04
## Q5_8  298  0.68  0.69  0.67   0.66  4.4 1.06
## Q5_9  298  0.89  0.89  0.89   0.89  4.6 0.88
## Q5_10 298  0.78  0.78  0.78   0.77  4.4 0.96
## Q5_11 298  0.91  0.92  0.92   0.91  4.5 0.99
## 
## Non missing response frequency for each item
##          1    2    3    4    5 miss
## Q2_1  0.03 0.06 0.06 0.29 0.56    0
## Q2_2  0.04 0.04 0.15 0.20 0.57    0
## Q2_3  0.03 0.02 0.09 0.20 0.66    0
## Q2_4  0.04 0.04 0.12 0.21 0.59    0
## Q2_5  0.04 0.05 0.10 0.21 0.60    0
## Q2_6  0.04 0.05 0.06 0.21 0.64    0
## Q2_7  0.03 0.03 0.06 0.22 0.66    0
## Q2_8  0.03 0.03 0.10 0.24 0.59    0
## Q2_9  0.02 0.02 0.08 0.23 0.64    0
## Q3_1  0.04 0.03 0.09 0.21 0.63    0
## Q3_2  0.03 0.03 0.09 0.18 0.66    0
## Q3_3  0.02 0.03 0.07 0.20 0.68    0
## Q3_4  0.04 0.03 0.08 0.19 0.65    0
## Q3_5  0.03 0.02 0.08 0.18 0.68    0
## Q3_6  0.03 0.01 0.10 0.14 0.72    0
## Q3_7  0.06 0.05 0.12 0.15 0.62    0
## Q3_8  0.10 0.04 0.11 0.16 0.58    0
## Q3_9  0.13 0.08 0.14 0.15 0.50    0
## Q3_10 0.04 0.05 0.10 0.26 0.56    0
## Q4_1  0.04 0.03 0.06 0.22 0.65    0
## Q4_2  0.04 0.04 0.10 0.20 0.62    0
## Q4_3  0.03 0.03 0.08 0.17 0.69    0
## Q4_4  0.04 0.03 0.05 0.19 0.69    0
## Q4_5  0.03 0.04 0.05 0.16 0.71    0
## Q4_6  0.04 0.04 0.07 0.19 0.66    0
## Q4_7  0.05 0.05 0.11 0.18 0.60    0
## Q4_8  0.04 0.03 0.05 0.13 0.76    0
## Q4_9  0.04 0.03 0.17 0.19 0.56    0
## Q4_10 0.04 0.03 0.08 0.20 0.65    0
## Q5_1  0.04 0.03 0.12 0.21 0.61    0
## Q5_2  0.04 0.04 0.08 0.18 0.65    0
## Q5_4  0.03 0.02 0.06 0.18 0.70    0
## Q5_5  0.03 0.02 0.09 0.20 0.65    0
## Q5_6  0.03 0.02 0.07 0.19 0.69    0
## Q5_7  0.04 0.03 0.07 0.18 0.68    0
## Q5_8  0.04 0.04 0.09 0.18 0.65    0
## Q5_9  0.02 0.01 0.08 0.15 0.73    0
## Q5_10 0.02 0.03 0.12 0.20 0.62    0
## Q5_11 0.04 0.03 0.05 0.19 0.69    0
write.csv(itemcor_CSEK12, "CSEK12_ItemCorrelations.csv")

SexPos_Items <- csek12[,c(46:53)]
item_intercor(SexPos_Items) #0.76
## [1] 0.7637165
itemcor_SexPos <- cor(SexPos_Items)
psych::describe(csek12$Sex_Pos)
##    vars   n  mean   sd median trimmed mad min max range  skew kurtosis   se
## X1    1 298 38.88 8.34     40   39.97 8.9   8  48    40 -1.15     1.57 0.48
SexNeg_Items <- csek12[,c(58:65)]
item_intercor(SexNeg_Items) #0.54
## [1] 0.5388472
itemcor_SexNeg <- cor(SexNeg_Items)
psych::describe(csek12$Sex_Neg)
##    vars   n  mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 298 11.22 4.55     10   10.31 2.97   8  48    40 3.25    16.66 0.26
#Missingness (only 1 missing value in scale; Q3_6)
library(finalfit)
## Warning: package 'finalfit' was built under R version 4.3.3
library(naniar)
## Warning: package 'naniar' was built under R version 4.3.3
library(misty)
## Warning: package 'misty' was built under R version 4.3.3
## |-------------------------------------|
## | misty 0.6.5 (2024-06-29)            |
## | Miscellaneous Functions T. Yanagida |
## |-------------------------------------|
## 
## Attaching package: 'misty'
## The following object is masked from 'package:Hmisc':
## 
##     na.pattern
## The following object is masked from 'package:summarytools':
## 
##     freq
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
## 
##     src, summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
missing_plot(CSEK12_Items)

missing_pattern(CSEK12_Items)

##     Q2_1 Q2_2 Q2_3 Q2_4 Q2_5 Q2_6 Q2_7 Q2_8 Q2_9 Q3_1 Q3_2 Q3_3 Q3_4 Q3_5 Q3_7
## 297    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1
## 1      1    1    1    1    1    1    1    1    1    1    1    1    1    1    1
##        0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
##     Q3_8 Q3_9 Q3_10 Q4_1 Q4_2 Q4_3 Q4_4 Q4_5 Q4_6 Q4_7 Q4_8 Q4_9 Q4_10 Q5_1
## 297    1    1     1    1    1    1    1    1    1    1    1    1     1    1
## 1      1    1     1    1    1    1    1    1    1    1    1    1     1    1
##        0    0     0    0    0    0    0    0    0    0    0    0     0    0
##     Q5_2 Q5_4 Q5_5 Q5_6 Q5_7 Q5_8 Q5_9 Q5_10 Q5_11 Q3_6  
## 297    1    1    1    1    1    1    1     1     1    1 0
## 1      1    1    1    1    1    1    1     1     1    0 1
##        0    0    0    0    0    0    0     0     0    1 1
explanatory = c("Age", "Gender_5cat", "Gender_3cat", "Race_cat", "Edu", "Income", "Geo", "SO", "Politic", "Parent", "Vote", "Important_Middle", "Important_High", "Sex_Pos", "Sex_Neg")
dependent = "Q3_6"
csek12 %>% missing_compare(dependent, explanatory)
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_5cat, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_3cat, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Race_cat, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Geo, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(SO, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Parent, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Vote, Q3_6)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
##  Missing data analysis: How do you feel about comprehensive sex ed. in K-12 schools if … - The class reduces STDs.
##                                                                                                  What is your age?
##                                                                                                        Gender_5cat
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                        Gender_3cat
##                                                                                                                   
##                                                                                                                   
##                                                                                                           Race_cat
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                         What is the highest level of education you have completed?
##                                                                        What is your household income before taxes?
##                                                                                                                Geo
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                 SO
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                                                                   
##                                                                How would you describe your political affiliations?
##                                                                                                             Parent
##                                                                                                                   
##                                                                                                                   
##                                                                                                               Vote
##                                                                                                                   
##                                                                                                                   
##                                           How important do you think it is to have sex education in middle school?
##                                             How important do you think it is to have sex education in high school?
##                             Sex positivity scale composite score. Range 8-48. Higher scores = more sex positivity.
##                              Sex negtivity scale composite score. Range 8-48. Higher scores = more sex negativity.
##            Not missing   Missing     p
##  Mean (SD) 45.2 (15.7) 56.0 (NA) 0.492
##          1  144 (99.3)   1 (0.7) 0.800
##          2     0 (NaN)   0 (NaN)      
##          3 134 (100.0)   0 (0.0)      
##          4   3 (100.0)   0 (0.0)      
##          5   8 (100.0)   0 (0.0)      
##          1  144 (99.3)   1 (0.7) 0.605
##          2 137 (100.0)   0 (0.0)      
##          3   8 (100.0)   0 (0.0)      
##          1  19 (100.0)   0 (0.0) 0.187
##          2   34 (97.1)   1 (2.9)      
##          3  13 (100.0)   0 (0.0)      
##          4     0 (NaN)   0 (NaN)      
##          5   1 (100.0)   0 (0.0)      
##          6 201 (100.0)   0 (0.0)      
##          7  27 (100.0)   0 (0.0)      
##  Mean (SD)   6.2 (1.3)  5.0 (NA) 0.353
##  Mean (SD)   5.0 (2.9)  3.0 (NA) 0.489
##          1  33 (100.0)   0 (0.0) 0.750
##          2  63 (100.0)   0 (0.0)      
##          3  133 (99.3)   1 (0.7)      
##          4  66 (100.0)   0 (0.0)      
##          1  233 (99.6)   1 (0.4) 0.998
##          2  11 (100.0)   0 (0.0)      
##          3  35 (100.0)   0 (0.0)      
##          4   1 (100.0)   0 (0.0)      
##          5  15 (100.0)   0 (0.0)      
##          6   2 (100.0)   0 (0.0)      
##  Mean (SD)   5.0 (2.0)  4.0 (NA) 0.617
##          1  75 (100.0)   0 (0.0) 0.637
##          2  66 (100.0)   0 (0.0)      
##          3  156 (99.4)   1 (0.6)      
##          1  36 (100.0)   0 (0.0) 0.893
##          2  242 (99.6)   1 (0.4)      
##          3  19 (100.0)   0 (0.0)      
##  Mean (SD)   1.9 (1.1)  2.0 (NA) 0.902
##  Mean (SD)   1.3 (0.8)  1.0 (NA) 0.720
##  Mean (SD)  38.9 (8.4) 38.0 (NA) 0.916
##  Mean (SD)  11.2 (4.6) 10.0 (NA) 0.789
explanatory1 = c("Age", "Race_cat", "Edu", "Income", "Geo", "SO", "Politic", "Parent", "Vote", "Important_Middle", "Important_High", "Sex_Pos", "Sex_Neg")
dependent1a = "Gender_5cat"
dependent1b = "Gender_3cat"
csek12 %>% missing_compare(dependent1a, explanatory1)
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Race_cat, Gender_5cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Geo, Gender_5cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(SO, Gender_5cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Parent, Gender_5cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Vote, Gender_5cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
##                                                      Missing data analysis: Gender_5cat
##                                                                       What is your age?
##                                                                                Race_cat
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                              What is the highest level of education you have completed?
##                                             What is your household income before taxes?
##                                                                                     Geo
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                      SO
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                     How would you describe your political affiliations?
##                                                                                  Parent
##                                                                                        
##                                                                                        
##                                                                                    Vote
##                                                                                        
##                                                                                        
##                How important do you think it is to have sex education in middle school?
##                  How important do you think it is to have sex education in high school?
##  Sex positivity scale composite score. Range 8-48. Higher scores = more sex positivity.
##   Sex negtivity scale composite score. Range 8-48. Higher scores = more sex negativity.
##            Not missing     Missing     p
##  Mean (SD) 45.1 (15.6) 49.6 (18.6) 0.422
##          1  19 (100.0)     0 (0.0) 0.109
##          2   34 (97.1)     1 (2.9)      
##          3   11 (84.6)    2 (15.4)      
##          4     0 (NaN)     0 (NaN)      
##          5   1 (100.0)     0 (0.0)      
##          6  197 (98.0)     4 (2.0)      
##          7   26 (96.3)     1 (3.7)      
##  Mean (SD)   6.3 (1.3)   5.9 (1.2) 0.433
##  Mean (SD)   5.0 (2.9)   5.0 (2.8) 0.987
##          1   31 (93.9)     2 (6.1) 0.357
##          2  63 (100.0)     0 (0.0)      
##          3  130 (97.0)     4 (3.0)      
##          4   64 (97.0)     2 (3.0)      
##          1  227 (97.0)     7 (3.0) 0.971
##          2  11 (100.0)     0 (0.0)      
##          3   34 (97.1)     1 (2.9)      
##          4   1 (100.0)     0 (0.0)      
##          5  15 (100.0)     0 (0.0)      
##          6   2 (100.0)     0 (0.0)      
##  Mean (SD)   5.0 (2.0)   3.2 (2.3) 0.012
##          1   72 (96.0)     3 (4.0) 0.642
##          2   64 (97.0)     2 (3.0)      
##          3  154 (98.1)     3 (1.9)      
##          1   33 (91.7)     3 (8.3) 0.071
##          2  238 (97.9)     5 (2.1)      
##          3  19 (100.0)     0 (0.0)      
##  Mean (SD)   1.8 (1.1)   2.4 (1.5) 0.195
##  Mean (SD)   1.3 (0.8)   1.6 (1.4) 0.272
##  Mean (SD)  39.0 (8.1) 33.9 (14.5) 0.086
##  Mean (SD)  11.2 (4.5)  11.9 (6.0) 0.680
csek12 %>% missing_compare(dependent1b, explanatory1)
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Race_cat, Gender_3cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Geo, Gender_3cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(SO, Gender_3cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Parent, Gender_3cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Vote, Gender_3cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
##                                                      Missing data analysis: Gender_3cat
##                                                                       What is your age?
##                                                                                Race_cat
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                              What is the highest level of education you have completed?
##                                             What is your household income before taxes?
##                                                                                     Geo
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                      SO
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                     How would you describe your political affiliations?
##                                                                                  Parent
##                                                                                        
##                                                                                        
##                                                                                    Vote
##                                                                                        
##                                                                                        
##                How important do you think it is to have sex education in middle school?
##                  How important do you think it is to have sex education in high school?
##  Sex positivity scale composite score. Range 8-48. Higher scores = more sex positivity.
##   Sex negtivity scale composite score. Range 8-48. Higher scores = more sex negativity.
##            Not missing     Missing     p
##  Mean (SD) 45.1 (15.6) 49.6 (18.6) 0.422
##          1  19 (100.0)     0 (0.0) 0.109
##          2   34 (97.1)     1 (2.9)      
##          3   11 (84.6)    2 (15.4)      
##          4     0 (NaN)     0 (NaN)      
##          5   1 (100.0)     0 (0.0)      
##          6  197 (98.0)     4 (2.0)      
##          7   26 (96.3)     1 (3.7)      
##  Mean (SD)   6.3 (1.3)   5.9 (1.2) 0.433
##  Mean (SD)   5.0 (2.9)   5.0 (2.8) 0.987
##          1   31 (93.9)     2 (6.1) 0.357
##          2  63 (100.0)     0 (0.0)      
##          3  130 (97.0)     4 (3.0)      
##          4   64 (97.0)     2 (3.0)      
##          1  227 (97.0)     7 (3.0) 0.971
##          2  11 (100.0)     0 (0.0)      
##          3   34 (97.1)     1 (2.9)      
##          4   1 (100.0)     0 (0.0)      
##          5  15 (100.0)     0 (0.0)      
##          6   2 (100.0)     0 (0.0)      
##  Mean (SD)   5.0 (2.0)   3.2 (2.3) 0.012
##          1   72 (96.0)     3 (4.0) 0.642
##          2   64 (97.0)     2 (3.0)      
##          3  154 (98.1)     3 (1.9)      
##          1   33 (91.7)     3 (8.3) 0.071
##          2  238 (97.9)     5 (2.1)      
##          3  19 (100.0)     0 (0.0)      
##  Mean (SD)   1.8 (1.1)   2.4 (1.5) 0.195
##  Mean (SD)   1.3 (0.8)   1.6 (1.4) 0.272
##  Mean (SD)  39.0 (8.1) 33.9 (14.5) 0.086
##  Mean (SD)  11.2 (4.5)  11.9 (6.0) 0.680
explanatory2 = c("Age", "Edu", "Gender_5cat", "Gender_3cat", "Income", "Geo", "SO", "Politic", "Parent", "Vote", "Important_Middle", "Important_High", "Sex_Pos", "Sex_Neg")
dependent2 = "Race_cat"
csek12 %>% missing_compare(dependent2, explanatory2)
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_5cat, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_3cat, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Geo, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(SO, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Parent, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Vote, Race_cat)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
##                                                         Missing data analysis: Race_cat
##                                                                       What is your age?
##                              What is the highest level of education you have completed?
##                                                                             Gender_5cat
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                             Gender_3cat
##                                                                                        
##                                                                                        
##                                             What is your household income before taxes?
##                                                                                     Geo
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                      SO
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                     How would you describe your political affiliations?
##                                                                                  Parent
##                                                                                        
##                                                                                        
##                                                                                    Vote
##                                                                                        
##                                                                                        
##                How important do you think it is to have sex education in middle school?
##                  How important do you think it is to have sex education in high school?
##  Sex positivity scale composite score. Range 8-48. Higher scores = more sex positivity.
##   Sex negtivity scale composite score. Range 8-48. Higher scores = more sex negativity.
##            Not missing     Missing      p
##  Mean (SD) 45.2 (15.7) 50.0 (14.1)  0.667
##  Mean (SD)   6.2 (1.3)   6.0 (1.4)  0.798
##          1  144 (99.3)     1 (0.7)  0.001
##          2     0 (NaN)     0 (NaN)       
##          3 134 (100.0)     0 (0.0)       
##          4   3 (100.0)     0 (0.0)       
##          5    7 (87.5)    1 (12.5)       
##          1  144 (99.3)     1 (0.7) <0.001
##          2 137 (100.0)     0 (0.0)       
##          3    7 (87.5)    1 (12.5)       
##  Mean (SD)   5.0 (2.9)   2.0 (1.4)  0.139
##          1  33 (100.0)     0 (0.0)  0.487
##          2  63 (100.0)     0 (0.0)       
##          3  132 (98.5)     2 (1.5)       
##          4  66 (100.0)     0 (0.0)       
##          1  233 (99.6)     1 (0.4)  0.713
##          2  11 (100.0)     0 (0.0)       
##          3   34 (97.1)     1 (2.9)       
##          4   1 (100.0)     0 (0.0)       
##          5  15 (100.0)     0 (0.0)       
##          6   2 (100.0)     0 (0.0)       
##  Mean (SD)   5.0 (2.0)   4.5 (3.5)  0.724
##          1  75 (100.0)     0 (0.0)  0.405
##          2  66 (100.0)     0 (0.0)       
##          3  155 (98.7)     2 (1.3)       
##          1  36 (100.0)     0 (0.0)  0.796
##          2  241 (99.2)     2 (0.8)       
##          3  19 (100.0)     0 (0.0)       
##  Mean (SD)   1.9 (1.1)   1.0 (0.0)  0.286
##  Mean (SD)   1.3 (0.8)   1.0 (0.0)  0.612
##  Mean (SD)  38.9 (8.3) 32.5 (13.4)  0.279
##  Mean (SD)  11.2 (4.6)  14.0 (1.4)  0.386
explanatory3 = c("Age", "Gender_5cat", "Gender_3cat", "Race_cat", "Edu", "Income", "SO", "Politic", "Parent", "Vote", "Important_Middle", "Important_High", "Sex_Pos", "Sex_Neg")
dependent3 = "Geo"
csek12 %>% missing_compare(dependent3, explanatory3)
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_5cat, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Gender_3cat, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Race_cat, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(SO, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Parent, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
## Warning: There was 1 warning in `dplyr::summarise()`.
## ℹ In argument: `chisq.test(Vote, Geo)$p.value`.
## Caused by warning in `chisq.test()`:
## ! Chi-squared approximation may be incorrect
##                                                              Missing data analysis: Geo
##                                                                       What is your age?
##                                                                             Gender_5cat
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                             Gender_3cat
##                                                                                        
##                                                                                        
##                                                                                Race_cat
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                              What is the highest level of education you have completed?
##                                             What is your household income before taxes?
##                                                                                      SO
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                                                                        
##                                     How would you describe your political affiliations?
##                                                                                  Parent
##                                                                                        
##                                                                                        
##                                                                                    Vote
##                                                                                        
##                                                                                        
##                How important do you think it is to have sex education in middle school?
##                  How important do you think it is to have sex education in high school?
##  Sex positivity scale composite score. Range 8-48. Higher scores = more sex positivity.
##   Sex negtivity scale composite score. Range 8-48. Higher scores = more sex negativity.
##            Not missing     Missing     p
##  Mean (SD) 45.2 (15.7) 48.0 (21.2) 0.802
##          1 145 (100.0)     0 (0.0) 0.504
##          2     0 (NaN)     0 (NaN)      
##          3  132 (98.5)     2 (1.5)      
##          4   3 (100.0)     0 (0.0)      
##          5   8 (100.0)     0 (0.0)      
##          1 145 (100.0)     0 (0.0) 0.325
##          2  135 (98.5)     2 (1.5)      
##          3   8 (100.0)     0 (0.0)      
##          1  19 (100.0)     0 (0.0) 0.702
##          2   34 (97.1)     1 (2.9)      
##          3  13 (100.0)     0 (0.0)      
##          4     0 (NaN)     0 (NaN)      
##          5   1 (100.0)     0 (0.0)      
##          6  200 (99.5)     1 (0.5)      
##          7  27 (100.0)     0 (0.0)      
##  Mean (SD)   6.2 (1.3)   7.0 (0.0) 0.422
##  Mean (SD)   5.0 (2.9)   5.0 (4.2) 0.993
##          1  232 (99.1)     2 (0.9) 0.990
##          2  11 (100.0)     0 (0.0)      
##          3  35 (100.0)     0 (0.0)      
##          4   1 (100.0)     0 (0.0)      
##          5  15 (100.0)     0 (0.0)      
##          6   2 (100.0)     0 (0.0)      
##  Mean (SD)   5.0 (2.0)   4.5 (2.1) 0.724
##          1   74 (98.7)     1 (1.3) 0.624
##          2  66 (100.0)     0 (0.0)      
##          3  156 (99.4)     1 (0.6)      
##          1   35 (97.2)     1 (2.8) 0.250
##          2  242 (99.6)     1 (0.4)      
##          3  19 (100.0)     0 (0.0)      
##  Mean (SD)   1.9 (1.1)   1.5 (0.7) 0.656
##  Mean (SD)   1.3 (0.8)   1.0 (0.0) 0.612
##  Mean (SD)  38.9 (8.4)  41.0 (1.4) 0.718
##  Mean (SD)  11.2 (4.6)  11.0 (4.2) 0.946
mcar_data <- csek12[,c(5:13, 15:36, 38:53, 55:67, 69, 78:80, 82:86)]
#amount of missingness so small that there are issues even running this test
naniar::mcar_test(mcar_data)
## Warning in norm::prelim.norm(data): NAs introduced by coercion to integer range
## Error in `dplyr::mutate()`:
## ℹ In argument: `d2 = purrr::pmap_dbl(...)`.
## ℹ In group 1: `miss_pattern = 1`.
## Caused by error in `purrr::pmap_dbl()`:
## ℹ In index: 1.
## Caused by error in `solve.default()`:
## ! system is computationally singular: reciprocal condition number = 5.46712e-20
misty::na.test(mcar_data)
## Warning: Function run into numerical problems, i.e., results are not
## trustworthy.
## Error in solve.default(grand.cov[which(rownames(grand.cov) %in% keep), : system is computationally singular: reciprocal condition number = 5.46712e-20
#cfa
library(lavaan)
## Warning: package 'lavaan' was built under R version 4.3.3
## This is lavaan 0.6-18
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
library(faoutlier)
## Warning: package 'faoutlier' was built under R version 4.3.2
## Loading required package: sem
## Warning: package 'sem' was built under R version 4.3.2
## 
## Attaching package: 'sem'
## The following objects are masked from 'package:lavaan':
## 
##     cfa, sem
## The following object is masked from 'package:misty':
## 
##     std.coef
## Loading required package: mvtnorm
## Warning: package 'mvtnorm' was built under R version 4.3.3
## Loading required package: parallel
#one factor model

csek12one <- '
             CSE =~ Q2_1 + Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_1 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10 + Q4_1 + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_1 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11'
csek12one.fit <- lavaan::cfa(csek12one, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR", meanstructure = TRUE)
dynamic::cfaOne(csek12one.fit, plot = TRUE)
## Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
## dplyr 1.1.0.
## ℹ Please use `reframe()` instead.
## ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
##   always returns an ungrouped data frame and adjust accordingly.
## ℹ The deprecated feature was likely used in the dynamic package.
##   Please report the issue at <https://github.com/melissagwolf/dynamic/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI
## Level 1: 95/5  .017  .025 .991
## Level 1: 90/10   --    --   --
## Level 2: 95/5  .018  .036 .982
## Level 2: 90/10   --    --   --
## Level 3: 95/5  .019  .047  .97
## Level 3: 90/10   --    --   --
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##    2612.185 702       0  0.033   0.096  0.885
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

## 
## [[2]]

## 
## [[3]]

summary(csek12one.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 147 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       117
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2612.185    1508.418
##   Degrees of freedom                               702         702
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.732
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.885       0.908
##   Tucker-Lewis Index (TLI)                       0.878       0.903
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.914
##   Robust Tucker-Lewis Index (TLI)                            0.909
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9408.315   -9408.315
##   Scaling correction factor                                  2.300
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               19050.631   19050.631
##   Bayesian (BIC)                             19483.191   19483.191
##   Sample-size adjusted Bayesian (SABIC)      19112.141   19112.141
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.096       0.062
##   90 Percent confidence interval - lower         0.092       0.059
##   90 Percent confidence interval - upper         0.099       0.065
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.081
##   90 Percent confidence interval - lower                     0.075
##   90 Percent confidence interval - upper                     0.087
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.639
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.033       0.033
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE =~                                                                
##     Q2_1              0.894    0.064   13.872    0.000    0.894    0.853
##     Q2_2              0.807    0.070   11.484    0.000    0.807    0.729
##     Q2_3              0.826    0.068   12.085    0.000    0.826    0.875
##     Q2_4              0.896    0.067   13.400    0.000    0.896    0.843
##     Q2_5              0.914    0.069   13.294    0.000    0.914    0.856
##     Q2_6              0.871    0.073   11.952    0.000    0.871    0.826
##     Q2_7              0.813    0.076   10.696    0.000    0.813    0.854
##     Q2_8              0.805    0.072   11.104    0.000    0.805    0.831
##     Q2_9              0.701    0.075    9.393    0.000    0.701    0.784
##     Q3_1              0.929    0.067   13.953    0.000    0.929    0.906
##     Q3_2              0.919    0.068   13.453    0.000    0.919    0.913
##     Q3_3              0.815    0.078   10.503    0.000    0.815    0.885
##     Q3_4              0.959    0.068   14.116    0.000    0.959    0.927
##     Q3_5              0.864    0.077   11.295    0.000    0.864    0.889
##     Q3_6              0.813    0.077   10.614    0.000    0.813    0.843
##     Q3_7              0.971    0.065   14.903    0.000    0.971    0.823
##     Q3_8              0.959    0.068   14.134    0.000    0.959    0.718
##     Q3_9              0.996    0.057   17.617    0.000    0.996    0.691
##     Q3_10             0.867    0.069   12.593    0.000    0.867    0.819
##     Q4_1              0.923    0.071   13.056    0.000    0.923    0.929
##     Q4_2              0.942    0.067   14.022    0.000    0.942    0.894
##     Q4_3              0.923    0.069   13.344    0.000    0.923    0.949
##     Q4_4              0.922    0.074   12.464    0.000    0.922    0.925
##     Q4_5              0.849    0.075   11.277    0.000    0.849    0.875
##     Q4_6              0.947    0.070   13.547    0.000    0.947    0.923
##     Q4_7              1.009    0.062   16.177    0.000    1.009    0.866
##     Q4_8              0.849    0.081   10.451    0.000    0.849    0.870
##     Q4_9              0.626    0.079    7.926    0.000    0.626    0.577
##     Q4_10             0.907    0.070   12.997    0.000    0.907    0.904
##     Q5_1              0.904    0.067   13.451    0.000    0.904    0.876
##     Q5_2              0.919    0.070   13.048    0.000    0.919    0.864
##     Q5_4              0.866    0.075   11.514    0.000    0.866    0.922
##     Q5_5              0.804    0.075   10.657    0.000    0.804    0.825
##     Q5_6              0.789    0.075   10.482    0.000    0.789    0.874
##     Q5_7              0.945    0.073   13.002    0.000    0.945    0.913
##     Q5_8              0.707    0.083    8.483    0.000    0.707    0.669
##     Q5_9              0.782    0.075   10.404    0.000    0.782    0.891
##     Q5_10             0.735    0.079    9.314    0.000    0.735    0.766
##     Q5_11             0.904    0.073   12.410    0.000    0.904    0.919
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.079
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.830    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.221    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.300    0.000    4.490    4.658
##    .Q3_7              4.228    0.068   61.890    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.312    0.000    4.248    4.015
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.292    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.831    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.347    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.255    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.635    0.000    4.557    5.192
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.300    0.046    6.571    0.000    0.300    0.273
##    .Q2_2              0.575    0.078    7.390    0.000    0.575    0.469
##    .Q2_3              0.209    0.037    5.684    0.000    0.209    0.235
##    .Q2_4              0.326    0.051    6.440    0.000    0.326    0.289
##    .Q2_5              0.304    0.041    7.347    0.000    0.304    0.267
##    .Q2_6              0.354    0.079    4.488    0.000    0.354    0.318
##    .Q2_7              0.245    0.041    5.975    0.000    0.245    0.271
##    .Q2_8              0.291    0.040    7.250    0.000    0.291    0.310
##    .Q2_9              0.307    0.039    7.801    0.000    0.307    0.385
##    .Q3_1              0.189    0.056    3.391    0.001    0.189    0.180
##    .Q3_2              0.168    0.032    5.245    0.000    0.168    0.166
##    .Q3_3              0.183    0.050    3.639    0.000    0.183    0.216
##    .Q3_4              0.150    0.030    4.968    0.000    0.150    0.140
##    .Q3_5              0.199    0.043    4.607    0.000    0.199    0.210
##    .Q3_6              0.268    0.046    5.824    0.000    0.268    0.289
##    .Q3_7              0.448    0.078    5.735    0.000    0.448    0.322
##    .Q3_8              0.866    0.122    7.105    0.000    0.866    0.485
##    .Q3_9              1.084    0.118    9.180    0.000    1.084    0.522
##    .Q3_10             0.368    0.069    5.374    0.000    0.368    0.329
##    .Q4_1              0.136    0.034    4.002    0.000    0.136    0.137
##    .Q4_2              0.224    0.041    5.405    0.000    0.224    0.201
##    .Q4_3              0.095    0.016    5.925    0.000    0.095    0.100
##    .Q4_4              0.143    0.025    5.664    0.000    0.143    0.144
##    .Q4_5              0.220    0.034    6.435    0.000    0.220    0.234
##    .Q4_6              0.156    0.025    6.291    0.000    0.156    0.148
##    .Q4_7              0.339    0.057    5.960    0.000    0.339    0.250
##    .Q4_8              0.232    0.035    6.573    0.000    0.232    0.243
##    .Q4_9              0.784    0.100    7.809    0.000    0.784    0.667
##    .Q4_10             0.183    0.039    4.660    0.000    0.183    0.182
##    .Q5_1              0.247    0.040    6.159    0.000    0.247    0.232
##    .Q5_2              0.288    0.056    5.136    0.000    0.288    0.254
##    .Q5_4              0.131    0.024    5.586    0.000    0.131    0.149
##    .Q5_5              0.302    0.058    5.220    0.000    0.302    0.319
##    .Q5_6              0.192    0.031    6.095    0.000    0.192    0.236
##    .Q5_7              0.177    0.028    6.444    0.000    0.177    0.166
##    .Q5_8              0.617    0.105    5.865    0.000    0.617    0.552
##    .Q5_9              0.159    0.020    7.798    0.000    0.159    0.207
##    .Q5_10             0.380    0.054    7.074    0.000    0.380    0.413
##    .Q5_11             0.151    0.035    4.335    0.000    0.151    0.156
##     CSE               1.000                               1.000    1.000
#does not meet thresholds as indicated by dynamic fit indices 

#To improve fit, covariance set 1 added to model:
csek12one.mod1 <- '
             CSE =~ Q2_1 + Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_1 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10 + Q4_1 + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_1 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11
        
          #covariances
          Q2_3 ~~ Q2_4
          Q2_3 ~~ Q2_5
          Q2_3 ~~ Q5_5
          Q2_3 ~~ Q5_6
          Q2_4 ~~ Q2_5
          Q2_4 ~~ Q5_5
          Q2_4 ~~ Q5_6
          Q2_5 ~~ Q5_5
          Q2_5 ~~ Q5_6
          Q5_5 ~~ Q5_6
'
csek12one.mod1.fit <- lavaan::cfa(csek12one.mod1, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR")
summary(csek12one.mod1.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 141 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       127
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2504.201    1450.294
##   Degrees of freedom                               692         692
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.727
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.891       0.913
##   Tucker-Lewis Index (TLI)                       0.883       0.907
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.919
##   Robust Tucker-Lewis Index (TLI)                            0.914
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9354.323   -9354.323
##   Scaling correction factor                                  2.283
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               18962.646   18962.646
##   Bayesian (BIC)                             19432.177   19432.177
##   Sample-size adjusted Bayesian (SABIC)      19029.414   19029.414
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.094       0.061
##   90 Percent confidence interval - lower         0.090       0.057
##   90 Percent confidence interval - upper         0.098       0.064
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.079
##   90 Percent confidence interval - lower                     0.073
##   90 Percent confidence interval - upper                     0.085
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.406
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.033       0.033
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE =~                                                                
##     Q2_1              0.892    0.065   13.825    0.000    0.892    0.851
##     Q2_2              0.806    0.070   11.466    0.000    0.806    0.728
##     Q2_3              0.823    0.068   12.017    0.000    0.823    0.872
##     Q2_4              0.891    0.067   13.258    0.000    0.891    0.839
##     Q2_5              0.910    0.069   13.166    0.000    0.910    0.853
##     Q2_6              0.870    0.073   11.903    0.000    0.870    0.825
##     Q2_7              0.813    0.076   10.700    0.000    0.813    0.854
##     Q2_8              0.804    0.073   11.079    0.000    0.804    0.830
##     Q2_9              0.700    0.075    9.372    0.000    0.700    0.783
##     Q3_1              0.929    0.066   13.977    0.000    0.929    0.906
##     Q3_2              0.919    0.068   13.459    0.000    0.919    0.913
##     Q3_3              0.815    0.078   10.498    0.000    0.815    0.885
##     Q3_4              0.959    0.068   14.132    0.000    0.959    0.928
##     Q3_5              0.865    0.077   11.297    0.000    0.865    0.889
##     Q3_6              0.814    0.077   10.636    0.000    0.814    0.845
##     Q3_7              0.970    0.065   14.887    0.000    0.970    0.823
##     Q3_8              0.958    0.068   14.100    0.000    0.958    0.717
##     Q3_9              0.994    0.057   17.525    0.000    0.994    0.690
##     Q3_10             0.867    0.069   12.596    0.000    0.867    0.819
##     Q4_1              0.924    0.071   13.075    0.000    0.924    0.929
##     Q4_2              0.942    0.067   14.024    0.000    0.942    0.894
##     Q4_3              0.923    0.069   13.363    0.000    0.923    0.949
##     Q4_4              0.922    0.074   12.455    0.000    0.922    0.925
##     Q4_5              0.848    0.075   11.257    0.000    0.848    0.875
##     Q4_6              0.947    0.070   13.537    0.000    0.947    0.923
##     Q4_7              1.009    0.062   16.165    0.000    1.009    0.866
##     Q4_8              0.850    0.081   10.461    0.000    0.850    0.871
##     Q4_9              0.626    0.079    7.927    0.000    0.626    0.577
##     Q4_10             0.908    0.070   13.016    0.000    0.908    0.905
##     Q5_1              0.904    0.067   13.448    0.000    0.904    0.876
##     Q5_2              0.920    0.070   13.068    0.000    0.920    0.864
##     Q5_4              0.866    0.075   11.532    0.000    0.866    0.923
##     Q5_5              0.802    0.076   10.581    0.000    0.802    0.823
##     Q5_6              0.791    0.075   10.523    0.000    0.791    0.876
##     Q5_7              0.945    0.073   13.007    0.000    0.945    0.914
##     Q5_8              0.708    0.083    8.478    0.000    0.708    0.669
##     Q5_9              0.782    0.075   10.402    0.000    0.782    0.891
##     Q5_10             0.735    0.079    9.313    0.000    0.735    0.766
##     Q5_11             0.904    0.073   12.408    0.000    0.904    0.919
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .Q2_3 ~~                                                               
##    .Q2_4              0.069    0.035    1.980    0.048    0.069    0.258
##    .Q2_5              0.030    0.023    1.315    0.188    0.030    0.117
##    .Q5_5              0.012    0.021    0.550    0.582    0.012    0.045
##    .Q5_6              0.004    0.015    0.282    0.778    0.004    0.022
##  .Q2_4 ~~                                                               
##    .Q2_5              0.138    0.033    4.206    0.000    0.138    0.428
##    .Q5_5              0.016    0.023    0.713    0.476    0.016    0.051
##    .Q5_6             -0.033    0.015   -2.131    0.033   -0.033   -0.130
##  .Q2_5 ~~                                                               
##    .Q5_5              0.062    0.029    2.131    0.033    0.062    0.202
##    .Q5_6             -0.055    0.017   -3.181    0.001   -0.055   -0.226
##  .Q5_5 ~~                                                               
##    .Q5_6              0.001    0.019    0.066    0.947    0.001    0.005
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.079
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.829    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.985
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.261
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.222    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.303    0.000    4.490    4.658
##    .Q3_7              4.228    0.068   61.889    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.292    0.000    4.463    4.478
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.830    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.347    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.254    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.635    0.000    4.557    5.193
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.303    0.046    6.591    0.000    0.303    0.276
##    .Q2_2              0.575    0.078    7.379    0.000    0.575    0.470
##    .Q2_3              0.213    0.038    5.617    0.000    0.213    0.239
##    .Q2_4              0.335    0.052    6.434    0.000    0.335    0.296
##    .Q2_5              0.310    0.042    7.402    0.000    0.310    0.272
##    .Q2_6              0.356    0.080    4.467    0.000    0.356    0.320
##    .Q2_7              0.245    0.041    5.990    0.000    0.245    0.270
##    .Q2_8              0.293    0.040    7.259    0.000    0.293    0.312
##    .Q2_9              0.308    0.039    7.821    0.000    0.308    0.386
##    .Q3_1              0.188    0.056    3.381    0.001    0.188    0.179
##    .Q3_2              0.168    0.032    5.251    0.000    0.168    0.166
##    .Q3_3              0.183    0.051    3.629    0.000    0.183    0.216
##    .Q3_4              0.149    0.030    4.959    0.000    0.149    0.139
##    .Q3_5              0.199    0.043    4.580    0.000    0.199    0.210
##    .Q3_6              0.266    0.046    5.831    0.000    0.266    0.287
##    .Q3_7              0.450    0.078    5.759    0.000    0.450    0.323
##    .Q3_8              0.868    0.122    7.091    0.000    0.868    0.486
##    .Q3_9              1.089    0.119    9.176    0.000    1.089    0.524
##    .Q3_10             0.369    0.068    5.384    0.000    0.369    0.329
##    .Q4_1              0.135    0.034    3.979    0.000    0.135    0.136
##    .Q4_2              0.223    0.041    5.405    0.000    0.223    0.201
##    .Q4_3              0.094    0.016    5.858    0.000    0.094    0.099
##    .Q4_4              0.143    0.025    5.614    0.000    0.143    0.144
##    .Q4_5              0.221    0.035    6.409    0.000    0.221    0.235
##    .Q4_6              0.156    0.025    6.304    0.000    0.156    0.148
##    .Q4_7              0.339    0.057    5.954    0.000    0.339    0.250
##    .Q4_8              0.230    0.035    6.524    0.000    0.230    0.241
##    .Q4_9              0.784    0.100    7.815    0.000    0.784    0.667
##    .Q4_10             0.182    0.039    4.640    0.000    0.182    0.181
##    .Q5_1              0.247    0.040    6.158    0.000    0.247    0.232
##    .Q5_2              0.286    0.056    5.132    0.000    0.286    0.253
##    .Q5_4              0.130    0.024    5.504    0.000    0.130    0.148
##    .Q5_5              0.306    0.058    5.242    0.000    0.306    0.322
##    .Q5_6              0.189    0.031    6.055    0.000    0.189    0.232
##    .Q5_7              0.176    0.028    6.388    0.000    0.176    0.165
##    .Q5_8              0.616    0.105    5.858    0.000    0.616    0.552
##    .Q5_9              0.159    0.021    7.736    0.000    0.159    0.206
##    .Q5_10             0.380    0.054    7.083    0.000    0.380    0.413
##    .Q5_11             0.151    0.035    4.342    0.000    0.151    0.156
##     CSE               1.000                               1.000    1.000
anova(csek12one.fit, csek12one.mod1.fit) #sig reduction in model chi square
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod1.fit 692 18963 19432 2504.2                                  
## csek12one.fit      702 19051 19483 2612.2     51.881      10  1.201e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dynamic::cfaOne(csek12one.mod1.fit, plot = TRUE) #still does not meet dynamic fit indices
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI
## Level 1: 95/5  .017  NONE .993
## Level 1: 90/10   --  .024   --
## Level 2: 95/5  .018  .035 .983
## Level 2: 90/10   --    --   --
## Level 3: 95/5  .018  .045 .973
## Level 3: 90/10   --    --   --
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##    2504.201 692       0  0.033   0.094  0.891
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

## 
## [[2]]

## 
## [[3]]

#To further improve fit, covariance set 2 added to model:
csek12one.mod2 <- '
             CSE =~ Q2_1 + Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_1 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10 + Q4_1 + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_1 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11
        
          #covariances
          Q2_3 ~~ Q2_4
          Q2_3 ~~ Q2_5
          Q2_3 ~~ Q5_5
          Q2_3 ~~ Q5_6
          Q2_4 ~~ Q2_5
          Q2_4 ~~ Q5_5
          Q2_4 ~~ Q5_6
          Q2_5 ~~ Q5_5
          Q2_5 ~~ Q5_6
          Q5_5 ~~ Q5_6
          Q4_4 ~~ Q4_5
          Q4_4 ~~ Q4_6
          Q4_5 ~~ Q4_6
'
csek12one.mod2.fit <- lavaan::cfa(csek12one.mod2, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR")
summary(csek12one.mod2.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 153 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       130
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2437.184    1417.282
##   Degrees of freedom                               689         689
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.720
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.894       0.917
##   Tucker-Lewis Index (TLI)                       0.887       0.910
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.923
##   Robust Tucker-Lewis Index (TLI)                            0.917
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9320.815   -9320.815
##   Scaling correction factor                                  2.308
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               18901.629   18901.629
##   Bayesian (BIC)                             19382.251   19382.251
##   Sample-size adjusted Bayesian (SABIC)      18969.974   18969.974
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092       0.060
##   90 Percent confidence interval - lower         0.088       0.056
##   90 Percent confidence interval - upper         0.096       0.063
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.077
##   90 Percent confidence interval - lower                     0.072
##   90 Percent confidence interval - upper                     0.083
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.240
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.033       0.033
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE =~                                                                
##     Q2_1              0.893    0.064   13.872    0.000    0.893    0.852
##     Q2_2              0.809    0.070   11.524    0.000    0.809    0.731
##     Q2_3              0.823    0.069   12.017    0.000    0.823    0.872
##     Q2_4              0.891    0.067   13.220    0.000    0.891    0.838
##     Q2_5              0.908    0.069   13.118    0.000    0.908    0.851
##     Q2_6              0.868    0.073   11.884    0.000    0.868    0.824
##     Q2_7              0.812    0.076   10.701    0.000    0.812    0.854
##     Q2_8              0.804    0.073   11.095    0.000    0.804    0.830
##     Q2_9              0.701    0.075    9.402    0.000    0.701    0.785
##     Q3_1              0.931    0.066   14.035    0.000    0.931    0.908
##     Q3_2              0.919    0.068   13.467    0.000    0.919    0.913
##     Q3_3              0.816    0.078   10.515    0.000    0.816    0.886
##     Q3_4              0.961    0.068   14.174    0.000    0.961    0.929
##     Q3_5              0.865    0.076   11.317    0.000    0.865    0.889
##     Q3_6              0.816    0.076   10.681    0.000    0.816    0.846
##     Q3_7              0.969    0.065   14.859    0.000    0.969    0.822
##     Q3_8              0.959    0.068   14.103    0.000    0.959    0.717
##     Q3_9              0.996    0.057   17.585    0.000    0.996    0.691
##     Q3_10             0.868    0.069   12.634    0.000    0.868    0.820
##     Q4_1              0.924    0.071   13.093    0.000    0.924    0.930
##     Q4_2              0.942    0.067   14.035    0.000    0.942    0.894
##     Q4_3              0.924    0.069   13.375    0.000    0.924    0.949
##     Q4_4              0.919    0.074   12.387    0.000    0.919    0.921
##     Q4_5              0.842    0.076   11.148    0.000    0.842    0.868
##     Q4_6              0.943    0.070   13.435    0.000    0.943    0.919
##     Q4_7              1.009    0.062   16.159    0.000    1.009    0.866
##     Q4_8              0.849    0.081   10.437    0.000    0.849    0.870
##     Q4_9              0.627    0.079    7.925    0.000    0.627    0.578
##     Q4_10             0.908    0.070   13.049    0.000    0.908    0.906
##     Q5_1              0.904    0.067   13.454    0.000    0.904    0.876
##     Q5_2              0.920    0.070   13.071    0.000    0.920    0.864
##     Q5_4              0.866    0.075   11.529    0.000    0.866    0.923
##     Q5_5              0.800    0.076   10.555    0.000    0.800    0.822
##     Q5_6              0.792    0.075   10.528    0.000    0.792    0.878
##     Q5_7              0.944    0.073   12.971    0.000    0.944    0.913
##     Q5_8              0.709    0.083    8.506    0.000    0.709    0.671
##     Q5_9              0.782    0.075   10.406    0.000    0.782    0.891
##     Q5_10             0.736    0.079    9.342    0.000    0.736    0.767
##     Q5_11             0.904    0.073   12.422    0.000    0.904    0.919
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .Q2_3 ~~                                                               
##    .Q2_4              0.069    0.035    1.997    0.046    0.069    0.258
##    .Q2_5              0.032    0.023    1.368    0.171    0.032    0.122
##    .Q5_5              0.013    0.021    0.602    0.547    0.013    0.049
##    .Q5_6              0.003    0.015    0.219    0.827    0.003    0.017
##  .Q2_4 ~~                                                               
##    .Q2_5              0.140    0.033    4.238    0.000    0.140    0.432
##    .Q5_5              0.018    0.023    0.775    0.438    0.018    0.056
##    .Q5_6             -0.033    0.015   -2.215    0.027   -0.033   -0.133
##  .Q2_5 ~~                                                               
##    .Q5_5              0.065    0.029    2.213    0.027    0.065    0.209
##    .Q5_6             -0.054    0.017   -3.136    0.002   -0.054   -0.223
##  .Q5_5 ~~                                                               
##    .Q5_6              0.002    0.020    0.083    0.934    0.002    0.007
##  .Q4_4 ~~                                                               
##    .Q4_5              0.060    0.022    2.755    0.006    0.060    0.323
##    .Q4_6              0.040    0.017    2.311    0.021    0.040    0.253
##  .Q4_5 ~~                                                               
##    .Q4_6              0.064    0.021    3.121    0.002    0.064    0.331
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.078
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.830    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q3_2              4.403    0.058   75.538    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.222    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.320    0.000    4.490    4.658
##    .Q3_7              4.228    0.068   61.889    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.293    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.831    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.348    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.255    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.636    0.000    4.557    5.192
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.300    0.046    6.543    0.000    0.300    0.273
##    .Q2_2              0.571    0.078    7.368    0.000    0.571    0.466
##    .Q2_3              0.213    0.038    5.654    0.000    0.213    0.239
##    .Q2_4              0.335    0.052    6.455    0.000    0.335    0.297
##    .Q2_5              0.313    0.042    7.438    0.000    0.313    0.275
##    .Q2_6              0.358    0.080    4.488    0.000    0.358    0.322
##    .Q2_7              0.246    0.041    6.004    0.000    0.246    0.271
##    .Q2_8              0.292    0.040    7.220    0.000    0.292    0.311
##    .Q2_9              0.306    0.039    7.831    0.000    0.306    0.384
##    .Q3_1              0.185    0.055    3.354    0.001    0.185    0.176
##    .Q3_2              0.168    0.032    5.302    0.000    0.168    0.166
##    .Q3_3              0.182    0.050    3.603    0.000    0.182    0.215
##    .Q3_4              0.146    0.029    5.001    0.000    0.146    0.136
##    .Q3_5              0.198    0.043    4.581    0.000    0.198    0.209
##    .Q3_6              0.263    0.045    5.862    0.000    0.263    0.284
##    .Q3_7              0.451    0.078    5.770    0.000    0.451    0.325
##    .Q3_8              0.868    0.123    7.074    0.000    0.868    0.486
##    .Q3_9              1.084    0.119    9.131    0.000    1.084    0.522
##    .Q3_10             0.366    0.068    5.361    0.000    0.366    0.327
##    .Q4_1              0.134    0.034    3.978    0.000    0.134    0.136
##    .Q4_2              0.224    0.041    5.409    0.000    0.224    0.202
##    .Q4_3              0.093    0.016    5.907    0.000    0.093    0.099
##    .Q4_4              0.150    0.026    5.664    0.000    0.150    0.151
##    .Q4_5              0.232    0.036    6.436    0.000    0.232    0.246
##    .Q4_6              0.164    0.025    6.486    0.000    0.164    0.155
##    .Q4_7              0.340    0.057    5.968    0.000    0.340    0.251
##    .Q4_8              0.232    0.035    6.572    0.000    0.232    0.243
##    .Q4_9              0.784    0.100    7.812    0.000    0.784    0.666
##    .Q4_10             0.181    0.039    4.652    0.000    0.181    0.180
##    .Q5_1              0.248    0.040    6.173    0.000    0.248    0.233
##    .Q5_2              0.286    0.055    5.170    0.000    0.286    0.253
##    .Q5_4              0.131    0.024    5.512    0.000    0.131    0.149
##    .Q5_5              0.308    0.058    5.298    0.000    0.308    0.325
##    .Q5_6              0.187    0.031    6.065    0.000    0.187    0.230
##    .Q5_7              0.179    0.028    6.416    0.000    0.179    0.167
##    .Q5_8              0.615    0.105    5.851    0.000    0.615    0.550
##    .Q5_9              0.159    0.020    7.782    0.000    0.159    0.206
##    .Q5_10             0.379    0.053    7.100    0.000    0.379    0.412
##    .Q5_11             0.150    0.035    4.332    0.000    0.150    0.155
##     CSE               1.000                               1.000    1.000
anova(csek12one.mod1.fit, csek12one.mod2.fit) #sig reduction in model chi
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod2.fit 689 18902 19382 2437.2                                  
## csek12one.mod1.fit 692 18963 19432 2504.2     20.006       3  0.0001692 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dynamic::cfaOne(csek12one.mod2.fit, plot = TRUE) #still does not meet dynamic fit indices
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI
## Level 1: 95/5  .017  .023 .993
## Level 1: 90/10   --    --   --
## Level 2: 95/5  .017  .033 .985
## Level 2: 90/10   --    --   --
## Level 3: 95/5  .018  .042 .977
## Level 3: 90/10   --    --   --
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##    2437.184 689       0  0.033   0.092  0.894
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

## 
## [[2]]

## 
## [[3]]

#To further improve fit, covariance set 3 added to model:
csek12one.mod3 <- '
             CSE =~ Q2_1 + Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_1 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10 + Q4_1 + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_1 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11
        
          #covariances
          Q2_3 ~~ Q2_4
          Q2_3 ~~ Q2_5
          Q2_3 ~~ Q5_5
          Q2_3 ~~ Q5_6
          Q2_4 ~~ Q2_5
          Q2_4 ~~ Q5_5
          Q2_4 ~~ Q5_6
          Q2_5 ~~ Q5_5
          Q2_5 ~~ Q5_6
          Q5_5 ~~ Q5_6
          Q4_4 ~~ Q4_5
          Q4_4 ~~ Q4_6
          Q4_5 ~~ Q4_6
          Q4_7 ~~ Q4_8
'
csek12one.mod3.fit <- lavaan::cfa(csek12one.mod3, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR")
summary(csek12one.mod3.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 154 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       131
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2435.540    1416.891
##   Degrees of freedom                               688         688
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.719
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.895       0.917
##   Tucker-Lewis Index (TLI)                       0.886       0.910
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.923
##   Robust Tucker-Lewis Index (TLI)                            0.917
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9319.993   -9319.993
##   Scaling correction factor                                  2.307
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               18901.986   18901.986
##   Bayesian (BIC)                             19386.305   19386.305
##   Sample-size adjusted Bayesian (SABIC)      18970.856   18970.856
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092       0.060
##   90 Percent confidence interval - lower         0.088       0.056
##   90 Percent confidence interval - upper         0.096       0.063
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.077
##   90 Percent confidence interval - lower                     0.072
##   90 Percent confidence interval - upper                     0.083
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.245
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.033       0.033
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE =~                                                                
##     Q2_1              0.894    0.064   13.878    0.000    0.894    0.852
##     Q2_2              0.809    0.070   11.533    0.000    0.809    0.731
##     Q2_3              0.823    0.069   12.013    0.000    0.823    0.872
##     Q2_4              0.891    0.067   13.221    0.000    0.891    0.838
##     Q2_5              0.908    0.069   13.117    0.000    0.908    0.851
##     Q2_6              0.868    0.073   11.886    0.000    0.868    0.824
##     Q2_7              0.812    0.076   10.699    0.000    0.812    0.854
##     Q2_8              0.804    0.073   11.096    0.000    0.804    0.830
##     Q2_9              0.701    0.075    9.407    0.000    0.701    0.785
##     Q3_1              0.931    0.066   14.038    0.000    0.931    0.908
##     Q3_2              0.919    0.068   13.473    0.000    0.919    0.913
##     Q3_3              0.816    0.078   10.517    0.000    0.816    0.886
##     Q3_4              0.961    0.068   14.178    0.000    0.961    0.929
##     Q3_5              0.865    0.076   11.316    0.000    0.865    0.889
##     Q3_6              0.816    0.076   10.678    0.000    0.816    0.846
##     Q3_7              0.969    0.065   14.857    0.000    0.969    0.822
##     Q3_8              0.958    0.068   14.104    0.000    0.958    0.717
##     Q3_9              0.996    0.057   17.585    0.000    0.996    0.691
##     Q3_10             0.868    0.069   12.640    0.000    0.868    0.821
##     Q4_1              0.924    0.071   13.094    0.000    0.924    0.930
##     Q4_2              0.942    0.067   14.038    0.000    0.942    0.894
##     Q4_3              0.924    0.069   13.378    0.000    0.924    0.949
##     Q4_4              0.918    0.074   12.384    0.000    0.918    0.921
##     Q4_5              0.842    0.076   11.146    0.000    0.842    0.868
##     Q4_6              0.943    0.070   13.434    0.000    0.943    0.919
##     Q4_7              1.008    0.062   16.132    0.000    1.008    0.865
##     Q4_8              0.849    0.081   10.432    0.000    0.849    0.869
##     Q4_9              0.627    0.079    7.928    0.000    0.627    0.578
##     Q4_10             0.908    0.070   13.051    0.000    0.908    0.906
##     Q5_1              0.903    0.067   13.449    0.000    0.903    0.876
##     Q5_2              0.920    0.070   13.074    0.000    0.920    0.865
##     Q5_4              0.866    0.075   11.530    0.000    0.866    0.923
##     Q5_5              0.800    0.076   10.555    0.000    0.800    0.822
##     Q5_6              0.791    0.075   10.526    0.000    0.791    0.877
##     Q5_7              0.944    0.073   12.971    0.000    0.944    0.913
##     Q5_8              0.709    0.083    8.506    0.000    0.709    0.671
##     Q5_9              0.782    0.075   10.405    0.000    0.782    0.891
##     Q5_10             0.736    0.079    9.345    0.000    0.736    0.767
##     Q5_11             0.904    0.073   12.424    0.000    0.904    0.919
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .Q2_3 ~~                                                               
##    .Q2_4              0.069    0.035    1.999    0.046    0.069    0.258
##    .Q2_5              0.032    0.023    1.373    0.170    0.032    0.122
##    .Q5_5              0.013    0.021    0.603    0.546    0.013    0.049
##    .Q5_6              0.004    0.015    0.230    0.818    0.004    0.018
##  .Q2_4 ~~                                                               
##    .Q2_5              0.140    0.033    4.237    0.000    0.140    0.432
##    .Q5_5              0.018    0.023    0.774    0.439    0.018    0.056
##    .Q5_6             -0.033    0.015   -2.202    0.028   -0.033   -0.133
##  .Q2_5 ~~                                                               
##    .Q5_5              0.065    0.029    2.210    0.027    0.065    0.209
##    .Q5_6             -0.054    0.017   -3.134    0.002   -0.054   -0.222
##  .Q5_5 ~~                                                               
##    .Q5_6              0.002    0.019    0.088    0.929    0.002    0.007
##  .Q4_4 ~~                                                               
##    .Q4_5              0.060    0.022    2.759    0.006    0.060    0.323
##    .Q4_6              0.040    0.017    2.314    0.021    0.040    0.253
##  .Q4_5 ~~                                                               
##    .Q4_6              0.065    0.021    3.127    0.002    0.065    0.331
##  .Q4_7 ~~                                                               
##    .Q4_8              0.021    0.025    0.853    0.394    0.021    0.076
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.078
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.830    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.221    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.321    0.000    4.490    4.658
##    .Q3_7              4.228    0.068   61.889    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.292    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.831    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.347    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.254    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.635    0.000    4.557    5.192
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.300    0.046    6.552    0.000    0.300    0.273
##    .Q2_2              0.571    0.078    7.363    0.000    0.571    0.466
##    .Q2_3              0.213    0.038    5.661    0.000    0.213    0.239
##    .Q2_4              0.335    0.052    6.455    0.000    0.335    0.297
##    .Q2_5              0.313    0.042    7.435    0.000    0.313    0.275
##    .Q2_6              0.358    0.080    4.489    0.000    0.358    0.322
##    .Q2_7              0.246    0.041    6.002    0.000    0.246    0.271
##    .Q2_8              0.291    0.040    7.217    0.000    0.291    0.310
##    .Q2_9              0.306    0.039    7.828    0.000    0.306    0.384
##    .Q3_1              0.185    0.055    3.353    0.001    0.185    0.176
##    .Q3_2              0.168    0.032    5.307    0.000    0.168    0.166
##    .Q3_3              0.182    0.050    3.599    0.000    0.182    0.214
##    .Q3_4              0.146    0.029    5.000    0.000    0.146    0.136
##    .Q3_5              0.198    0.043    4.580    0.000    0.198    0.209
##    .Q3_6              0.264    0.045    5.864    0.000    0.264    0.284
##    .Q3_7              0.452    0.078    5.770    0.000    0.452    0.325
##    .Q3_8              0.868    0.123    7.074    0.000    0.868    0.486
##    .Q3_9              1.085    0.119    9.130    0.000    1.085    0.522
##    .Q3_10             0.366    0.068    5.356    0.000    0.366    0.327
##    .Q4_1              0.134    0.034    3.977    0.000    0.134    0.136
##    .Q4_2              0.224    0.041    5.408    0.000    0.224    0.201
##    .Q4_3              0.093    0.016    5.912    0.000    0.093    0.099
##    .Q4_4              0.150    0.027    5.660    0.000    0.150    0.151
##    .Q4_5              0.232    0.036    6.432    0.000    0.232    0.247
##    .Q4_6              0.164    0.025    6.496    0.000    0.164    0.155
##    .Q4_7              0.342    0.057    6.000    0.000    0.342    0.252
##    .Q4_8              0.233    0.036    6.523    0.000    0.233    0.244
##    .Q4_9              0.783    0.100    7.810    0.000    0.783    0.666
##    .Q4_10             0.181    0.039    4.652    0.000    0.181    0.180
##    .Q5_1              0.248    0.040    6.175    0.000    0.248    0.233
##    .Q5_2              0.286    0.055    5.174    0.000    0.286    0.253
##    .Q5_4              0.131    0.024    5.514    0.000    0.131    0.149
##    .Q5_5              0.308    0.058    5.291    0.000    0.308    0.325
##    .Q5_6              0.187    0.031    6.052    0.000    0.187    0.230
##    .Q5_7              0.179    0.028    6.406    0.000    0.179    0.167
##    .Q5_8              0.615    0.105    5.851    0.000    0.615    0.550
##    .Q5_9              0.159    0.020    7.785    0.000    0.159    0.206
##    .Q5_10             0.379    0.053    7.093    0.000    0.379    0.412
##    .Q5_11             0.150    0.035    4.329    0.000    0.150    0.155
##     CSE               1.000                               1.000    1.000
anova(csek12one.mod2.fit, csek12one.mod3.fit) #non-significant reduction in model chi sq
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)
## csek12one.mod3.fit 688 18902 19386 2435.5                              
## csek12one.mod2.fit 689 18902 19382 2437.2    0.75022       1     0.3864
dynamic::cfaOne(csek12one.mod3.fit, plot = TRUE) #still does not meet dynamic fit indices
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI
## Level 1: 95/5  NONE  NONE NONE
## Level 1: 90/10 .017  .021 .994
## Level 2: 95/5  .017  .031 .987
## Level 2: 90/10   --    --   --
## Level 3: 95/5  .018   .04 .978
## Level 3: 90/10   --    --   --
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##     2435.54 688       0  0.033   0.092  0.895
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

## 
## [[2]]

## 
## [[3]]

#To improve model fit, covariance set 4 added to model:
csek12one.mod4 <- '
             CSE =~ Q2_1 + Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_1 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10 + Q4_1 + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_1 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11
        
          #covariances
          Q2_3 ~~ Q2_4
          Q2_3 ~~ Q2_5
          Q2_3 ~~ Q5_5
          Q2_3 ~~ Q5_6
          Q2_4 ~~ Q2_5
          Q2_4 ~~ Q5_5
          Q2_4 ~~ Q5_6
          Q2_5 ~~ Q5_5
          Q2_5 ~~ Q5_6
          Q5_5 ~~ Q5_6
          Q4_4 ~~ Q4_5
          Q4_4 ~~ Q4_6
          Q4_5 ~~ Q4_6
          Q4_7 ~~ Q4_8
          Q2_8 ~~ Q2_9
'
csek12one.mod4.fit <- lavaan::cfa(csek12one.mod4, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR")

anova(csek12one.fit, csek12one.mod4.fit) #sig reduction in model chi from one factor w/ no covariances
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod4.fit 687 18833 19321 2364.0                                  
## csek12one.fit      702 19051 19483 2612.2     105.88      15  9.932e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(csek12one.mod1.fit, csek12one.mod4.fit) #sig reduction in model chi from one factor + set 1
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod4.fit 687 18833 19321 2364.0                                  
## csek12one.mod1.fit 692 18963 19432 2504.2     48.865       5  2.365e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(csek12one.mod2.fit, csek12one.mod4.fit) #sig reduction in model chi from one factor + set 1 & 2
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod4.fit 687 18833 19321 2364.0                                  
## csek12one.mod2.fit 689 18902 19382 2437.2     34.081       2  3.975e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(csek12one.mod3.fit, csek12one.mod4.fit) #sig reduction in model chi from one factor + set 1, 2, and 3
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                     Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## csek12one.mod4.fit 687 18833 19321 2364.0                                  
## csek12one.mod3.fit 688 18902 19386 2435.5     34.023       1  5.447e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dynamic::cfaOne(csek12one.mod4.fit, plot = TRUE)
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI
## Level 1: 95/5  NONE  NONE NONE
## Level 1: 90/10 .017  .021 .994
## Level 2: 95/5  .017  .029 .989
## Level 2: 90/10   --    --   --
## Level 3: 95/5  .017  .039  .98
## Level 3: 90/10   --    --   --
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##    2364.038 687       0  0.032   0.091  0.899
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

## 
## [[2]]

## 
## [[3]]

summary(csek12one.mod4.fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE) #doesn't meet fit criteria from dynamic fit indices
## lavaan 0.6-18 ended normally after 148 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       132
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2364.038    1375.739
##   Degrees of freedom                               687         687
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.718
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.899       0.921
##   Tucker-Lewis Index (TLI)                       0.891       0.915
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.927
##   Robust Tucker-Lewis Index (TLI)                            0.922
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9284.241   -9284.241
##   Scaling correction factor                                  2.305
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               18832.483   18832.483
##   Bayesian (BIC)                             19320.499   19320.499
##   Sample-size adjusted Bayesian (SABIC)      18901.879   18901.879
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.091       0.058
##   90 Percent confidence interval - lower         0.087       0.055
##   90 Percent confidence interval - upper         0.095       0.061
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.075
##   90 Percent confidence interval - lower                     0.069
##   90 Percent confidence interval - upper                     0.081
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.099
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.032       0.032
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE =~                                                                
##     Q2_1              0.893    0.064   13.860    0.000    0.893    0.852
##     Q2_2              0.808    0.070   11.508    0.000    0.808    0.730
##     Q2_3              0.823    0.069   12.010    0.000    0.823    0.872
##     Q2_4              0.890    0.067   13.199    0.000    0.890    0.838
##     Q2_5              0.908    0.069   13.100    0.000    0.908    0.851
##     Q2_6              0.869    0.073   11.881    0.000    0.869    0.824
##     Q2_7              0.812    0.076   10.692    0.000    0.812    0.853
##     Q2_8              0.802    0.073   11.026    0.000    0.802    0.828
##     Q2_9              0.698    0.075    9.343    0.000    0.698    0.781
##     Q3_1              0.931    0.066   14.041    0.000    0.931    0.908
##     Q3_2              0.919    0.068   13.473    0.000    0.919    0.914
##     Q3_3              0.815    0.078   10.508    0.000    0.815    0.886
##     Q3_4              0.961    0.068   14.170    0.000    0.961    0.929
##     Q3_5              0.865    0.076   11.324    0.000    0.865    0.890
##     Q3_6              0.816    0.076   10.678    0.000    0.816    0.846
##     Q3_7              0.970    0.065   14.870    0.000    0.970    0.822
##     Q3_8              0.959    0.068   14.114    0.000    0.959    0.718
##     Q3_9              0.997    0.057   17.580    0.000    0.997    0.692
##     Q3_10             0.867    0.069   12.603    0.000    0.867    0.820
##     Q4_1              0.925    0.071   13.093    0.000    0.925    0.930
##     Q4_2              0.942    0.067   14.027    0.000    0.942    0.894
##     Q4_3              0.924    0.069   13.385    0.000    0.924    0.950
##     Q4_4              0.919    0.074   12.388    0.000    0.919    0.922
##     Q4_5              0.842    0.076   11.140    0.000    0.842    0.868
##     Q4_6              0.944    0.070   13.438    0.000    0.944    0.919
##     Q4_7              1.009    0.063   16.134    0.000    1.009    0.866
##     Q4_8              0.849    0.081   10.435    0.000    0.849    0.870
##     Q4_9              0.625    0.079    7.906    0.000    0.625    0.577
##     Q4_10             0.908    0.070   13.039    0.000    0.908    0.905
##     Q5_1              0.904    0.067   13.446    0.000    0.904    0.876
##     Q5_2              0.920    0.070   13.078    0.000    0.920    0.865
##     Q5_4              0.866    0.075   11.536    0.000    0.866    0.923
##     Q5_5              0.800    0.076   10.535    0.000    0.800    0.821
##     Q5_6              0.792    0.075   10.531    0.000    0.792    0.878
##     Q5_7              0.944    0.073   12.965    0.000    0.944    0.913
##     Q5_8              0.708    0.083    8.480    0.000    0.708    0.670
##     Q5_9              0.782    0.075   10.406    0.000    0.782    0.891
##     Q5_10             0.734    0.079    9.300    0.000    0.734    0.765
##     Q5_11             0.904    0.073   12.418    0.000    0.904    0.919
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .Q2_3 ~~                                                               
##    .Q2_4              0.070    0.035    2.012    0.044    0.070    0.260
##    .Q2_5              0.032    0.023    1.387    0.165    0.032    0.123
##    .Q5_5              0.013    0.021    0.634    0.526    0.013    0.052
##    .Q5_6              0.003    0.015    0.226    0.822    0.003    0.017
##  .Q2_4 ~~                                                               
##    .Q2_5              0.140    0.033    4.247    0.000    0.140    0.433
##    .Q5_5              0.019    0.023    0.812    0.417    0.019    0.059
##    .Q5_6             -0.033    0.015   -2.195    0.028   -0.033   -0.132
##  .Q2_5 ~~                                                               
##    .Q5_5              0.066    0.029    2.231    0.026    0.066    0.211
##    .Q5_6             -0.054    0.017   -3.129    0.002   -0.054   -0.222
##  .Q5_5 ~~                                                               
##    .Q5_6              0.002    0.019    0.106    0.916    0.002    0.009
##  .Q4_4 ~~                                                               
##    .Q4_5              0.060    0.022    2.752    0.006    0.060    0.322
##    .Q4_6              0.039    0.017    2.271    0.023    0.039    0.249
##  .Q4_5 ~~                                                               
##    .Q4_6              0.064    0.021    3.106    0.002    0.064    0.330
##  .Q4_7 ~~                                                               
##    .Q4_8              0.021    0.025    0.820    0.412    0.021    0.073
##  .Q2_8 ~~                                                               
##    .Q2_9              0.141    0.032    4.384    0.000    0.141    0.466
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.078
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.830    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.222    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.139    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.326    0.000    4.490    4.659
##    .Q3_7              4.228    0.068   61.890    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.293    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.831    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.348    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.255    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.636    0.000    4.557    5.192
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.300    0.046    6.555    0.000    0.300    0.273
##    .Q2_2              0.572    0.078    7.372    0.000    0.572    0.467
##    .Q2_3              0.213    0.038    5.664    0.000    0.213    0.240
##    .Q2_4              0.336    0.052    6.446    0.000    0.336    0.298
##    .Q2_5              0.314    0.042    7.453    0.000    0.314    0.276
##    .Q2_6              0.358    0.080    4.488    0.000    0.358    0.322
##    .Q2_7              0.246    0.041    5.997    0.000    0.246    0.272
##    .Q2_8              0.296    0.041    7.261    0.000    0.296    0.315
##    .Q2_9              0.311    0.039    7.878    0.000    0.311    0.389
##    .Q3_1              0.185    0.055    3.347    0.001    0.185    0.175
##    .Q3_2              0.167    0.032    5.287    0.000    0.167    0.165
##    .Q3_3              0.182    0.051    3.597    0.000    0.182    0.215
##    .Q3_4              0.146    0.029    4.986    0.000    0.146    0.136
##    .Q3_5              0.197    0.043    4.567    0.000    0.197    0.209
##    .Q3_6              0.263    0.045    5.871    0.000    0.263    0.284
##    .Q3_7              0.450    0.078    5.764    0.000    0.450    0.324
##    .Q3_8              0.866    0.123    7.062    0.000    0.866    0.485
##    .Q3_9              1.083    0.119    9.123    0.000    1.083    0.522
##    .Q3_10             0.367    0.068    5.367    0.000    0.367    0.328
##    .Q4_1              0.134    0.034    3.962    0.000    0.134    0.135
##    .Q4_2              0.224    0.042    5.394    0.000    0.224    0.201
##    .Q4_3              0.093    0.016    5.878    0.000    0.093    0.098
##    .Q4_4              0.149    0.026    5.659    0.000    0.149    0.150
##    .Q4_5              0.232    0.036    6.416    0.000    0.232    0.247
##    .Q4_6              0.163    0.025    6.490    0.000    0.163    0.155
##    .Q4_7              0.340    0.057    6.006    0.000    0.340    0.251
##    .Q4_8              0.232    0.036    6.524    0.000    0.232    0.244
##    .Q4_9              0.785    0.100    7.831    0.000    0.785    0.667
##    .Q4_10             0.181    0.039    4.643    0.000    0.181    0.180
##    .Q5_1              0.247    0.040    6.177    0.000    0.247    0.233
##    .Q5_2              0.286    0.055    5.155    0.000    0.286    0.252
##    .Q5_4              0.130    0.024    5.494    0.000    0.130    0.148
##    .Q5_5              0.309    0.058    5.288    0.000    0.309    0.326
##    .Q5_6              0.187    0.031    6.040    0.000    0.187    0.230
##    .Q5_7              0.179    0.028    6.378    0.000    0.179    0.167
##    .Q5_8              0.616    0.105    5.845    0.000    0.616    0.552
##    .Q5_9              0.159    0.020    7.770    0.000    0.159    0.206
##    .Q5_10             0.382    0.054    7.107    0.000    0.382    0.415
##    .Q5_11             0.151    0.035    4.338    0.000    0.151    0.156
##     CSE               1.000                               1.000    1.000
## 
## R-Square:
##                    Estimate
##     Q2_1              0.727
##     Q2_2              0.533
##     Q2_3              0.760
##     Q2_4              0.702
##     Q2_5              0.724
##     Q2_6              0.678
##     Q2_7              0.728
##     Q2_8              0.685
##     Q2_9              0.611
##     Q3_1              0.825
##     Q3_2              0.835
##     Q3_3              0.785
##     Q3_4              0.864
##     Q3_5              0.791
##     Q3_6              0.716
##     Q3_7              0.676
##     Q3_8              0.515
##     Q3_9              0.478
##     Q3_10             0.672
##     Q4_1              0.865
##     Q4_2              0.799
##     Q4_3              0.902
##     Q4_4              0.850
##     Q4_5              0.753
##     Q4_6              0.845
##     Q4_7              0.749
##     Q4_8              0.756
##     Q4_9              0.333
##     Q4_10             0.820
##     Q5_1              0.767
##     Q5_2              0.748
##     Q5_4              0.852
##     Q5_5              0.674
##     Q5_6              0.770
##     Q5_7              0.833
##     Q5_8              0.448
##     Q5_9              0.794
##     Q5_10             0.585
##     Q5_11             0.844
#reliability
library(semTools)
## Warning: package 'semTools' was built under R version 4.3.2
## 
## ###############################################################################
## This is semTools 0.5-6
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
## 
## Attaching package: 'semTools'
## The following object is masked from 'package:misty':
## 
##     kurtosis
## The following objects are masked from 'package:psych':
## 
##     reliability, skew
reliability(csek12one.mod4.fit) #alpha = .99, omega = .99
##              CSE
## alpha  0.9894747
## omega  0.9886085
## omega2 0.9886085
## omega3 0.9865499
## avevar 0.7112986
csek12two <- '
            CSE1 =~  Q2_2 + Q2_3 + Q2_4 + Q2_5 + Q2_6 + Q2_7 + Q2_8 + Q2_9 + Q3_2 + Q3_3 + Q3_4 + Q3_5 + Q3_6 + Q3_7 + Q3_8 + Q3_9 + Q3_10  + Q4_2 + Q4_3 + Q4_4 + Q4_5 + Q4_6 + Q4_7 + Q4_8 + Q4_9 + Q4_10 + Q5_2 + Q5_4 + Q5_5 + Q5_6 + Q5_7 + Q5_8 + Q5_9 + Q5_10 + Q5_11
            CSE2 =~ Q2_1 + Q3_1 + Q4_1 + Q5_1'

csek12two.fit <- lavaan::cfa(csek12two, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR")
summary(csek12two.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 143 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       118
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2610.981    1508.295
##   Degrees of freedom                               701         701
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.731
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.885       0.908
##   Tucker-Lewis Index (TLI)                       0.878       0.902
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.914
##   Robust Tucker-Lewis Index (TLI)                            0.909
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9407.713   -9407.713
##   Scaling correction factor                                  2.299
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               19051.426   19051.426
##   Bayesian (BIC)                             19487.683   19487.683
##   Sample-size adjusted Bayesian (SABIC)      19113.462   19113.462
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.096       0.062
##   90 Percent confidence interval - lower         0.092       0.059
##   90 Percent confidence interval - upper         0.100       0.065
##   P-value H_0: RMSEA <= 0.050                    0.000       0.000
##   P-value H_0: RMSEA >= 0.080                    1.000       0.000
##                                                                   
##   Robust RMSEA                                               0.081
##   90 Percent confidence interval - lower                     0.076
##   90 Percent confidence interval - upper                     0.087
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.647
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.033       0.033
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE1 =~                                                               
##     Q2_2              0.806    0.070   11.485    0.000    0.806    0.729
##     Q2_3              0.826    0.068   12.085    0.000    0.826    0.875
##     Q2_4              0.896    0.067   13.401    0.000    0.896    0.843
##     Q2_5              0.913    0.069   13.288    0.000    0.913    0.856
##     Q2_6              0.871    0.073   11.950    0.000    0.871    0.826
##     Q2_7              0.813    0.076   10.696    0.000    0.813    0.854
##     Q2_8              0.805    0.072   11.103    0.000    0.805    0.831
##     Q2_9              0.701    0.075    9.391    0.000    0.701    0.784
##     Q3_2              0.918    0.068   13.446    0.000    0.918    0.913
##     Q3_3              0.815    0.078   10.502    0.000    0.815    0.885
##     Q3_4              0.959    0.068   14.111    0.000    0.959    0.927
##     Q3_5              0.864    0.077   11.292    0.000    0.864    0.889
##     Q3_6              0.813    0.077   10.614    0.000    0.813    0.843
##     Q3_7              0.971    0.065   14.905    0.000    0.971    0.823
##     Q3_8              0.959    0.068   14.119    0.000    0.959    0.717
##     Q3_9              0.996    0.057   17.596    0.000    0.996    0.691
##     Q3_10             0.867    0.069   12.592    0.000    0.867    0.819
##     Q4_2              0.942    0.067   14.025    0.000    0.942    0.894
##     Q4_3              0.923    0.069   13.344    0.000    0.923    0.949
##     Q4_4              0.923    0.074   12.466    0.000    0.923    0.925
##     Q4_5              0.850    0.075   11.284    0.000    0.850    0.876
##     Q4_6              0.948    0.070   13.548    0.000    0.948    0.923
##     Q4_7              1.009    0.062   16.175    0.000    1.009    0.866
##     Q4_8              0.850    0.081   10.455    0.000    0.850    0.870
##     Q4_9              0.626    0.079    7.930    0.000    0.626    0.578
##     Q4_10             0.907    0.070   12.997    0.000    0.907    0.904
##     Q5_2              0.919    0.070   13.046    0.000    0.919    0.864
##     Q5_4              0.866    0.075   11.515    0.000    0.866    0.923
##     Q5_5              0.804    0.075   10.655    0.000    0.804    0.826
##     Q5_6              0.789    0.075   10.481    0.000    0.789    0.874
##     Q5_7              0.945    0.073   13.005    0.000    0.945    0.914
##     Q5_8              0.708    0.083    8.490    0.000    0.708    0.670
##     Q5_9              0.782    0.075   10.405    0.000    0.782    0.891
##     Q5_10             0.735    0.079    9.315    0.000    0.735    0.766
##     Q5_11             0.904    0.073   12.408    0.000    0.904    0.919
##   CSE2 =~                                                               
##     Q2_1              0.896    0.065   13.875    0.000    0.896    0.855
##     Q3_1              0.931    0.067   13.993    0.000    0.931    0.908
##     Q4_1              0.926    0.071   13.098    0.000    0.926    0.932
##     Q5_1              0.906    0.067   13.458    0.000    0.906    0.879
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CSE1 ~~                                                               
##     CSE2              0.996    0.005  210.669    0.000    0.996    0.996
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.830    0.000    4.456    4.682
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q3_4              4.386    0.060   73.221    0.000    4.386    4.242
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.490    0.056   80.298    0.000    4.490    4.658
##    .Q3_7              4.228    0.068   61.889    0.000    4.228    3.585
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q4_4              4.463    0.058   77.292    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q4_10             4.406    0.058   75.823    0.000    4.406    4.392
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q5_4              4.503    0.054   82.831    0.000    4.503    4.798
##    .Q5_5              4.419    0.056   78.347    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.255    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.635    0.000    4.557    5.192
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.078
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_2              0.575    0.078    7.388    0.000    0.575    0.469
##    .Q2_3              0.209    0.037    5.689    0.000    0.209    0.235
##    .Q2_4              0.326    0.051    6.447    0.000    0.326    0.289
##    .Q2_5              0.304    0.041    7.347    0.000    0.304    0.267
##    .Q2_6              0.354    0.079    4.490    0.000    0.354    0.318
##    .Q2_7              0.245    0.041    5.980    0.000    0.245    0.270
##    .Q2_8              0.291    0.040    7.243    0.000    0.291    0.310
##    .Q2_9              0.307    0.039    7.796    0.000    0.307    0.385
##    .Q3_2              0.169    0.032    5.261    0.000    0.169    0.167
##    .Q3_3              0.183    0.050    3.634    0.000    0.183    0.216
##    .Q3_4              0.150    0.030    4.981    0.000    0.150    0.140
##    .Q3_5              0.199    0.043    4.602    0.000    0.199    0.210
##    .Q3_6              0.268    0.046    5.812    0.000    0.268    0.289
##    .Q3_7              0.449    0.078    5.734    0.000    0.449    0.323
##    .Q3_8              0.867    0.122    7.110    0.000    0.867    0.485
##    .Q3_9              1.086    0.118    9.187    0.000    1.086    0.523
##    .Q3_10             0.368    0.069    5.374    0.000    0.368    0.329
##    .Q4_2              0.223    0.041    5.410    0.000    0.223    0.201
##    .Q4_3              0.095    0.016    5.894    0.000    0.095    0.100
##    .Q4_4              0.143    0.025    5.661    0.000    0.143    0.143
##    .Q4_5              0.220    0.034    6.452    0.000    0.220    0.233
##    .Q4_6              0.155    0.025    6.272    0.000    0.155    0.148
##    .Q4_7              0.339    0.057    5.955    0.000    0.339    0.250
##    .Q4_8              0.231    0.035    6.568    0.000    0.231    0.243
##    .Q4_9              0.784    0.101    7.798    0.000    0.784    0.666
##    .Q4_10             0.183    0.040    4.640    0.000    0.183    0.182
##    .Q5_2              0.288    0.056    5.129    0.000    0.288    0.254
##    .Q5_4              0.131    0.023    5.583    0.000    0.131    0.149
##    .Q5_5              0.302    0.058    5.213    0.000    0.302    0.318
##    .Q5_6              0.192    0.031    6.086    0.000    0.192    0.236
##    .Q5_7              0.177    0.027    6.440    0.000    0.177    0.165
##    .Q5_8              0.616    0.105    5.861    0.000    0.616    0.551
##    .Q5_9              0.159    0.020    7.788    0.000    0.159    0.206
##    .Q5_10             0.380    0.054    7.059    0.000    0.380    0.413
##    .Q5_11             0.151    0.035    4.308    0.000    0.151    0.156
##    .Q2_1              0.296    0.047    6.332    0.000    0.296    0.270
##    .Q3_1              0.184    0.058    3.198    0.001    0.184    0.175
##    .Q4_1              0.130    0.032    4.026    0.000    0.130    0.132
##    .Q5_1              0.242    0.039    6.204    0.000    0.242    0.228
##     CSE1              1.000                               1.000    1.000
##     CSE2              1.000                               1.000    1.000
lavTestLRT(csek12two.fit, csek12one.fit) #not significantly different, use more parsimonious model
## 
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
## 
## lavaan->lavTestLRT():  
##    lavaan NOTE: The "Chisq" column contains standard test statistics, not the 
##    robust test that should be reported per model. A robust difference test is 
##    a function of two standard (not robust) statistics.
##                Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)
## csek12two.fit 701 19051 19488 2611.0                              
## csek12one.fit 702 19051 19483 2612.2    0.54934       1     0.4586
dynamic::cfaHB(csek12two.fit, plot = TRUE) #does not meet dynamic fit indices; there are no cut offs that can correctly reject a misspecified model 90 or 95% of the time. No indices can distinguish between well and ill fitting models.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
## Your DFI cutoffs: 
##                SRMR RMSEA  CFI Magnitude
## Level 1: 95/5  NONE  NONE NONE      .402
## Level 1: 90/10 NONE  NONE NONE          
## 
## Empirical fit indices: 
##  Chi-Square  df p-value   SRMR   RMSEA    CFI
##    2610.981 701       0  0.033   0.096  0.885
## 
##  The distributions for each level are in the Plots tab 
## [[1]]

csek12six <-  '
              LAge =~  Q2_1 + Q3_3 + Q4_2 + Q5_2
              Info =~ Q2_2 + Q3_4 + Q4_3 + Q5_4
              Outcomes =~ Q2_3 + Q2_4 + Q2_5 + Q3_5 + Q3_6 + Q3_7 + Q4_4 + Q4_5 + Q4_6 + Q5_5 + Q5_6
              Topic =~ Q2_6 + Q2_7 + Q3_8 + Q3_9 + Q4_7 + Q4_8 + Q5_7 + Q5_8 + Q5_9
              LParent =~ Q2_8 + Q2_9 + Q3_10 + Q4_9 + Q5_10
              EdSuit =~ Q3_1 + Q3_2 + Q4_1 + Q4_10 + Q5_1 + Q5_11
'
csek12six.fit <- lavaan::cfa(csek12six, data = csek12, std.lv = TRUE, missing = "FIML", estimator = "MLR") #covariance matrix is not positive definite; extremely highly related latent variables -> singularity
## Warning: lavaan->lav_object_post_check():  
##    covariance matrix of latent variables is not positive definite ; use 
##    lavInspect(fit, "cov.lv") to investigate.
lavInspect(csek12six.fit, "cov.lv") #covariance over 1
##           LAge  Info Outcms Topic LParnt EdSuit
## LAge     1.000                                 
## Info     0.992 1.000                           
## Outcomes 0.988 0.974  1.000                    
## Topic    0.983 0.976  1.004 1.000              
## LParent  0.926 0.891  0.899 0.901  1.000       
## EdSuit   0.989 0.974  0.978 0.973  0.904  1.000
summary(csek12six.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6-18 ended normally after 215 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       132
## 
##   Number of observations                           298
##   Number of missing patterns                         2
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                              2263.526    1317.926
##   Degrees of freedom                               687         687
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.717
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17308.096    9485.700
##   Degrees of freedom                               741         741
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  1.825
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.905       0.928
##   Tucker-Lewis Index (TLI)                       0.897       0.922
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.934
##   Robust Tucker-Lewis Index (TLI)                            0.929
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9233.985   -9233.985
##   Scaling correction factor                                  2.310
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)             NA          NA
##   Scaling correction factor                                  1.813
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               18731.971   18731.971
##   Bayesian (BIC)                             19219.987   19219.987
##   Sample-size adjusted Bayesian (SABIC)      18801.367   18801.367
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.088       0.056
##   90 Percent confidence interval - lower         0.084       0.052
##   90 Percent confidence interval - upper         0.092       0.059
##   P-value H_0: RMSEA <= 0.050                    0.000       0.005
##   P-value H_0: RMSEA >= 0.080                    0.999       0.000
##                                                                   
##   Robust RMSEA                                               0.072
##   90 Percent confidence interval - lower                     0.066
##   90 Percent confidence interval - upper                     0.078
##   P-value H_0: Robust RMSEA <= 0.050                         0.000
##   P-value H_0: Robust RMSEA >= 0.080                         0.014
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.031       0.031
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   LAge =~                                                               
##     Q2_1              0.896    0.064   13.897    0.000    0.896    0.855
##     Q3_3              0.820    0.077   10.588    0.000    0.820    0.891
##     Q4_2              0.942    0.067   14.000    0.000    0.942    0.893
##     Q5_2              0.921    0.071   13.027    0.000    0.921    0.866
##   Info =~                                                               
##     Q2_2              0.821    0.070   11.800    0.000    0.821    0.742
##     Q3_4              0.972    0.067   14.584    0.000    0.972    0.940
##     Q4_3              0.937    0.069   13.641    0.000    0.937    0.963
##     Q5_4              0.877    0.075   11.754    0.000    0.877    0.934
##   Outcomes =~                                                           
##     Q2_3              0.829    0.068   12.194    0.000    0.829    0.878
##     Q2_4              0.897    0.067   13.475    0.000    0.897    0.844
##     Q2_5              0.920    0.068   13.543    0.000    0.920    0.862
##     Q3_5              0.863    0.077   11.182    0.000    0.863    0.887
##     Q3_6              0.812    0.077   10.528    0.000    0.812    0.842
##     Q3_7              0.980    0.065   15.118    0.000    0.980    0.831
##     Q4_4              0.925    0.074   12.497    0.000    0.925    0.928
##     Q4_5              0.856    0.075   11.425    0.000    0.856    0.883
##     Q4_6              0.952    0.070   13.643    0.000    0.952    0.928
##     Q5_5              0.809    0.075   10.732    0.000    0.809    0.831
##     Q5_6              0.794    0.075   10.581    0.000    0.794    0.880
##   Topic =~                                                              
##     Q2_6              0.879    0.072   12.177    0.000    0.879    0.833
##     Q2_7              0.817    0.076   10.793    0.000    0.817    0.858
##     Q3_8              0.968    0.067   14.466    0.000    0.968    0.724
##     Q3_9              1.000    0.056   17.928    0.000    1.000    0.694
##     Q4_7              1.014    0.062   16.403    0.000    1.014    0.871
##     Q4_8              0.859    0.081   10.639    0.000    0.859    0.880
##     Q5_7              0.946    0.073   13.039    0.000    0.946    0.915
##     Q5_8              0.703    0.085    8.304    0.000    0.703    0.665
##     Q5_9              0.784    0.075   10.417    0.000    0.784    0.893
##   LParent =~                                                            
##     Q2_8              0.871    0.066   13.233    0.000    0.871    0.899
##     Q2_9              0.780    0.069   11.317    0.000    0.780    0.873
##     Q3_10             0.900    0.066   13.725    0.000    0.900    0.851
##     Q4_9              0.698    0.076    9.222    0.000    0.698    0.643
##     Q5_10             0.823    0.069   11.881    0.000    0.823    0.858
##   EdSuit =~                                                             
##     Q3_1              0.936    0.067   14.021    0.000    0.936    0.913
##     Q3_2              0.926    0.068   13.543    0.000    0.926    0.921
##     Q4_1              0.935    0.071   13.099    0.000    0.935    0.940
##     Q4_10             0.920    0.070   13.055    0.000    0.920    0.917
##     Q5_1              0.909    0.068   13.353    0.000    0.909    0.881
##     Q5_11             0.917    0.073   12.600    0.000    0.917    0.933
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   LAge ~~                                                               
##     Info              0.992    0.009  106.897    0.000    0.992    0.992
##     Outcomes          0.988    0.008  119.331    0.000    0.988    0.988
##     Topic             0.983    0.010  101.649    0.000    0.983    0.983
##     LParent           0.926    0.026   35.894    0.000    0.926    0.926
##     EdSuit            0.989    0.010   98.999    0.000    0.989    0.989
##   Info ~~                                                               
##     Outcomes          0.974    0.009  104.935    0.000    0.974    0.974
##     Topic             0.976    0.009  108.410    0.000    0.976    0.976
##     LParent           0.891    0.031   29.176    0.000    0.891    0.891
##     EdSuit            0.974    0.012   79.972    0.000    0.974    0.974
##   Outcomes ~~                                                           
##     Topic             1.004    0.004  243.025    0.000    1.004    1.004
##     LParent           0.899    0.028   31.953    0.000    0.899    0.899
##     EdSuit            0.978    0.009  107.392    0.000    0.978    0.978
##   Topic ~~                                                              
##     LParent           0.901    0.028   32.702    0.000    0.901    0.901
##     EdSuit            0.973    0.011   87.692    0.000    0.973    0.973
##   LParent ~~                                                            
##     EdSuit            0.904    0.027   33.491    0.000    0.904    0.904
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              4.275    0.061   70.405    0.000    4.275    4.078
##    .Q3_3              4.483    0.053   84.091    0.000    4.483    4.871
##    .Q4_2              4.322    0.061   70.787    0.000    4.322    4.101
##    .Q5_2              4.369    0.062   70.883    0.000    4.369    4.106
##    .Q2_2              4.208    0.064   65.628    0.000    4.208    3.802
##    .Q3_4              4.386    0.060   73.221    0.000    4.386    4.242
##    .Q4_3              4.463    0.056   79.187    0.000    4.463    4.587
##    .Q5_4              4.503    0.054   82.830    0.000    4.503    4.798
##    .Q2_3              4.440    0.055   81.208    0.000    4.440    4.704
##    .Q2_4              4.282    0.062   69.578    0.000    4.282    4.031
##    .Q2_5              4.289    0.062   69.393    0.000    4.289    4.020
##    .Q3_5              4.460    0.056   79.138    0.000    4.460    4.584
##    .Q3_6              4.489    0.056   80.291    0.000    4.489    4.657
##    .Q3_7              4.228    0.068   61.890    0.000    4.228    3.585
##    .Q4_4              4.463    0.058   77.292    0.000    4.463    4.477
##    .Q4_5              4.497    0.056   80.009    0.000    4.497    4.635
##    .Q4_6              4.406    0.059   74.112    0.000    4.406    4.293
##    .Q5_5              4.419    0.056   78.347    0.000    4.419    4.539
##    .Q5_6              4.510    0.052   86.312    0.000    4.510    5.000
##    .Q2_6              4.369    0.061   71.522    0.000    4.369    4.143
##    .Q2_7              4.456    0.055   80.829    0.000    4.456    4.682
##    .Q3_8              4.074    0.077   52.615    0.000    4.074    3.048
##    .Q3_9              3.815    0.083   45.705    0.000    3.815    2.648
##    .Q4_7              4.228    0.067   62.650    0.000    4.228    3.629
##    .Q4_8              4.540    0.057   80.283    0.000    4.540    4.651
##    .Q5_7              4.423    0.060   73.826    0.000    4.423    4.277
##    .Q5_8              4.362    0.061   71.255    0.000    4.362    4.128
##    .Q5_9              4.557    0.051   89.635    0.000    4.557    5.192
##    .Q2_8              4.349    0.056   77.492    0.000    4.349    4.489
##    .Q2_9              4.453    0.052   86.045    0.000    4.453    4.984
##    .Q3_10             4.248    0.061   69.311    0.000    4.248    4.015
##    .Q4_9              4.205    0.063   66.927    0.000    4.205    3.877
##    .Q5_10             4.379    0.056   78.816    0.000    4.379    4.566
##    .Q3_1              4.369    0.059   73.547    0.000    4.369    4.260
##    .Q3_2              4.403    0.058   75.537    0.000    4.403    4.376
##    .Q4_1              4.419    0.058   76.735    0.000    4.419    4.445
##    .Q4_10             4.406    0.058   75.822    0.000    4.406    4.392
##    .Q5_1              4.322    0.060   72.333    0.000    4.322    4.190
##    .Q5_11             4.477    0.057   78.561    0.000    4.477    4.551
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .Q2_1              0.296    0.045    6.600    0.000    0.296    0.270
##    .Q3_3              0.175    0.050    3.492    0.000    0.175    0.207
##    .Q4_2              0.224    0.043    5.258    0.000    0.224    0.202
##    .Q5_2              0.284    0.055    5.139    0.000    0.284    0.251
##    .Q2_2              0.551    0.077    7.167    0.000    0.551    0.450
##    .Q3_4              0.125    0.027    4.588    0.000    0.125    0.117
##    .Q4_3              0.069    0.017    4.063    0.000    0.069    0.073
##    .Q5_4              0.113    0.022    5.005    0.000    0.113    0.128
##    .Q2_3              0.204    0.037    5.536    0.000    0.204    0.229
##    .Q2_4              0.324    0.051    6.351    0.000    0.324    0.287
##    .Q2_5              0.292    0.041    7.185    0.000    0.292    0.256
##    .Q3_5              0.202    0.044    4.564    0.000    0.202    0.213
##    .Q3_6              0.270    0.049    5.478    0.000    0.270    0.291
##    .Q3_7              0.431    0.078    5.555    0.000    0.431    0.310
##    .Q4_4              0.139    0.024    5.732    0.000    0.139    0.140
##    .Q4_5              0.208    0.034    6.189    0.000    0.208    0.221
##    .Q4_6              0.146    0.027    5.523    0.000    0.146    0.139
##    .Q5_5              0.294    0.057    5.133    0.000    0.294    0.310
##    .Q5_6              0.183    0.031    5.829    0.000    0.183    0.225
##    .Q2_6              0.340    0.075    4.504    0.000    0.340    0.305
##    .Q2_7              0.239    0.040    5.956    0.000    0.239    0.264
##    .Q3_8              0.850    0.119    7.154    0.000    0.850    0.476
##    .Q3_9              1.077    0.115    9.343    0.000    1.077    0.519
##    .Q4_7              0.328    0.055    5.963    0.000    0.328    0.242
##    .Q4_8              0.215    0.034    6.351    0.000    0.215    0.225
##    .Q5_7              0.175    0.026    6.639    0.000    0.175    0.164
##    .Q5_8              0.623    0.106    5.861    0.000    0.623    0.558
##    .Q5_9              0.156    0.022    7.219    0.000    0.156    0.202
##    .Q2_8              0.180    0.027    6.661    0.000    0.180    0.191
##    .Q2_9              0.189    0.029    6.626    0.000    0.189    0.237
##    .Q3_10             0.309    0.066    4.685    0.000    0.309    0.276
##    .Q4_9              0.689    0.104    6.612    0.000    0.689    0.586
##    .Q5_10             0.242    0.038    6.428    0.000    0.242    0.263
##    .Q3_1              0.175    0.058    3.022    0.003    0.175    0.166
##    .Q3_2              0.155    0.032    4.883    0.000    0.155    0.153
##    .Q4_1              0.115    0.027    4.330    0.000    0.115    0.116
##    .Q4_10             0.160    0.036    4.432    0.000    0.160    0.159
##    .Q5_1              0.238    0.037    6.401    0.000    0.238    0.224
##    .Q5_11             0.126    0.026    4.862    0.000    0.126    0.130
##     LAge              1.000                               1.000    1.000
##     Info              1.000                               1.000    1.000
##     Outcomes          1.000                               1.000    1.000
##     Topic             1.000                               1.000    1.000
##     LParent           1.000                               1.000    1.000
##     EdSuit            1.000                               1.000    1.000
dynamic::cfaHB(csek12six.fit, plot = TRUE)
## Error in dynamic::cfaHB(csek12six.fit, plot = TRUE): dynamic Error: One of your loadings or correlations has an absolute value of 1 or above (an impossible value). Please use standardized loadings. If all of your loadings are under 1, try looking for a missing decimal somewhere in your model statement.