1.There is not enough purpose in my life. 2. To me, the things I do are all worthwhile. 3. Most of what I do seems trivial and unimportant to me. 4. I value my activities a lot. 5. I don’t care very much about the things I do. 2 6. I have lots of reasons for living.


library(lavaan)
## This is lavaan 0.5-18
## lavaan is BETA software! Please report any bugs.
library(semPlot)
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(GPArotation)
library(psych)
library(car)
## 
## Attaching package: 'car'
## 
## The following object is masked from 'package:psych':
## 
##     logit
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## 
## The following object is masked from 'package:psych':
## 
##     %+%
library(GGally)
## 
## Attaching package: 'GGally'
## 
## The following object is masked from 'package:dplyr':
## 
##     nasa

loadthedata

data <- read.csv("~/Psychometric_study_data/allsurveysYT1.csv")
LET<-select(data, LET_1,    LET_2,  LET_3,  LET_4,  LET_5,  LET_6)
LET$LET_1  <-  6- LET$LET_1
LET$LET_3  <-  6- LET$LET_3
LET$LET_5  <-  6- LET$LET_5

EFA Let

LET=na.omit(LET)#removes missing data
#LET<- LET[complete.cases(LET[,]),]

EFA

number of factors

parallal analysis and scree plot

parallel<-fa.parallel(LET, fm="ml",fa="fa")

## Parallel analysis suggests that the number of factors =  2  and the number of components =  NA

three factors are greater than one Eigenvalue scree plot says there are three factors.

Paralel analysis suggests 6 factors

eigenvalues (kaiser)

parallel$fa.values
## [1]  1.927516975  0.836013102 -0.001708068 -0.022006275 -0.284535586
## [6] -0.547334193
#over 1=1, over .7=2

doign aprincipal components analysis to see how many factors there might be using that method

Deal with NA doing principle componant analysis

princomp(na.omit(LET), cor = TRUE)
## Call:
## princomp(x = na.omit(LET), cor = TRUE)
## 
## Standard deviations:
##    Comp.1    Comp.2    Comp.3    Comp.4    Comp.5    Comp.6 
## 1.5484389 1.3143871 0.7992045 0.7099442 0.6511704 0.5549343 
## 
##  6  variables and  829 observations.
parallel2<-princomp(na.omit(LET), cor = TRUE)
summary(parallel2)
## Importance of components:
##                           Comp.1    Comp.2    Comp.3     Comp.4     Comp.5
## Standard deviation     1.5484389 1.3143871 0.7992045 0.70994416 0.65117042
## Proportion of Variance 0.3996105 0.2879356 0.1064546 0.08400345 0.07067049
## Cumulative Proportion  0.3996105 0.6875461 0.7940007 0.87800417 0.94867466
##                            Comp.6
## Standard deviation     0.55493427
## Proportion of Variance 0.05132534
## Cumulative Proportion  1.00000000
plot(parallel2)##results show at least two factors

#simple structure

twofactor<-fa(LET, nfactors=2, rotate="oblimin", fm="ml")
twofactor
## Factor Analysis using method =  ml
## Call: fa(r = LET, nfactors = 2, rotate = "oblimin", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##         ML1   ML2   h2   u2 com
## LET_1  0.63  0.16 0.43 0.57 1.1
## LET_2 -0.02  0.75 0.56 0.44 1.0
## LET_3  0.88 -0.04 0.77 0.23 1.0
## LET_4 -0.07  0.73 0.53 0.47 1.0
## LET_5  0.78 -0.07 0.60 0.40 1.0
## LET_6  0.35  0.46 0.36 0.64 1.9
## 
##                        ML1  ML2
## SS loadings           1.91 1.34
## Proportion Var        0.32 0.22
## Cumulative Var        0.32 0.54
## Proportion Explained  0.59 0.41
## Cumulative Proportion 0.59 1.00
## 
##  With factor correlations of 
##      ML1  ML2
## ML1 1.00 0.06
## ML2 0.06 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  15  and the objective function was  1.75 with Chi Square of  1442.36
## The degrees of freedom for the model are 4  and the objective function was  0.02 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  829 with the empirical chi square  8.31  with prob <  0.081 
## The total number of observations was  829  with MLE Chi Square =  16.06  with prob <  0.0029 
## 
## Tucker Lewis Index of factoring reliability =  0.968
## RMSEA index =  0.061  and the 90 % confidence intervals are  0.031 0.092
## BIC =  -10.82
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 ML1  ML2
## Correlation of scores with factors             0.92 0.86
## Multiple R square of scores with factors       0.85 0.74
## Minimum correlation of possible factor scores  0.71 0.47

LET_6 “I have lots of reasons for living.” loads on both factors so droping it

twofactorWO6<-fa(LET[,-6], nfactors=2, rotate="oblimin", fm="ml")
twofactorWO6
## Factor Analysis using method =  ml
## Call: fa(r = LET[, -6], nfactors = 2, rotate = "oblimin", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##         ML2   ML1   h2    u2 com
## LET_1  0.63  0.17 0.43 0.570 1.1
## LET_2  0.01  1.00 1.00 0.005 1.0
## LET_3  0.88 -0.01 0.78 0.224 1.0
## LET_4 -0.05  0.54 0.30 0.705 1.0
## LET_5  0.77 -0.07 0.60 0.403 1.0
## 
##                        ML2  ML1
## SS loadings           1.77 1.32
## Proportion Var        0.35 0.26
## Cumulative Var        0.35 0.62
## Proportion Explained  0.57 0.43
## Cumulative Proportion 0.57 1.00
## 
##  With factor correlations of 
##      ML2  ML1
## ML2 1.00 0.01
## ML1 0.01 1.00
## 
## Mean item complexity =  1
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  10  and the objective function was  1.42 with Chi Square of  1174.7
## The degrees of freedom for the model are 1  and the objective function was  0 
## 
## The root mean square of the residuals (RMSR) is  0.01 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  829 with the empirical chi square  0.54  with prob <  0.46 
## The total number of observations was  829  with MLE Chi Square =  1.1  with prob <  0.29 
## 
## Tucker Lewis Index of factoring reliability =  0.999
## RMSEA index =  0.011  and the 90 % confidence intervals are  NA 0.094
## BIC =  -5.62
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 ML2  ML1
## Correlation of scores with factors             0.92 1.00
## Multiple R square of scores with factors       0.85 1.00
## Minimum correlation of possible factor scores  0.70 0.99

Finding Alpha

alpha(LET, na.rm = TRUE, check.keys=TRUE)
## 
## Reliability analysis   
## Call: alpha(x = LET, na.rm = TRUE, check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd
##       0.69      0.68    0.74      0.26 2.1 0.024  3.9 0.75
## 
##  lower alpha upper     95% confidence boundaries
## 0.64 0.69 0.73 
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se
## LET_1      0.60      0.60    0.68      0.23 1.5    0.030
## LET_2      0.69      0.67    0.70      0.29 2.0    0.026
## LET_3      0.60      0.61    0.64      0.24 1.6    0.030
## LET_4      0.70      0.69    0.71      0.31 2.2    0.026
## LET_5      0.63      0.63    0.67      0.26 1.7    0.029
## LET_6      0.62      0.60    0.69      0.23 1.5    0.029
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean   sd
## LET_1 829  0.73  0.69  0.61   0.54  3.5 1.36
## LET_2 829  0.48  0.54  0.42   0.26  3.9 1.11
## LET_3 829  0.73  0.67  0.64   0.53  3.5 1.33
## LET_4 829  0.42  0.49  0.37   0.21  4.2 0.99
## LET_5 829  0.68  0.63  0.57   0.46  3.8 1.33
## LET_6 829  0.66  0.69  0.58   0.49  4.2 1.05

Create the Models, As only one factor

one.factor = 'LET =~ LET_1 +  LET_2  + LET_3  + LET_4 + LET_5 + LET_6
' 

Two Factor, Positive and Nagative Model

first.model= ' Negative =~ LET_1 +  LET_3  + LET_5   
             Positive =~   LET_2 + LET_4 + LET_6
' 

Second order models

second.model = ' Negative =~ LET_1 +  LET_3  + LET_5   
              Positive =~   LET_2 + LET_4 + LET_6
              LET =~ NA*Positive + Negative
'

alternative.model  = 'Negative =~ LET_1 +  LET_3  + LET_5   
              Positive =~ LET_2 + LET_4 + LET_6
              LET =~ NA*Positive + Negative
              LET~~1*LET
'

Bifactor Models (similar to Models 6, 7 & 8 in Marsh, Scalas & Nagengast, 2010)

bifactor.model = 'Negative =~ LET_1 +  LET_3  + LET_5   
              Positive =~   LET_2 + LET_4 + LET_6
              Life Satisfaction =~ LET_1 +  LET_2  + LET_3 + LET_4 + LET_5 + LET_6
'

Bifactor only with Negative questions protioned out (like model 7 in Marsh, Scalas & Nagengast, 2010)

bifactor.negative.model = 'Negative =~ LET_1 +  LET_3  + LET_5   
                        LET =~ LET_1 +  LET_2  + LET_3 + LET_4 + LET_5 + LET_6
'

Bifactor only with Positive questions protioned out (like model 8 in Marsh, Scalas & Nagengast, 2010)

bifactor.positive.model = 'Positive =~   LET_2 + LET_4 + LET_6
                        LET =~ LET_1 +  LET_2  + LET_3 + LET_4 + LET_5 + LET_6
'

Alternative method of writing bifactor model

bifactor.model1 = 'LET =~ LET_1 +  LET_2  + LET_3 + LET_4 + LET_5 + LET_6
                Negative =~ LET_1 +  LET_3  + LET_5   
                Positive =~   LET_2 + LET_4 + LET_6
                LET ~~ 0*Negative
                LET ~~ 0*Positive
                Negative~~0*Positive
'

Running the models

one.fit=cfa(one.factor, data=LET, missing = "fiml", std.lv = T)
two.fit=cfa(first.model, data=LET, missing = "fiml", std.lv = T)
second.fit=cfa(second.model, data=LET, missing = "fiml", std.lv = T)
alt.fit=cfa(alternative.model, data=LET, missing = "fiml", std.lv = T)
bifactor.fit=cfa(bifactor.model, data=LET, missing = "fiml", orthogonal = TRUE, std.lv = T)
bifactor.fit1=cfa(bifactor.model1, data=LET, missing = "fiml", orthogonal = TRUE, std.lv = T)
bifactor.negative.fit=cfa(bifactor.negative.model, missing = "fiml", data=LET, orthogonal = TRUE, std.lv = T)
bifactor.positive.fit=cfa(bifactor.positive.model, missing = "fiml", data=LET, orthogonal = TRUE, std.lv = T)

Create pictures of models

#One Factor
semPaths(one.fit, whatLabels = "std", layout = "tree", title=T)

#Two Factors Positive and Nagative
semPaths(two.fit, whatLabels = "std", layout = "tree")

#Second order factors
semPaths(second.fit, whatLabels = "std", layout = "tree")

semPaths(alt.fit, whatLabels = "std", layout = "tree")

#Bifactor Models (similar to Models 6, 7 & 8 in Marsh, Scalas & Nagengast, 2010)
semPaths(bifactor.fit, whatLabels = "std", layout = "tree")

semPaths(bifactor.fit1, whatLabels = "std", layout = "tree")

#Bifactor only with Negative questions protioned out (like model 7 in Marsh, Scalas & Nagengast, 2010)
semPaths(bifactor.negative.fit, whatLabels = "std", layout = "tree")

#Bifactor only with Negative questions protioned out (like model 7 in Marsh, Scalas & Nagengast, 2010)
semPaths(bifactor.positive.fit, whatLabels = "std", layout = "tree")

Summaries

summary(one.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  21 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              502.067
##   Degrees of freedom                                 9
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   LET =~
##     LET_1             0.866    0.046   18.678    0.000    0.866    0.636
##     LET_2             0.045    0.042    1.058    0.290    0.045    0.041
##     LET_3             1.168    0.043   27.162    0.000    1.168    0.878
##     LET_4            -0.014    0.038   -0.365    0.715   -0.014   -0.014
##     LET_5             1.025    0.044   23.469    0.000    1.025    0.768
##     LET_6             0.396    0.039   10.228    0.000    0.396    0.376
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     LET               0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.106    0.064                      1.106    0.596
##     LET_2             1.220    0.060                      1.220    0.998
##     LET_3             0.406    0.058                      0.406    0.230
##     LET_4             0.978    0.048                      0.978    1.000
##     LET_5             0.729    0.054                      0.729    0.410
##     LET_6             0.954    0.049                      0.954    0.859
##     LET               1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.404
##     LET_2             0.002
##     LET_3             0.770
##     LET_4             0.000
##     LET_5             0.590
##     LET_6             0.141
summary(two.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  20 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              182.290
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     LET_1             0.856    0.047   18.324    0.000    0.856    0.628
##     LET_3             1.179    0.045   26.423    0.000    1.179    0.887
##     LET_5             1.020    0.045   22.633    0.000    1.020    0.764
##   Positive =~
##     LET_2             0.810    0.047   17.066    0.000    0.810    0.732
##     LET_4             0.721    0.043   16.886    0.000    0.721    0.729
##     LET_6             0.505    0.042   12.019    0.000    0.505    0.479
## 
## Covariances:
##   Negative ~~
##     Positive          0.070    0.046    1.512    0.130    0.070    0.070
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.124    0.065                      1.124    0.605
##     LET_3             0.379    0.065                      0.379    0.214
##     LET_5             0.739    0.059                      0.739    0.416
##     LET_2             0.566    0.062                      0.566    0.463
##     LET_4             0.458    0.050                      0.458    0.468
##     LET_6             0.856    0.049                      0.856    0.770
##     Negative          1.000                               1.000    1.000
##     Positive          1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.395
##     LET_3             0.786
##     LET_5             0.584
##     LET_2             0.537
##     LET_4             0.532
##     LET_6             0.230
summary(second.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  22 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              182.290
##   Degrees of freedom                                 7
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     LET_1             0.722       NA                      0.856    0.628
##     LET_3             0.995       NA                      1.179    0.887
##     LET_5             0.860       NA                      1.020    0.764
##   Positive =~
##     LET_2             0.803       NA                      0.810    0.732
##     LET_4             0.715       NA                      0.721    0.729
##     LET_6             0.501       NA                      0.505    0.479
##   LET =~
##     Positive          0.131       NA                      0.130    0.130
##     Negative          0.636       NA                      0.537    0.537
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
##     LET               0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.124    0.065                      1.124    0.605
##     LET_3             0.379    0.065                      0.379    0.214
##     LET_5             0.739    0.059                      0.739    0.416
##     LET_2             0.566    0.062                      0.566    0.463
##     LET_4             0.458    0.050                      0.458    0.468
##     LET_6             0.856    0.049                      0.856    0.770
##     Negative          1.000                               0.712    0.712
##     Positive          1.000                               0.983    0.983
##     LET               1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.395
##     LET_3             0.786
##     LET_5             0.584
##     LET_2             0.537
##     LET_4             0.532
##     LET_6             0.230
##     Negative          0.288
##     Positive          0.017
summary(alt.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  22 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              182.290
##   Degrees of freedom                                 7
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     LET_1             0.722       NA                      0.856    0.628
##     LET_3             0.995       NA                      1.179    0.887
##     LET_5             0.860       NA                      1.020    0.764
##   Positive =~
##     LET_2             0.803       NA                      0.810    0.732
##     LET_4             0.715       NA                      0.721    0.729
##     LET_6             0.501       NA                      0.505    0.479
##   LET =~
##     Positive          0.131       NA                      0.130    0.130
##     Negative          0.636       NA                      0.537    0.537
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
##     LET               0.000                               0.000    0.000
## 
## Variances:
##     LET               1.000                               1.000    1.000
##     LET_1             1.124    0.065                      1.124    0.605
##     LET_3             0.379    0.065                      0.379    0.214
##     LET_5             0.739    0.059                      0.739    0.416
##     LET_2             0.566    0.062                      0.566    0.463
##     LET_4             0.458    0.050                      0.458    0.468
##     LET_6             0.856    0.049                      0.856    0.770
##     Negative          1.000                               0.712    0.712
##     Positive          1.000                               0.983    0.983
## 
## R-Square:
## 
##     LET_1             0.395
##     LET_3             0.786
##     LET_5             0.584
##     LET_2             0.537
##     LET_4             0.532
##     LET_6             0.230
##     Negative          0.288
##     Positive          0.017
summary(bifactor.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  29 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic               50.515
##   Degrees of freedom                                 3
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     LET_1             0.584   23.262    0.025    0.980    0.584    0.429
##     LET_3             0.844   28.393    0.030    0.976    0.844    0.635
##     LET_5             0.689   28.881    0.024    0.981    0.689    0.516
##   Positive =~
##     LET_2             0.759    3.136    0.242    0.809    0.759    0.687
##     LET_4             0.778    3.343    0.233    0.816    0.778    0.787
##     LET_6             0.508    0.961    0.529    0.597    0.508    0.482
##   LifeSatisfaction =~
##     LET_1             0.620   21.868    0.028    0.977    0.620    0.455
##     LET_2             0.022    0.788    0.028    0.977    0.022    0.020
##     LET_3             0.828   29.211    0.028    0.977    0.828    0.623
##     LET_4            -0.063    2.220   -0.028    0.977   -0.063   -0.064
##     LET_5             0.752   26.521    0.028    0.977    0.752    0.564
##     LET_6             0.551   19.417    0.028    0.977    0.551    0.522
## 
## Covariances:
##   Negative ~~
##     Positive          0.000                               0.000    0.000
##     LifeSatisfctn     0.000                               0.000    0.000
##   Positive ~~
##     LifeSatisfctn     0.000                               0.000    0.000
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
##     LifeSatisfctn     0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.130    0.088                      1.130    0.609
##     LET_3             0.370    0.454                      0.370    0.209
##     LET_5             0.739    0.128                      0.739    0.415
##     LET_2             0.644    4.728                      0.644    0.527
##     LET_4             0.369    5.481                      0.369    0.377
##     LET_6             0.550   22.360                      0.550    0.495
##     Negative          1.000                               1.000    1.000
##     Positive          1.000                               1.000    1.000
##     LifeSatisfctn     1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.391
##     LET_3             0.791
##     LET_5             0.585
##     LET_2             0.473
##     LET_4             0.623
##     LET_6             0.505
summary(bifactor.fit1, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  29 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic               50.515
##   Degrees of freedom                                 3
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   LET =~
##     LET_1             0.620   21.868    0.028    0.977    0.620    0.455
##     LET_2             0.022    0.788    0.028    0.977    0.022    0.020
##     LET_3             0.828   29.211    0.028    0.977    0.828    0.623
##     LET_4            -0.063    2.220   -0.028    0.977   -0.063   -0.064
##     LET_5             0.752   26.521    0.028    0.977    0.752    0.564
##     LET_6             0.551   19.417    0.028    0.977    0.551    0.522
##   Negative =~
##     LET_1             0.584   23.262    0.025    0.980    0.584    0.429
##     LET_3             0.844   28.393    0.030    0.976    0.844    0.635
##     LET_5             0.689   28.881    0.024    0.981    0.689    0.516
##   Positive =~
##     LET_2             0.759    3.136    0.242    0.809    0.759    0.687
##     LET_4             0.778    3.343    0.233    0.816    0.778    0.787
##     LET_6             0.508    0.961    0.529    0.597    0.508    0.482
## 
## Covariances:
##   LET ~~
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
##   Negative ~~
##     Positive          0.000                               0.000    0.000
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     LET               0.000                               0.000    0.000
##     Negative          0.000                               0.000    0.000
##     Positive          0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.130    0.088                      1.130    0.609
##     LET_2             0.644    4.728                      0.644    0.527
##     LET_3             0.370    0.454                      0.370    0.209
##     LET_4             0.369    5.481                      0.369    0.377
##     LET_5             0.739    0.128                      0.739    0.415
##     LET_6             0.550   22.360                      0.550    0.495
##     LET               1.000                               1.000    1.000
##     Negative          1.000                               1.000    1.000
##     Positive          1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.391
##     LET_2             0.473
##     LET_3             0.791
##     LET_4             0.623
##     LET_5             0.585
##     LET_6             0.505
summary(bifactor.negative.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  22 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              144.351
##   Degrees of freedom                                 6
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Negative =~
##     LET_1             0.846    0.046   18.442    0.000    0.846    0.621
##     LET_3             1.170    0.045   26.230    0.000    1.170    0.879
##     LET_5             1.030    0.045   22.799    0.000    1.030    0.772
##   LET =~
##     LET_1             0.305    0.055    5.509    0.000    0.305    0.224
##     LET_2             0.857    0.049   17.638    0.000    0.857    0.776
##     LET_3             0.057    0.055    1.028    0.304    0.057    0.043
##     LET_4             0.685    0.041   16.509    0.000    0.685    0.692
##     LET_5            -0.009    0.056   -0.158    0.874   -0.009   -0.007
##     LET_6             0.492    0.043   11.555    0.000    0.492    0.467
## 
## Covariances:
##   Negative ~~
##     LET               0.000                               0.000    0.000
## 
## Intercepts:
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     Negative          0.000                               0.000    0.000
##     LET               0.000                               0.000    0.000
## 
## Variances:
##     LET_1             1.047    0.062                      1.047    0.564
##     LET_3             0.398    0.064                      0.398    0.225
##     LET_5             0.718    0.059                      0.718    0.403
##     LET_2             0.486    0.067                      0.486    0.398
##     LET_4             0.510    0.047                      0.510    0.521
##     LET_6             0.869    0.049                      0.869    0.782
##     Negative          1.000                               1.000    1.000
##     LET               1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_1             0.436
##     LET_3             0.775
##     LET_5             0.597
##     LET_2             0.602
##     LET_4             0.479
##     LET_6             0.218
summary(bifactor.positive.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  22 iterations
## 
##   Number of observations                           829
## 
##   Number of missing patterns                         1
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic               50.899
##   Degrees of freedom                                 6
##   P-value (Chi-square)                           0.000
## 
## Parameter estimates:
## 
##   Information                                 Observed
##   Standard Errors                             Standard
## 
##                    Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
## Latent variables:
##   Positive =~
##     LET_2             0.781    0.046   16.845    0.000    0.781    0.707
##     LET_4             0.756    0.043   17.713    0.000    0.756    0.764
##     LET_6             0.501    0.038   13.077    0.000    0.501    0.476
##   LET =~
##     LET_1             0.855    0.046   18.528    0.000    0.855    0.628
##     LET_2             0.016    0.042    0.383    0.702    0.016    0.014
##     LET_3             1.174    0.043   27.423    0.000    1.174    0.882
##     LET_4            -0.047    0.037   -1.247    0.212   -0.047   -0.047
##     LET_5             1.026    0.044   23.370    0.000    1.026    0.769
##     LET_6             0.393    0.038   10.236    0.000    0.393    0.373
## 
## Covariances:
##   Positive ~~
##     LET               0.000                               0.000    0.000
## 
## Intercepts:
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     LET_4             4.163    0.034  121.180    0.000    4.163    4.209
##     LET_6             4.230    0.037  115.560    0.000    4.230    4.014
##     LET_1             3.521    0.047   74.410    0.000    3.521    2.584
##     LET_3             3.486    0.046   75.452    0.000    3.486    2.621
##     LET_5             3.807    0.046   82.172    0.000    3.807    2.854
##     Positive          0.000                               0.000    0.000
##     LET               0.000                               0.000    0.000
## 
## Variances:
##     LET_2             0.611    0.059                      0.611    0.500
##     LET_4             0.405    0.052                      0.405    0.414
##     LET_6             0.705    0.042                      0.705    0.635
##     LET_1             1.125    0.063                      1.125    0.606
##     LET_3             0.392    0.057                      0.392    0.222
##     LET_5             0.726    0.055                      0.726    0.408
##     Positive          1.000                               1.000    1.000
##     LET               1.000                               1.000    1.000
## 
## R-Square:
## 
##     LET_2             0.500
##     LET_4             0.586
##     LET_6             0.365
##     LET_1             0.394
##     LET_3             0.778
##     LET_5             0.592

Residual correlations

correl.1 = residuals(one.fit, type="cor")
correl.1
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_2  LET_3  LET_4  LET_5  LET_6 
## LET_1  0.000                                   
## LET_2  0.151  0.000                            
## LET_3 -0.002 -0.035  0.000                     
## LET_4  0.076  0.540 -0.044  0.000              
## LET_5 -0.010 -0.087  0.005 -0.047  0.000       
## LET_6  0.053  0.326 -0.012  0.351 -0.009  0.000
## 
## $mean
## LET_1 LET_2 LET_3 LET_4 LET_5 LET_6 
##     0     0     0     0     0     0
#View(correl.1$cor)
correl = residuals(two.fit, type="cor")
correl
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3 -0.001  0.000                            
## LET_5 -0.002  0.001  0.000                     
## LET_2  0.145 -0.045 -0.095  0.000              
## LET_4  0.035 -0.102 -0.097  0.005  0.000       
## LET_6  0.271  0.288  0.254 -0.009 -0.004  0.000
## 
## $mean
## LET_1 LET_3 LET_5 LET_2 LET_4 LET_6 
##     0     0     0     0     0     0
#View(correl$cor)
correl1 = residuals(second.fit, type="cor")
correl1
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3 -0.001  0.000                            
## LET_5 -0.002  0.001  0.000                     
## LET_2  0.145 -0.045 -0.095  0.000              
## LET_4  0.035 -0.102 -0.097  0.005  0.000       
## LET_6  0.271  0.288  0.254 -0.009 -0.004  0.000
## 
## $mean
## LET_1 LET_3 LET_5 LET_2 LET_4 LET_6 
##     0     0     0     0     0     0
#View(correl1$cor)
correl2 = residuals(alt.fit, type="cor")
correl2
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3 -0.001  0.000                            
## LET_5 -0.002  0.001  0.000                     
## LET_2  0.145 -0.045 -0.095  0.000              
## LET_4  0.035 -0.102 -0.097  0.005  0.000       
## LET_6  0.271  0.288  0.254 -0.009 -0.004  0.000
## 
## $mean
## LET_1 LET_3 LET_5 LET_2 LET_4 LET_6 
##     0     0     0     0     0     0
#View(correl2$cor)
correl3 = residuals(bifactor.fit, type="cor")
correl3
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3  0.000  0.000                            
## LET_5  0.000  0.000  0.000                     
## LET_2  0.168 -0.012 -0.067  0.000              
## LET_4  0.096 -0.017 -0.022  0.000  0.000       
## LET_6  0.054 -0.008 -0.015  0.000  0.000  0.000
## 
## $mean
## LET_1 LET_3 LET_5 LET_2 LET_4 LET_6 
##     0     0     0     0     0     0
#View(correl3$cor)
correl4 = residuals(bifactor.fit1, type="cor")
correl4
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_2  LET_3  LET_4  LET_5  LET_6 
## LET_1  0.000                                   
## LET_2  0.168  0.000                            
## LET_3  0.000 -0.012  0.000                     
## LET_4  0.096  0.000 -0.017  0.000              
## LET_5  0.000 -0.067  0.000 -0.022  0.000       
## LET_6  0.054  0.000 -0.008  0.000 -0.015  0.000
## 
## $mean
## LET_1 LET_2 LET_3 LET_4 LET_5 LET_6 
##     0     0     0     0     0     0
#View(correl4$cor)
correl5 = residuals(bifactor.negative.fit, type="cor")
correl5
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3  0.000  0.000                            
## LET_5  0.000  0.000  0.000                     
## LET_2  0.003 -0.032 -0.051  0.000              
## LET_4 -0.088 -0.086 -0.053  0.002  0.000       
## LET_6  0.187  0.298  0.283 -0.021  0.023  0.000
## 
## $mean
## LET_1 LET_3 LET_5 LET_2 LET_4 LET_6 
##     0     0     0     0     0     0
#View(correl5$cor)
correl6 = residuals(bifactor.positive.fit, type="cor")
correl6
## $type
## [1] "cor.bollen"
## 
## $cor
##       LET_2  LET_4  LET_6  LET_1  LET_3  LET_5 
## LET_2  0.000                                   
## LET_4  0.000  0.000                            
## LET_6  0.000  0.000  0.000                     
## LET_1  0.168  0.096  0.058  0.000              
## LET_3 -0.012 -0.015 -0.012  0.002  0.000       
## LET_5 -0.067 -0.021 -0.007 -0.005  0.000  0.000
## 
## $mean
## LET_2 LET_4 LET_6 LET_1 LET_3 LET_5 
##     0     0     0     0     0     0
#View(correl6$cor)

zscore correlation anything over 1.96 is going to be statistically significant at the .05 level

zcorrels10 = residuals(one.fit, type = "standardized")
zcorrels10$cov
##       LET_1  LET_2  LET_3  LET_4  LET_5  LET_6 
## LET_1     NA                                   
## LET_2  5.963  0.000                            
## LET_3 -0.681 -4.114     NA                     
## LET_4  3.053 13.692 -5.303  0.000              
## LET_5 -1.385 -4.733     NA -2.540     NA       
## LET_6  2.346  9.700 -1.524 10.386 -0.596     NA
zcorrels = residuals(two.fit, type = "standardized")
zcorrels$cov
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3 -1.064  0.000                            
## LET_5 -1.162     NA  0.000                     
## LET_2  5.186 -2.610 -4.135     NA              
## LET_4  1.261 -5.606 -4.114     NA     NA       
## LET_6  8.168  9.507  8.060 -9.053 -1.217     NA
#zcorrels1 = residuals(second.fit, type = "standardized")
#zcorrels1$cov
#zcorrels2 = residuals(alt.fit, type = "standardized")
#zcorrels2$cov
#zcorrels3 = residuals(bifactor.fit, type = "standardized")
#zcorrels3$cov
#zcorrels4 = residuals(bifactor1.fit, type = "standardized")
#zcorrels4$cov
zcorrels5 = residuals(bifactor.negative.fit, type = "standardized")
zcorrels5$cov
##       LET_1  LET_3  LET_5  LET_2  LET_4  LET_6 
## LET_1  0.000                                   
## LET_3  0.000  0.000                            
## LET_5  0.000  0.000  0.000                     
## LET_2  0.271 -2.535 -4.068  0.000              
## LET_4 -4.719 -4.437 -2.745     NA  0.000       
## LET_6  6.525  9.734  9.316 -2.568     NA  0.000
zcorrels6 = residuals(bifactor.positive.fit, type = "standardized")
zcorrels6$cov
##       LET_2  LET_4  LET_6  LET_1  LET_3  LET_5 
## LET_2  0.000                                   
## LET_4  0.000  0.000                            
## LET_6  0.000  0.000  0.000                     
## LET_1  6.439  3.782  2.474  0.000              
## LET_3 -1.254 -1.533 -1.384  0.603  0.000       
## LET_5 -3.509 -1.119 -0.470 -0.593  0.208  0.000

Modification indicies

modindices(one.fit, sort. = TRUE, minimum.value = 3.84)
##      lhs op   rhs      mi    epc sepc.lv sepc.all sepc.nox
## 1  LET_2 ~~ LET_4 242.111  0.590   0.590    0.540    0.540
## 2  LET_4 ~~ LET_6 122.634  0.377   0.377    0.362    0.362
## 3  LET_2 ~~ LET_6 106.161  0.392   0.392    0.336    0.336
## 4  LET_1 ~~ LET_2  36.107  0.258   0.258    0.172    0.172
## 5  LET_2 ~~ LET_5  20.570 -0.172  -0.172   -0.117   -0.117
## 6  LET_3 ~~ LET_4  17.410 -0.144  -0.144   -0.109   -0.109
## 7  LET_2 ~~ LET_3  10.921 -0.127  -0.127   -0.086   -0.086
## 8  LET_3 ~~ LET_5  10.016  0.432   0.432    0.243    0.243
## 9  LET_1 ~~ LET_4   9.078  0.116   0.116    0.086    0.086
## 10 LET_4 ~~ LET_5   5.939 -0.083  -0.083   -0.063   -0.063
## 11 LET_1 ~~ LET_6   5.520  0.093   0.093    0.064    0.064
modindices(two.fit, sort. = TRUE, minimum.value = 3.84)
##         lhs op   rhs      mi    epc sepc.lv sepc.all sepc.nox
## 1  Negative =~ LET_6 119.522  0.406   0.406    0.385    0.385
## 2     LET_2 ~~ LET_4 119.518  6.688   6.688    6.118    6.118
## 3     LET_3 ~~ LET_5  33.970  5.389   5.389    3.037    3.037
## 4  Positive =~ LET_1  33.969  0.269   0.269    0.198    0.198
## 5  Negative =~ LET_4  26.307 -0.176  -0.176   -0.178   -0.178
## 6     LET_2 ~~ LET_6  26.307 -1.420  -1.420   -1.219   -1.219
## 7     LET_1 ~~ LET_2  25.260  0.178   0.178    0.118    0.118
## 8     LET_3 ~~ LET_6  18.559  0.132   0.132    0.094    0.094
## 9     LET_5 ~~ LET_2  14.361 -0.117  -0.117   -0.079   -0.079
## 10    LET_5 ~~ LET_6   9.908  0.102   0.102    0.073    0.073
## 11    LET_3 ~~ LET_4   8.503 -0.077  -0.077   -0.059   -0.059
## 12 Positive =~ LET_5   5.793 -0.098  -0.098   -0.073   -0.073
## 13    LET_1 ~~ LET_3   5.793 -1.380  -1.380   -0.761   -0.761
#modindices(second.fit, sort. = TRUE, minimum.value = 3.84)
#modindices(alt.fit, sort. = TRUE, minimum.value = 3.84)
#modindices(bifactor.fit, sort. = TRUE, minimum.value = 3.84)
#modindices(bifactor.fit1, sort. = TRUE, minimum.value = 3.84)
modindices(bifactor.negative.fit, sort. = TRUE, minimum.value = 3.84)
##         lhs op   rhs      mi    epc sepc.lv sepc.all sepc.nox
## 1  Negative =~ LET_6 117.026  0.402   0.402    0.381    0.381
## 2     LET_3 ~~ LET_6  20.307  0.140   0.140    0.100    0.100
## 3  Negative =~ LET_4  18.893 -0.145  -0.145   -0.146   -0.146
## 4     LET_5 ~~ LET_6  13.253  0.120   0.120    0.085    0.085
## 5     LET_2 ~~ LET_6  13.168 -0.279  -0.279   -0.240   -0.240
## 6     LET_5 ~~ LET_2   9.437 -0.109  -0.109   -0.074   -0.074
## 7     LET_1 ~~ LET_4   8.276 -0.104  -0.104   -0.077   -0.077
## 8     LET_4 ~~ LET_6   6.873  0.156   0.156    0.150    0.150
## 9     LET_1 ~~ LET_2   6.431  0.111   0.111    0.074    0.074
## 10 Negative =~ LET_2   6.275 -0.100  -0.100   -0.090   -0.090
## 11    LET_3 ~~ LET_4   4.916 -0.062  -0.062   -0.047   -0.047
modindices(bifactor.positive.fit, sort. = TRUE, minimum.value = 3.84)
##        lhs op   rhs     mi    epc sepc.lv sepc.all sepc.nox
## 1 Positive =~ LET_1 31.240  0.256   0.256    0.188    0.188
## 2    LET_2 ~~ LET_1 28.127  0.190   0.190    0.126    0.126
## 3    LET_2 ~~ LET_5 12.340 -0.110  -0.110   -0.075   -0.075
## 4 Positive =~ LET_5  5.134 -0.091  -0.091   -0.068   -0.068

Fit Measures

fitmeasures(one.fit)
##                npar                fmin               chisq 
##              18.000               0.303             502.067 
##                  df              pvalue      baseline.chisq 
##               9.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.656 
##                 tli                nnfi                 rfi 
##               0.427               0.427               0.423 
##                 nfi                pnfi                 ifi 
##               0.654               0.392               0.658 
##                 rni                logl   unrestricted.logl 
##               0.656           -7433.656           -7182.623 
##                 aic                 bic              ntotal 
##           14903.312           14988.276             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14931.115               0.257               0.238 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.276               0.000               0.164 
##          rmr_nomean                srmr        srmr_bentler 
##               0.185               0.145               0.145 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.164               0.145               0.164 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.145               0.164              28.936 
##               cn_01                 gfi                agfi 
##              36.774               0.988               0.963 
##                pgfi                 mfi                ecvi 
##               0.329               0.743                  NA
fitmeasures(two.fit)
##                npar                fmin               chisq 
##              19.000               0.110             182.290 
##                  df              pvalue      baseline.chisq 
##               8.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.878 
##                 tli                nnfi                 rfi 
##               0.772               0.772               0.764 
##                 nfi                pnfi                 ifi 
##               0.874               0.466               0.879 
##                 rni                logl   unrestricted.logl 
##               0.878           -7273.768           -7182.623 
##                 aic                 bic              ntotal 
##           14585.536           14675.220             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14614.883               0.162               0.142 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.183               0.000               0.143 
##          rmr_nomean                srmr        srmr_bentler 
##               0.162               0.101               0.101 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.114               0.101               0.114 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.101               0.114              71.522 
##               cn_01                 gfi                agfi 
##              92.364               0.995               0.982 
##                pgfi                 mfi                ecvi 
##               0.295               0.900                  NA
fitmeasures(second.fit)
##                npar                fmin               chisq 
##              20.000               0.110             182.290 
##                  df              pvalue      baseline.chisq 
##               7.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.878 
##                 tli                nnfi                 rfi 
##               0.738               0.738               0.730 
##                 nfi                pnfi                 ifi 
##               0.874               0.408               0.878 
##                 rni                logl   unrestricted.logl 
##               0.878           -7273.768           -7182.623 
##                 aic                 bic              ntotal 
##           14587.536           14681.940             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14618.427               0.174               0.153 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.196               0.000               0.143 
##          rmr_nomean                srmr        srmr_bentler 
##               0.162               0.101               0.101 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.114               0.101               0.114 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.101               0.114              64.973 
##               cn_01                 gfi                agfi 
##              85.020               0.995               0.979 
##                pgfi                 mfi                ecvi 
##               0.258               0.900                  NA
fitmeasures(alt.fit)
##                npar                fmin               chisq 
##              20.000               0.110             182.290 
##                  df              pvalue      baseline.chisq 
##               7.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.878 
##                 tli                nnfi                 rfi 
##               0.738               0.738               0.730 
##                 nfi                pnfi                 ifi 
##               0.874               0.408               0.878 
##                 rni                logl   unrestricted.logl 
##               0.878           -7273.768           -7182.623 
##                 aic                 bic              ntotal 
##           14587.536           14681.940             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14618.427               0.174               0.153 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.196               0.000               0.143 
##          rmr_nomean                srmr        srmr_bentler 
##               0.162               0.101               0.101 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.114               0.101               0.114 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.101               0.114              64.973 
##               cn_01                 gfi                agfi 
##              85.020               0.995               0.979 
##                pgfi                 mfi                ecvi 
##               0.258               0.900                  NA
fitmeasures(bifactor.fit)
##                npar                fmin               chisq 
##              24.000               0.030              50.515 
##                  df              pvalue      baseline.chisq 
##               3.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.967 
##                 tli                nnfi                 rfi 
##               0.834               0.834               0.826 
##                 nfi                pnfi                 ifi 
##               0.965               0.193               0.967 
##                 rni                logl   unrestricted.logl 
##               0.967           -7207.880           -7182.623 
##                 aic                 bic              ntotal 
##           14463.760           14577.046             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14500.830               0.138               0.106 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.173               0.000               0.060 
##          rmr_nomean                srmr        srmr_bentler 
##               0.068               0.041               0.041 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.047               0.041               0.047 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.041               0.047             129.247 
##               cn_01                 gfi                agfi 
##             187.180               0.998               0.985 
##                pgfi                 mfi                ecvi 
##               0.111               0.972                  NA
fitmeasures(bifactor.fit1)
##                npar                fmin               chisq 
##              24.000               0.030              50.515 
##                  df              pvalue      baseline.chisq 
##               3.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.967 
##                 tli                nnfi                 rfi 
##               0.834               0.834               0.826 
##                 nfi                pnfi                 ifi 
##               0.965               0.193               0.967 
##                 rni                logl   unrestricted.logl 
##               0.967           -7207.880           -7182.623 
##                 aic                 bic              ntotal 
##           14463.760           14577.046             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14500.830               0.138               0.106 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.173               0.000               0.060 
##          rmr_nomean                srmr        srmr_bentler 
##               0.068               0.041               0.041 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.047               0.041               0.047 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.041               0.047             129.247 
##               cn_01                 gfi                agfi 
##             187.180               0.998               0.985 
##                pgfi                 mfi                ecvi 
##               0.111               0.972                  NA
fitmeasures(bifactor.negative.fit)
##                npar                fmin               chisq 
##              21.000               0.087             144.351 
##                  df              pvalue      baseline.chisq 
##               6.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.904 
##                 tli                nnfi                 rfi 
##               0.759               0.759               0.751 
##                 nfi                pnfi                 ifi 
##               0.900               0.360               0.904 
##                 rni                logl   unrestricted.logl 
##               0.904           -7254.798           -7182.623 
##                 aic                 bic              ntotal 
##           14551.596           14650.721             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14584.033               0.167               0.144 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.191               0.000               0.128 
##          rmr_nomean                srmr        srmr_bentler 
##               0.146               0.092               0.092 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.104               0.092               0.104 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.092               0.104              73.313 
##               cn_01                 gfi                agfi 
##              97.550               0.996               0.981 
##                pgfi                 mfi                ecvi 
##               0.221               0.920                  NA
fitmeasures(bifactor.positive.fit)
##                npar                fmin               chisq 
##              21.000               0.031              50.899 
##                  df              pvalue      baseline.chisq 
##               6.000               0.000            1449.057 
##         baseline.df     baseline.pvalue                 cfi 
##              15.000               0.000               0.969 
##                 tli                nnfi                 rfi 
##               0.922               0.922               0.912 
##                 nfi                pnfi                 ifi 
##               0.965               0.386               0.969 
##                 rni                logl   unrestricted.logl 
##               0.969           -7208.072           -7182.623 
##                 aic                 bic              ntotal 
##           14458.145           14557.269             829.000 
##                bic2               rmsea      rmsea.ci.lower 
##           14490.581               0.095               0.072 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.120               0.001               0.061 
##          rmr_nomean                srmr        srmr_bentler 
##               0.069               0.041               0.041 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.047               0.041               0.047 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.041               0.047             206.080 
##               cn_01                 gfi                agfi 
##             274.816               0.998               0.992 
##                pgfi                 mfi                ecvi 
##               0.222               0.973                  NA

Create dataset for Target rotation

LETTR<-select(LET, LET_1  , LET_2 , LET_3, LET_4 ,  LET_5 , LET_6)
colnames(LETTR) <- c("1","2", "3", "4", "5", "6")
#Target Roration
Targ_key <- make.keys(6,list(f1=1:6))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
out_targetQ <- fa(LETTR,1,rotate="TargetQ",Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA","uniquenesses")]
## $loadings
## 
## Loadings:
##   MR1   
## 1  0.642
## 2       
## 3  0.868
## 4       
## 5  0.774
## 6  0.381
## 
##                  MR1
## SS loadings    1.912
## Proportion Var 0.319
## 
## $<NA>
## NULL
## 
## $TLI
## [1] 0.4265872
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
##  0.2571571  0.2375846  0.2758252  0.1000000 
## 
## $uniquenesses
##         1         2         3         4         5         6 
## 0.5883392 0.9979331 0.2470149 0.9999157 0.4002568 0.8545076
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = LETTR, nfactors = 1, rotate = "TargetQ", Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##     MR1      h2   u2 com
## 1  0.64 4.1e-01 0.59   1
## 2  0.05 2.1e-03 1.00   1
## 3  0.87 7.5e-01 0.25   1
## 4 -0.01 8.4e-05 1.00   1
## 5  0.77 6.0e-01 0.40   1
## 6  0.38 1.5e-01 0.85   1
## 
##                 MR1
## SS loadings    1.91
## Proportion Var 0.32
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## The degrees of freedom for the null model are  15  and the objective function was  1.75 with Chi Square of  1442.36
## The degrees of freedom for the model are 9  and the objective function was  0.61 
## 
## The root mean square of the residuals (RMSR) is  0.19 
## The df corrected root mean square of the residuals is  0.25 
## 
## The harmonic number of observations is  829 with the empirical chi square  933.89  with prob <  3.1e-195 
## The total number of observations was  829  with MLE Chi Square =  499.68  with prob <  6.7e-102 
## 
## Tucker Lewis Index of factoring reliability =  0.427
## RMSEA index =  0.257  and the 90 % confidence intervals are  0.238 0.276
## BIC =  439.2
## Fit based upon off diagonal values = 0.69
## Measures of factor score adequacy             
##                                                 MR1
## Correlation of scores with factors             0.92
## Multiple R square of scores with factors       0.84
## Minimum correlation of possible factor scores  0.69

CFI

1-((out_targetQ$STATISTIC - out_targetQ$dof)/(out_targetQ$null.chisq- out_targetQ$null.dof))
## [1] 0.6562332

As two Factor

data <- read.csv("~/Psychometric_study_data/allsurveysYT1.csv")
LETTR2<-select(data, LET_1, LET_3, LET_5, LET_2,        LET_4,  LET_6)
LETTR2$LET_1  <-  6- LETTR2$LET_1
LETTR2$LET_3  <-  6- LETTR2$LET_3
LETTR2$LET_5  <-  6- LETTR2$LET_5
colnames(LETTR2) <- c("1","2", "3", "4", "5", "6")
Targ_key <- make.keys(6,list(f1=1:3, f2=4:6))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
LETTR2_cor <- corFiml(LETTR2)
out_targetQ <- fa(LETTR2_cor,2,rotate="TargetQ",Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA","uniquenesses")]
## $loadings
## 
## Loadings:
##   MR1    MR2   
## 1  0.614  0.164
## 2  0.882       
## 3  0.782       
## 4         0.754
## 5 -0.126  0.733
## 6  0.321  0.466
## 
##                  MR1   MR2
## SS loadings    1.890 1.355
## Proportion Var 0.315 0.226
## Cumulative Var 0.315 0.541
## 
## $score.cor
##           [,1]      [,2]
## [1,] 1.0000000 0.1627735
## [2,] 0.1627735 1.0000000
## 
## $<NA>
## NULL
## 
## $<NA>
## NULL
## 
## $uniquenesses
##         1         2         3         4         5         6 
## 0.5698459 0.2292629 0.3975502 0.4406720 0.4704202 0.6413141
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = LETTR2_cor, nfactors = 2, rotate = "TargetQ", Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##     MR1   MR2   h2   u2 com
## 1  0.61  0.16 0.43 0.57 1.1
## 2  0.88 -0.03 0.77 0.23 1.0
## 3  0.78 -0.07 0.60 0.40 1.0
## 4 -0.07  0.75 0.56 0.44 1.0
## 5 -0.13  0.73 0.53 0.47 1.1
## 6  0.32  0.47 0.36 0.64 1.8
## 
##                        MR1  MR2
## SS loadings           1.89 1.36
## Proportion Var        0.32 0.23
## Cumulative Var        0.32 0.54
## Proportion Explained  0.58 0.42
## Cumulative Proportion 0.58 1.00
## 
##  With factor correlations of 
##      MR1  MR2
## MR1 1.00 0.13
## MR2 0.13 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  15  and the objective function was  1.75
## The degrees of freedom for the model are 4  and the objective function was  0.02 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.04 
## 
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR1  MR2
## Correlation of scores with factors             0.92 0.86
## Multiple R square of scores with factors       0.85 0.74
## Minimum correlation of possible factor scores  0.71 0.48

CFI

1-((out_targetQ$STATISTIC - out_targetQ$dof)/(out_targetQ$null.chisq- out_targetQ$null.dof))
## numeric(0)