##load packages
library(psych)
library(GPArotation)
library(plyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(lavaan)
## This is lavaan 0.5-18
## lavaan is BETA software! Please report any bugs.
library(semPlot)
# data preparation
data <- read.csv("~/Psychometric_study_data/allsurveysYT1.csv")
purposescales<-select(data, PWB_1, PWB_2, PWB_3, PWB_4, PWB_5, PWB_6, PWB_7, PWB_8, PWB_9, APSI_1, APSI_2,  APSI_3,  APSI_4,  APSI_5,  APSI_6, APSI_7, APSI_8, LET_1, LET_2, LET_3,  LET_4,  LET_5,  LET_6, MLQ_1, MLQ_2, MLQ_3, MLQ_4, MLQ_5, MLQ_6,MLQ_7, MLQ_8, MLQ_9, MLQ_10)

purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))
purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 33]
## 
##    PWB_1 PWB_2 PWB_3 PWB_4 PWB_5 PWB_6 PWB_7 PWB_8 PWB_9 APSI_1 APSI_2
## 1      4     3     5     2     4     5     4     3     6      2      4
## 2      4     5     5     2     2     5     3     2     5      4      3
## 3      5     6     5     6     1     4     6     3     6      3      4
## 4      2     2     4     4     3     4     5     4     4      4      4
## 5      2     2     3     3     4     3     2     3     4      3      3
## 6      5     4     6     5     3     4     3     4     6      3      4
## 7      2     2     5     2     1     4     3     3     3      2      2
## 8      6     6     5     1     2     4     4     4     6      3      3
## 9      5     5     5     5     1     5     5     5     6      4      5
## 10     6     6     3     3     2     6     6     3     6      2      2
## ..   ...   ...   ...   ...   ...   ...   ...   ...   ...    ...    ...
## Variables not shown: APSI_3 (dbl), APSI_4 (dbl), APSI_5 (dbl), APSI_6
##   (dbl), APSI_7 (dbl), APSI_8 (dbl), LET_1 (dbl), LET_2 (dbl), LET_3
##   (dbl), LET_4 (dbl), LET_5 (dbl), LET_6 (dbl), MLQ_1 (dbl), MLQ_2 (dbl),
##   MLQ_3 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_7 (dbl), MLQ_8
##   (dbl), MLQ_9 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  33 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_3: num  4 4 4 5 4 4 4 4 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33")
allpurpose_cor <- corFiml(purposescales)#uses FIML for missing data
#purposescales<- purposescales[complete.cases(purposescales[,]),]
##EFA
##number of factors
##parallal analysis and scree plot
parallel<-fa.parallel(allpurpose_cor, n.obs=1160, fm="ml")

## Parallel analysis suggests that the number of factors =  6  and the number of components =  4
#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]  7.730731192  4.950650230  2.243581737  0.755933990  0.401718885
##  [6]  0.360340781  0.147044868  0.093252394  0.007217009 -0.060354182
## [11] -0.074183953 -0.093075528 -0.130093202 -0.158699903 -0.178925535
## [16] -0.197950826 -0.208254842 -0.254801526 -0.308713218 -0.330945389
## [21] -0.384128630 -0.403914929 -0.431176794 -0.451596694 -0.492232522
## [26] -0.540555152 -0.558665916 -0.578338836 -0.597344981 -0.652793430
## [31] -0.665428781 -0.691380869 -0.725135629
#over 1=3, over .7=4
#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(allpurpose_cor), cor = TRUE)
## Call:
## princomp(x = na.omit(allpurpose_cor), cor = TRUE)
## 
## Standard deviations:
##    Comp.1    Comp.2    Comp.3    Comp.4    Comp.5    Comp.6    Comp.7 
## 3.6767670 3.3625851 1.7596533 1.0250228 0.8797408 0.7610443 0.5956521 
##    Comp.8    Comp.9   Comp.10   Comp.11   Comp.12   Comp.13   Comp.14 
## 0.5490586 0.5037634 0.4666216 0.4294245 0.3722103 0.3570967 0.3376847 
##   Comp.15   Comp.16   Comp.17   Comp.18   Comp.19   Comp.20   Comp.21 
## 0.3320795 0.3212987 0.3098279 0.2904436 0.2677999 0.2578405 0.2427510 
##   Comp.22   Comp.23   Comp.24   Comp.25   Comp.26   Comp.27   Comp.28 
## 0.2324844 0.2244075 0.2166477 0.2090026 0.1868175 0.1851999 0.1803107 
##   Comp.29   Comp.30   Comp.31   Comp.32   Comp.33 
## 0.1674579 0.1581687 0.1503039 0.1362795 0.0000000 
## 
##  33  variables and  33 observations.
parallel2<-princomp(na.omit(allpurpose_cor), cor = TRUE)
summary(parallel2)
## Importance of components:
##                          Comp.1    Comp.2     Comp.3     Comp.4     Comp.5
## Standard deviation     3.676767 3.3625851 1.75965332 1.02502280 0.87974077
## Proportion of Variance 0.409655 0.3426357 0.09382969 0.03183854 0.02345284
## Cumulative Proportion  0.409655 0.7522907 0.84612041 0.87795895 0.90141179
##                            Comp.6     Comp.7      Comp.8      Comp.9
## Standard deviation     0.76104425 0.59565208 0.549058625 0.503763408
## Proportion of Variance 0.01755116 0.01075156 0.009135314 0.007690229
## Cumulative Proportion  0.91896295 0.92971451 0.938849824 0.946540054
##                            Comp.10     Comp.11     Comp.12     Comp.13
## Standard deviation     0.466621586 0.429424474 0.372210311 0.357096678
## Proportion of Variance 0.006598052 0.005588042 0.004198197 0.003864183
## Cumulative Proportion  0.953138106 0.958726147 0.962924345 0.966788528
##                            Comp.14     Comp.15     Comp.16     Comp.17
## Standard deviation     0.337684660 0.332079545 0.321298741 0.309827909
## Proportion of Variance 0.003455483 0.003341722 0.003128269 0.002908889
## Cumulative Proportion  0.970244010 0.973585732 0.976714001 0.979622890
##                            Comp.18     Comp.19     Comp.20     Comp.21
## Standard deviation     0.290443605 0.267799890 0.257840516 0.242750971
## Proportion of Variance 0.002556288 0.002173236 0.002014598 0.001785698
## Cumulative Proportion  0.982179178 0.984352414 0.986367012 0.988152710
##                            Comp.22     Comp.23     Comp.24   Comp.25
## Standard deviation     0.232484357 0.224407497 0.216647656 0.2090026
## Proportion of Variance 0.001637848 0.001526022 0.001422309 0.0013237
## Cumulative Proportion  0.989790557 0.991316579 0.992738889 0.9940626
##                          Comp.26     Comp.27      Comp.28      Comp.29
## Standard deviation     0.1868175 0.185199926 0.1803106683 0.1674578644
## Proportion of Variance 0.0010576 0.001039364 0.0009852102 0.0008497617
## Cumulative Proportion  0.9951202 0.996159552 0.9971447624 0.9979945242
##                             Comp.30      Comp.31      Comp.32 Comp.33
## Standard deviation     0.1581687261 0.1503038864 0.1362794871       0
## Proportion of Variance 0.0007581014 0.0006845836 0.0005627909       0
## Cumulative Proportion  0.9987526255 0.9994372091 1.0000000000       1
plot(parallel2)##results show at least two factors

#simple structure
twofactor<-fa(allpurpose_cor, nfactors=2, rotate="oblimin", fm="ml")
twofactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 2, rotate = "oblimin", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML1   ML2    h2   u2 com
## 1  -0.19  0.58 0.346 0.65 1.2
## 2   0.07  0.41 0.176 0.82 1.1
## 3  -0.03  0.80 0.641 0.36 1.0
## 4   0.34  0.49 0.397 0.60 1.8
## 5  -0.01 -0.72 0.525 0.47 1.0
## 6   0.19  0.53 0.341 0.66 1.2
## 7   0.70  0.04 0.497 0.50 1.0
## 8   0.60  0.10 0.376 0.62 1.1
## 9   0.02  0.33 0.114 0.89 1.0
## 10  0.84 -0.10 0.695 0.30 1.0
## 11  0.77 -0.06 0.581 0.42 1.0
## 12  0.22  0.33 0.174 0.83 1.8
## 13  0.79 -0.08 0.618 0.38 1.0
## 14  0.66 -0.16 0.436 0.56 1.1
## 15  0.05 -0.80 0.635 0.36 1.0
## 16  0.75 -0.10 0.553 0.45 1.0
## 17  0.79 -0.11 0.616 0.38 1.0
## 18  0.12  0.66 0.471 0.53 1.1
## 19  0.62  0.00 0.383 0.62 1.0
## 20 -0.12  0.79 0.623 0.38 1.0
## 21  0.54  0.00 0.297 0.70 1.0
## 22 -0.17  0.77 0.596 0.40 1.1
## 23  0.37  0.42 0.349 0.65 2.0
## 24  0.51  0.37 0.436 0.56 1.8
## 25  0.10 -0.22 0.055 0.95 1.4
## 26  0.24 -0.19 0.081 0.92 1.9
## 27  0.66  0.21 0.513 0.49 1.2
## 28  0.52  0.41 0.480 0.52 1.9
## 29  0.67  0.19 0.517 0.48 1.2
## 30  0.15 -0.11 0.031 0.97 1.8
## 31  0.20 -0.11 0.047 0.95 1.6
## 32  0.14  0.62 0.422 0.58 1.1
## 33  0.01 -0.20 0.041 0.96 1.0
## 
##                        ML1  ML2
## SS loadings           7.12 5.94
## Proportion Var        0.22 0.18
## Cumulative Var        0.22 0.40
## Proportion Explained  0.54 0.46
## Cumulative Proportion 0.54 1.00
## 
##  With factor correlations of 
##      ML1  ML2
## ML1 1.00 0.11
## ML2 0.11 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  528  and the objective function was  18.23
## The degrees of freedom for the model are 463  and the objective function was  5.2 
## 
## The root mean square of the residuals (RMSR) is  0.09 
## The df corrected root mean square of the residuals is  0.1 
## 
## Fit based upon off diagonal values = 0.9
## Measures of factor score adequacy             
##                                                 ML1  ML2
## Correlation of scores with factors             0.97 0.96
## Multiple R square of scores with factors       0.94 0.93
## Minimum correlation of possible factor scores  0.88 0.85
#CFI
1-((twofactor$STATISTIC - twofactor$dof)/(twofactor$null.chisq- twofactor$null.dof))
## numeric(0)
fa2latex(fa(allpurpose_cor,2,n.obs=1160, rotate="oblimin", fm="ml"),heading="2f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 2, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  2f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r }
##  \multicolumn{ 5 }{l}{ 2f } \cr 
##  \hline Variable  &   ML1  &  ML2  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.19  &  \bf{ 0.58}  &  0.35  &  0.65  &  1.21 \cr 
##  2   &   0.07  &  \bf{ 0.41}  &  0.18  &  0.82  &  1.06 \cr 
##  3   &  -0.03  &  \bf{ 0.80}  &  0.64  &  0.36  &  1.00 \cr 
##  4   &  \bf{ 0.34}  &  \bf{ 0.49}  &  0.40  &  0.60  &  1.78 \cr 
##  5   &  -0.01  &  \bf{-0.72}  &  0.53  &  0.47  &  1.00 \cr 
##  6   &   0.19  &  \bf{ 0.53}  &  0.34  &  0.66  &  1.24 \cr 
##  7   &  \bf{ 0.70}  &   0.04  &  0.50  &  0.50  &  1.01 \cr 
##  8   &  \bf{ 0.60}  &   0.10  &  0.38  &  0.62  &  1.05 \cr 
##  9   &   0.02  &  \bf{ 0.33}  &  0.11  &  0.89  &  1.01 \cr 
##  10   &  \bf{ 0.84}  &  -0.10  &  0.70  &  0.30  &  1.03 \cr 
##  11   &  \bf{ 0.77}  &  -0.06  &  0.58  &  0.42  &  1.01 \cr 
##  12   &   0.22  &  \bf{ 0.33}  &  0.17  &  0.83  &  1.76 \cr 
##  13   &  \bf{ 0.79}  &  -0.08  &  0.62  &  0.38  &  1.02 \cr 
##  14   &  \bf{ 0.66}  &  -0.16  &  0.44  &  0.56  &  1.12 \cr 
##  15   &   0.05  &  \bf{-0.80}  &  0.64  &  0.36  &  1.01 \cr 
##  16   &  \bf{ 0.75}  &  -0.10  &  0.55  &  0.45  &  1.03 \cr 
##  17   &  \bf{ 0.79}  &  -0.11  &  0.62  &  0.38  &  1.04 \cr 
##  18   &   0.12  &  \bf{ 0.66}  &  0.47  &  0.53  &  1.07 \cr 
##  19   &  \bf{ 0.62}  &   0.00  &  0.38  &  0.62  &  1.00 \cr 
##  20   &  -0.12  &  \bf{ 0.79}  &  0.62  &  0.38  &  1.04 \cr 
##  21   &  \bf{ 0.54}  &   0.00  &  0.30  &  0.70  &  1.00 \cr 
##  22   &  -0.17  &  \bf{ 0.77}  &  0.60  &  0.40  &  1.09 \cr 
##  23   &  \bf{ 0.37}  &  \bf{ 0.42}  &  0.35  &  0.65  &  1.98 \cr 
##  24   &  \bf{ 0.51}  &  \bf{ 0.37}  &  0.44  &  0.56  &  1.81 \cr 
##  25   &   0.10  &  -0.22  &  0.05  &  0.95  &  1.43 \cr 
##  26   &   0.24  &  -0.19  &  0.08  &  0.92  &  1.90 \cr 
##  27   &  \bf{ 0.66}  &   0.21  &  0.51  &  0.49  &  1.19 \cr 
##  28   &  \bf{ 0.52}  &  \bf{ 0.41}  &  0.48  &  0.52  &  1.90 \cr 
##  29   &  \bf{ 0.67}  &   0.19  &  0.52  &  0.48  &  1.16 \cr 
##  30   &   0.15  &  -0.11  &  0.03  &  0.97  &  1.82 \cr 
##  31   &   0.20  &  -0.11  &  0.05  &  0.95  &  1.57 \cr 
##  32   &   0.14  &  \bf{ 0.62}  &  0.42  &  0.58  &  1.10 \cr 
##  33   &   0.01  &  -0.20  &  0.04  &  0.96  &  1.01 \cr 
## \hline \cr SS loadings & 7.12 &  5.94 &  \cr  
## \cr 
##             \hline \cr 
## ML1   & 1.00 & 0.11 \cr 
##  ML2   & 0.11 & 1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,3,n.obs=1160, rotate="oblimin", fm="ml"),heading="3f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 3, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  3f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r }
##  \multicolumn{ 6 }{l}{ 3f } \cr 
##  \hline Variable  &   ML1  &  ML2  &  ML3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.19  &  \bf{ 0.57}  &  -0.04  &  0.35  &  0.65  &  1.23 \cr 
##  2   &   0.08  &  \bf{ 0.39}  &  -0.08  &  0.18  &  0.82  &  1.18 \cr 
##  3   &  -0.04  &  \bf{ 0.80}  &   0.00  &  0.64  &  0.36  &  1.01 \cr 
##  4   &  \bf{ 0.35}  &  \bf{ 0.47}  &  -0.10  &  0.40  &  0.60  &  1.96 \cr 
##  5   &   0.01  &  \bf{-0.73}  &  -0.01  &  0.53  &  0.47  &  1.00 \cr 
##  6   &   0.15  &  \bf{ 0.58}  &   0.17  &  0.39  &  0.61  &  1.31 \cr 
##  7   &  \bf{ 0.69}  &   0.06  &   0.06  &  0.50  &  0.50  &  1.03 \cr 
##  8   &  \bf{ 0.60}  &   0.09  &  -0.03  &  0.38  &  0.62  &  1.05 \cr 
##  9   &   0.02  &  \bf{ 0.33}  &  -0.01  &  0.11  &  0.89  &  1.01 \cr 
##  10   &  \bf{ 0.85}  &  -0.11  &  -0.05  &  0.71  &  0.29  &  1.04 \cr 
##  11   &  \bf{ 0.78}  &  -0.07  &  -0.07  &  0.60  &  0.40  &  1.03 \cr 
##  12   &   0.19  &  \bf{ 0.36}  &   0.12  &  0.19  &  0.81  &  1.80 \cr 
##  13   &  \bf{ 0.80}  &  -0.09  &  -0.04  &  0.63  &  0.37  &  1.03 \cr 
##  14   &  \bf{ 0.65}  &  -0.15  &   0.06  &  0.44  &  0.56  &  1.12 \cr 
##  15   &   0.05  &  \bf{-0.79}  &   0.05  &  0.64  &  0.36  &  1.02 \cr 
##  16   &  \bf{ 0.73}  &  -0.08  &   0.09  &  0.55  &  0.45  &  1.05 \cr 
##  17   &  \bf{ 0.79}  &  -0.11  &  -0.01  &  0.62  &  0.38  &  1.04 \cr 
##  18   &   0.14  &  \bf{ 0.63}  &  -0.17  &  0.49  &  0.51  &  1.24 \cr 
##  19   &  \bf{ 0.62}  &   0.00  &  -0.01  &  0.39  &  0.61  &  1.00 \cr 
##  20   &  -0.12  &  \bf{ 0.79}  &  -0.04  &  0.62  &  0.38  &  1.05 \cr 
##  21   &  \bf{ 0.54}  &   0.00  &   0.02  &  0.29  &  0.71  &  1.00 \cr 
##  22   &  -0.18  &  \bf{ 0.78}  &   0.02  &  0.60  &  0.40  &  1.11 \cr 
##  23   &  \bf{ 0.36}  &  \bf{ 0.43}  &   0.06  &  0.35  &  0.65  &  1.97 \cr 
##  24   &  \bf{ 0.49}  &  \bf{ 0.39}  &   0.07  &  0.44  &  0.56  &  1.95 \cr 
##  25   &  -0.03  &  -0.07  &  \bf{ 0.79}  &  0.64  &  0.36  &  1.02 \cr 
##  26   &   0.12  &  -0.04  &  \bf{ 0.73}  &  0.57  &  0.43  &  1.06 \cr 
##  27   &  \bf{ 0.65}  &   0.23  &   0.08  &  0.52  &  0.48  &  1.27 \cr 
##  28   &  \bf{ 0.49}  &  \bf{ 0.44}  &   0.12  &  0.50  &  0.50  &  2.11 \cr 
##  29   &  \bf{ 0.66}  &   0.20  &   0.03  &  0.52  &  0.48  &  1.19 \cr 
##  30   &   0.03  &   0.04  &  \bf{ 0.73}  &  0.53  &  0.47  &  1.01 \cr 
##  31   &   0.08  &   0.04  &  \bf{ 0.73}  &  0.55  &  0.45  &  1.03 \cr 
##  32   &   0.16  &  \bf{ 0.59}  &  -0.14  &  0.43  &  0.57  &  1.25 \cr 
##  33   &  -0.13  &  -0.04  &  \bf{ 0.82}  &  0.68  &  0.32  &  1.06 \cr 
## \hline \cr SS loadings & 7 &  5.86 &  3.09 &  \cr  
## \cr 
##             \hline \cr 
## ML1   &  1.00 &  0.11 &  0.11 \cr 
##  ML2   &  0.11 &  1.00 & -0.12 \cr 
##  ML3   &  0.11 & -0.12 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,4,n.obs=1160, rotate="oblimin", fm="ml"),heading="4f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 4, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  4f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ 4f } \cr 
##  \hline Variable  &   ML1  &  ML2  &  ML3  &  ML4  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.08  &  \bf{ 0.64}  &  -0.02  &  -0.16  &  0.39  &  0.61  &  1.16 \cr 
##  2   &   0.21  &  \bf{ 0.50}  &  -0.06  &  -0.20  &  0.25  &  0.75  &  1.75 \cr 
##  3   &  -0.01  &  \bf{ 0.82}  &   0.01  &  -0.01  &  0.66  &  0.34  &  1.00 \cr 
##  4   &  \bf{ 0.36}  &  \bf{ 0.50}  &  -0.09  &   0.03  &  0.42  &  0.58  &  1.91 \cr 
##  5   &  -0.04  &  \bf{-0.76}  &  -0.02  &   0.03  &  0.56  &  0.44  &  1.01 \cr 
##  6   &   0.08  &  \bf{ 0.53}  &   0.17  &   0.16  &  0.38  &  0.62  &  1.44 \cr 
##  7   &  \bf{ 0.63}  &   0.06  &   0.06  &   0.11  &  0.50  &  0.50  &  1.10 \cr 
##  8   &  \bf{ 0.58}  &   0.12  &  -0.03  &   0.04  &  0.39  &  0.61  &  1.10 \cr 
##  9   &   0.24  &  \bf{ 0.51}  &   0.02  &  \bf{-0.36}  &  0.25  &  0.75  &  2.30 \cr 
##  10   &  \bf{ 0.78}  &  -0.11  &  -0.05  &   0.14  &  0.71  &  0.29  &  1.11 \cr 
##  11   &  \bf{ 0.74}  &  -0.04  &  -0.07  &   0.08  &  0.60  &  0.40  &  1.05 \cr 
##  12   &   0.15  &  \bf{ 0.33}  &   0.12  &   0.11  &  0.19  &  0.81  &  1.93 \cr 
##  13   &  \bf{ 0.75}  &  -0.06  &  -0.04  &   0.09  &  0.63  &  0.37  &  1.05 \cr 
##  14   &  \bf{ 0.75}  &  -0.03  &   0.08  &  -0.15  &  0.50  &  0.50  &  1.11 \cr 
##  15   &   0.18  &  \bf{-0.68}  &   0.07  &  -0.26  &  0.65  &  0.35  &  1.46 \cr 
##  16   &  \bf{ 0.75}  &   0.00  &   0.10  &  -0.02  &  0.58  &  0.42  &  1.04 \cr 
##  17   &  \bf{ 0.79}  &  -0.05  &   0.00  &   0.02  &  0.64  &  0.36  &  1.01 \cr 
##  18   &   0.05  &  \bf{ 0.56}  &  -0.17  &   0.19  &  0.48  &  0.52  &  1.47 \cr 
##  19   &  \bf{ 0.59}  &   0.03  &   0.00  &   0.06  &  0.39  &  0.61  &  1.03 \cr 
##  20   &  -0.11  &  \bf{ 0.77}  &  -0.04  &   0.03  &  0.62  &  0.38  &  1.05 \cr 
##  21   &  \bf{ 0.55}  &   0.05  &   0.02  &   0.00  &  0.31  &  0.69  &  1.02 \cr 
##  22   &  -0.19  &  \bf{ 0.74}  &   0.02  &   0.06  &  0.60  &  0.40  &  1.15 \cr 
##  23   &   0.30  &  \bf{ 0.41}  &   0.06  &   0.13  &  0.35  &  0.65  &  2.10 \cr 
##  24   &   0.08  &   0.10  &   0.03  &  \bf{ 0.76}  &  0.70  &  0.30  &  1.06 \cr 
##  25   &   0.01  &  -0.02  &  \bf{ 0.80}  &  -0.07  &  0.65  &  0.35  &  1.02 \cr 
##  26   &   0.10  &  -0.03  &  \bf{ 0.72}  &   0.04  &  0.56  &  0.44  &  1.05 \cr 
##  27   &  \bf{ 0.36}  &   0.04  &   0.05  &  \bf{ 0.53}  &  0.60  &  0.40  &  1.81 \cr 
##  28   &   0.17  &   0.23  &   0.09  &  \bf{ 0.59}  &  0.61  &  0.39  &  1.54 \cr 
##  29   &  \bf{ 0.37}  &   0.01  &   0.00  &  \bf{ 0.54}  &  0.62  &  0.38  &  1.76 \cr 
##  30   &  -0.05  &   0.00  &  \bf{ 0.72}  &   0.14  &  0.53  &  0.47  &  1.08 \cr 
##  31   &   0.08  &   0.06  &  \bf{ 0.73}  &   0.01  &  0.55  &  0.45  &  1.04 \cr 
##  32   &   0.05  &  \bf{ 0.51}  &  -0.15  &   0.21  &  0.43  &  0.57  &  1.54 \cr 
##  33   &  -0.12  &  -0.03  &  \bf{ 0.82}  &  -0.01  &  0.68  &  0.32  &  1.05 \cr 
## \hline \cr SS loadings & 5.98 &  5.44 &  3.08 &  2.48 &  \cr  
## \cr 
##             \hline \cr 
## ML1   &  1.00 &  0.02 &  0.10 &  0.45 \cr 
##  ML2   &  0.02 &  1.00 & -0.15 &  0.33 \cr 
##  ML3   &  0.10 & -0.15 &  1.00 &  0.04 \cr 
##  ML4   &  0.45 &  0.33 &  0.04 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,5,n.obs=1160, rotate="oblimin", fm="ml"),heading="5f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 5, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  5f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ 5f } \cr 
##  \hline Variable  &   ML2  &  ML1  &  ML3  &  ML4  &  ML5  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  \bf{ 0.66}  &   0.13  &  -0.04  &  -0.17  &  -0.27  &  0.46  &  0.54  &  1.58 \cr 
##  2   &  \bf{ 0.50}  &   0.22  &  -0.07  &  -0.18  &   0.01  &  0.25  &  0.75  &  1.70 \cr 
##  3   &  \bf{ 0.82}  &  -0.11  &   0.01  &   0.00  &   0.15  &  0.69  &  0.31  &  1.11 \cr 
##  4   &  \bf{ 0.49}  &  \bf{ 0.33}  &  -0.10  &   0.07  &   0.04  &  0.42  &  0.58  &  1.91 \cr 
##  5   &  \bf{-0.76}  &  -0.08  &  -0.02  &   0.02  &   0.05  &  0.57  &  0.43  &  1.03 \cr 
##  6   &  \bf{ 0.52}  &   0.19  &   0.15  &   0.18  &  -0.17  &  0.42  &  0.58  &  1.99 \cr 
##  7   &   0.06  &  \bf{ 0.43}  &   0.06  &   0.16  &   0.28  &  0.51  &  0.49  &  2.12 \cr 
##  8   &   0.12  &  \bf{ 0.48}  &  -0.03  &   0.09  &   0.14  &  0.38  &  0.62  &  1.40 \cr 
##  9   &  \bf{ 0.51}  &   0.18  &   0.03  &  \bf{-0.34}  &   0.12  &  0.25  &  0.75  &  2.15 \cr 
##  10   &  -0.11  &  \bf{ 0.59}  &  -0.05  &   0.19  &   0.24  &  0.70  &  0.30  &  1.65 \cr 
##  11   &  -0.05  &  \bf{ 0.52}  &  -0.06  &   0.14  &   0.30  &  0.61  &  0.39  &  1.83 \cr 
##  12   &  \bf{ 0.33}  &   0.20  &   0.11  &   0.13  &  -0.09  &  0.21  &  0.79  &  2.49 \cr 
##  13   &  -0.07  &  \bf{ 0.76}  &  -0.05  &   0.14  &   0.00  &  0.67  &  0.33  &  1.09 \cr 
##  14   &  -0.03  &  \bf{ 0.56}  &   0.09  &  -0.11  &   0.26  &  0.49  &  0.51  &  1.55 \cr 
##  15   &  \bf{-0.66}  &   0.12  &   0.08  &  -0.27  &   0.11  &  0.65  &  0.35  &  1.50 \cr 
##  16   &   0.01  &  \bf{ 0.82}  &   0.09  &   0.01  &  -0.06  &  0.65  &  0.35  &  1.03 \cr 
##  17   &  -0.05  &  \bf{ 0.80}  &  -0.01  &   0.06  &   0.00  &  0.68  &  0.32  &  1.02 \cr 
##  18   &  \bf{ 0.54}  &  -0.06  &  -0.17  &   0.22  &   0.13  &  0.49  &  0.51  &  1.73 \cr 
##  19   &   0.03  &   0.19  &   0.02  &   0.08  &  \bf{ 0.61}  &  0.57  &  0.43  &  1.23 \cr 
##  20   &  \bf{ 0.75}  &  -0.17  &  -0.04  &   0.05  &   0.07  &  0.63  &  0.37  &  1.13 \cr 
##  21   &   0.06  &   0.25  &   0.04  &   0.02  &  \bf{ 0.45}  &  0.39  &  0.61  &  1.64 \cr 
##  22   &  \bf{ 0.73}  &  -0.18  &   0.02  &   0.08  &  -0.03  &  0.60  &  0.40  &  1.15 \cr 
##  23   &  \bf{ 0.41}  &   0.11  &   0.07  &   0.16  &   0.26  &  0.38  &  0.62  &  2.32 \cr 
##  24   &   0.07  &   0.04  &   0.02  &  \bf{ 0.80}  &  -0.02  &  0.70  &  0.30  &  1.02 \cr 
##  25   &  -0.02  &  -0.02  &  \bf{ 0.80}  &  -0.07  &   0.05  &  0.65  &  0.35  &  1.02 \cr 
##  26   &  -0.03  &   0.03  &  \bf{ 0.73}  &   0.04  &   0.09  &  0.57  &  0.43  &  1.05 \cr 
##  27   &   0.02  &   0.17  &   0.05  &  \bf{ 0.58}  &   0.22  &  0.62  &  0.38  &  1.49 \cr 
##  28   &   0.20  &   0.12  &   0.08  &  \bf{ 0.63}  &   0.01  &  0.62  &  0.38  &  1.33 \cr 
##  29   &  -0.01  &   0.28  &  -0.01  &  \bf{ 0.59}  &   0.08  &  0.62  &  0.38  &  1.46 \cr 
##  30   &  -0.01  &   0.02  &  \bf{ 0.71}  &   0.14  &  -0.11  &  0.54  &  0.46  &  1.13 \cr 
##  31   &   0.06  &   0.07  &  \bf{ 0.73}  &   0.02  &   0.01  &  0.55  &  0.45  &  1.03 \cr 
##  32   &  \bf{ 0.49}  &   0.03  &  -0.16  &   0.24  &   0.00  &  0.43  &  0.57  &  1.68 \cr 
##  33   &  -0.02  &  -0.10  &  \bf{ 0.82}  &  -0.02  &  -0.03  &  0.67  &  0.33  &  1.03 \cr 
## \hline \cr SS loadings & 5.35 &  4.57 &  3.09 &  2.89 &  1.73 &  \cr  
## \cr 
##             \hline \cr 
## ML2   &  1.00 & -0.01 & -0.15 &  0.33 & -0.01 \cr 
##  ML1   & -0.01 &  1.00 &  0.11 &  0.44 &  0.48 \cr 
##  ML3   & -0.15 &  0.11 &  1.00 &  0.05 &  0.02 \cr 
##  ML4   &  0.33 &  0.44 &  0.05 &  1.00 &  0.29 \cr 
##  ML5   & -0.01 &  0.48 &  0.02 &  0.29 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,6,n.obs=1160, rotate="oblimin", fm="ml"),heading="6f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 6, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  6f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r }
##  \multicolumn{ 9 }{l}{ 6f } \cr 
##  \hline Variable  &   ML2  &  ML1  &  ML3  &  ML4  &  ML5  &  ML6  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  \bf{ 0.63}  &   0.13  &  -0.04  &  -0.15  &  -0.26  &   0.10  &  0.46  &  0.54  &  1.62 \cr 
##  2   &  \bf{ 0.59}  &   0.18  &  -0.01  &  -0.11  &  -0.05  &  -0.23  &  0.33  &  0.67  &  1.61 \cr 
##  3   &  \bf{ 0.77}  &  -0.15  &   0.00  &   0.03  &   0.16  &   0.08  &  0.69  &  0.31  &  1.19 \cr 
##  4   &  \bf{ 0.58}  &   0.28  &  -0.04  &   0.16  &  -0.03  &  -0.26  &  0.53  &  0.47  &  2.13 \cr 
##  5   &  \bf{-0.71}  &  -0.06  &   0.00  &   0.00  &   0.02  &  -0.13  &  0.56  &  0.44  &  1.08 \cr 
##  6   &  \bf{ 0.40}  &   0.22  &   0.09  &   0.13  &  -0.11  &  \bf{ 0.40}  &  0.50  &  0.50  &  3.06 \cr 
##  7   &   0.04  &  \bf{ 0.41}  &   0.05  &   0.16  &   0.30  &   0.04  &  0.51  &  0.49  &  2.29 \cr 
##  8   &   0.08  &  \bf{ 0.46}  &  -0.05  &   0.09  &   0.18  &   0.09  &  0.39  &  0.61  &  1.57 \cr 
##  9   &  \bf{ 0.59}  &   0.13  &   0.07  &  -0.28  &   0.09  &  -0.21  &  0.31  &  0.69  &  1.91 \cr 
##  10   &  -0.09  &  \bf{ 0.56}  &  -0.04  &   0.22  &   0.25  &  -0.10  &  0.71  &  0.29  &  1.90 \cr 
##  11   &  -0.05  &  \bf{ 0.49}  &  -0.06  &   0.15  &  \bf{ 0.33}  &  -0.02  &  0.61  &  0.39  &  2.05 \cr 
##  12   &   0.18  &   0.25  &   0.03  &   0.03  &   0.01  &  \bf{ 0.49}  &  0.38  &  0.62  &  1.82 \cr 
##  13   &  -0.07  &  \bf{ 0.73}  &  -0.05  &   0.15  &   0.04  &   0.02  &  0.67  &  0.33  &  1.13 \cr 
##  14   &  -0.06  &  \bf{ 0.56}  &   0.05  &  -0.14  &  \bf{ 0.32}  &   0.11  &  0.52  &  0.48  &  1.89 \cr 
##  15   &  \bf{-0.61}  &   0.14  &   0.08  &  -0.29  &   0.09  &  -0.13  &  0.65  &  0.35  &  1.76 \cr 
##  16   &  -0.01  &  \bf{ 0.79}  &   0.08  &   0.02  &  -0.01  &   0.06  &  0.65  &  0.35  &  1.03 \cr 
##  17   &  -0.03  &  \bf{ 0.77}  &   0.00  &   0.10  &   0.01  &  -0.06  &  0.69  &  0.31  &  1.05 \cr 
##  18   &  \bf{ 0.54}  &  -0.10  &  -0.15  &   0.27  &   0.11  &  -0.05  &  0.50  &  0.50  &  1.89 \cr 
##  19   &   0.04  &   0.14  &   0.02  &   0.10  &  \bf{ 0.62}  &  -0.09  &  0.56  &  0.44  &  1.21 \cr 
##  20   &  \bf{ 0.71}  &  -0.19  &  -0.04  &   0.08  &   0.06  &   0.07  &  0.62  &  0.38  &  1.22 \cr 
##  21   &   0.03  &   0.22  &   0.02  &   0.00  &  \bf{ 0.51}  &   0.07  &  0.42  &  0.58  &  1.40 \cr 
##  22   &  \bf{ 0.67}  &  -0.19  &   0.00  &   0.08  &  -0.01  &   0.16  &  0.60  &  0.40  &  1.33 \cr 
##  23   &  \bf{ 0.31}  &   0.09  &   0.01  &   0.11  &  \bf{ 0.36}  &   0.28  &  0.46  &  0.54  &  3.24 \cr 
##  24   &   0.02  &   0.03  &   0.02  &  \bf{ 0.79}  &  -0.01  &   0.10  &  0.69  &  0.31  &  1.04 \cr 
##  25   &   0.01  &  -0.03  &  \bf{ 0.82}  &  -0.05  &   0.03  &  -0.08  &  0.66  &  0.34  &  1.03 \cr 
##  26   &  -0.02  &   0.02  &  \bf{ 0.74}  &   0.06  &   0.08  &  -0.05  &  0.57  &  0.43  &  1.05 \cr 
##  27   &   0.03  &   0.12  &   0.08  &  \bf{ 0.63}  &   0.20  &  -0.10  &  0.64  &  0.36  &  1.38 \cr 
##  28   &   0.15  &   0.11  &   0.07  &  \bf{ 0.63}  &   0.03  &   0.12  &  0.61  &  0.39  &  1.29 \cr 
##  29   &   0.01  &   0.24  &   0.03  &  \bf{ 0.65}  &   0.04  &  -0.11  &  0.64  &  0.36  &  1.35 \cr 
##  30   &  -0.01  &   0.02  &  \bf{ 0.72}  &   0.15  &  -0.12  &   0.02  &  0.55  &  0.45  &  1.15 \cr 
##  31   &   0.06  &   0.06  &  \bf{ 0.73}  &   0.02  &   0.01  &   0.01  &  0.55  &  0.45  &  1.03 \cr 
##  32   &  \bf{ 0.48}  &   0.00  &  -0.14  &   0.28  &  -0.01  &  -0.01  &  0.44  &  0.56  &  1.81 \cr 
##  33   &  -0.05  &  -0.09  &  \bf{ 0.80}  &  -0.04  &  -0.02  &   0.09  &  0.68  &  0.32  &  1.07 \cr 
## \hline \cr SS loadings & 5.03 &  4.27 &  3.07 &  3.09 &  1.94 &  0.95 &  \cr  
## \cr 
##             \hline \cr 
## ML2   &  1.00 &  0.00 & -0.16 &  0.33 &  0.02 &  0.25 \cr 
##  ML1   &  0.00 &  1.00 &  0.12 &  0.43 &  0.49 & -0.11 \cr 
##  ML3   & -0.16 &  0.12 &  1.00 &  0.02 &  0.05 &  0.09 \cr 
##  ML4   &  0.33 &  0.43 &  0.02 &  1.00 &  0.34 &  0.16 \cr 
##  ML5   &  0.02 &  0.49 &  0.05 &  0.34 &  1.00 & -0.05 \cr 
##  ML6   &  0.25 & -0.11 &  0.09 &  0.16 & -0.05 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}

threefactor<-fa(allpurpose_cor, nfactors=3, n.obs=1160, rotate=“oblimin”, fm=“ml”) threefactor #CFI 1-((threefactor\(STATISTIC - threefactor\)dof)/(threefactor\(null.chisq- threefactor\)null.dof))

fourfactor<-fa(allpurpose_cor, nfactors=4, n.obs=1160, rotate=“oblimin”, fm=“ml”) fourfactor #CFI 1-((fourfactor\(STATISTIC - fourfactor\)dof)/(fourfactor\(null.chisq- fourfactor\)null.dof)) fivefactor<-fa(allpurpose_cor, nfactors=5, n.obs=1160, rotate=“oblimin”, fm=“ml”) fivefactor #CFI 1-((fivefactor\(STATISTIC - fivefactor\)dof)/(fivefactor\(null.chisq- fivefactor\)null.dof)) sixfactor<-fa(allpurpose_cor, nfactors=6,n.obs=1160, rotate=“oblimin”, fm=“ml”) sixfactor #CFI 1-((sixfactor\(STATISTIC - sixfactor\)dof)/(sixfactor\(null.chisq- sixfactor\)null.dof))

threefactor2<-fa(allpurpose_cor[,-c(4,9,12,23)], nfactors=3,n.obs=1160, rotate=“oblimin”, fm=“ml”) threefactor2

fourfactor2<-fa(allpurpose_cor[,-c(4,9,12,23)], nfactors=4, n.obs=1160,rotate=“oblimin”, fm=“ml”) fourfactor2 ``` # EFA removing problematic qyestions: PWB_1, PWB_4, PWB_6, PWB_7, APSI_3, LET_4, LET_6, LET_3, MLQ_9, LET_5

data <- read.csv("~/Psychometric_study_data/allsurveysYT1.csv")
purposescales<-select(data, PWB_2, APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  APSI_5,  APSI_1,
LET_2,PWB_9, PWB_3, PWB_5,
MLQ_4, MLQ_5, MLQ_6, MLQ_1, APSI_6,LET_1,
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10
)
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales<- data.frame(apply(purposescales,2, as.numeric))
purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 23]
## 
##    PWB_2 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 APSI_5 APSI_1 LET_2 PWB_9 PWB_3
## 1      3      4      4     3      4      4      4      2     4     6     5
## 2      5      3      5     2      4      4      4      4     3     5     5
## 3      6      4      3     3      4      3      3      3     4     6     5
## 4      2      4      4     4      4      3      5      4     4     4     4
## 5      2      3      3     3      2      3      4      3     2     4     3
## 6      4      4      4     4      5      3      4      3     5     6     6
## 7      2      2      3     3      2      2      4      2     4     3     5
## 8      6      3      3     4      3      1      5      3     4     6     5
## 9      5      5      4     5      4      5      4      4     4     6     5
## 10     6      2      3     3      3      4      5      2     3     6     3
## ..   ...    ...    ...   ...    ...    ...    ...    ...   ...   ...   ...
## Variables not shown: PWB_5 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl),
##   MLQ_1 (dbl), APSI_6 (dbl), LET_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7
##   (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  23 variables:
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  2 3 3 5 3 1 3 3 1 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23")
allpurpose_cor <- corFiml(purposescales)# uses FIML for missing data
##EFA
##number of factors
##parallal analysis and scree plot
parallel<-fa.parallel(allpurpose_cor, n.obs=1160, fm="ml")

## Parallel analysis suggests that the number of factors =  5  and the number of components =  4
#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]  5.973003634  2.971378628  1.879465732  0.609861269  0.204705264
##  [6]  0.009613400 -0.007236128 -0.032086386 -0.061552741 -0.066591984
## [11] -0.118842752 -0.156361686 -0.187454653 -0.263044136 -0.353009389
## [16] -0.392184183 -0.437919231 -0.521115014 -0.538389770 -0.588426171
## [21] -0.647211831 -0.669589243 -0.693792994
#over 1=3, over .7=4
#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(allpurpose_cor), cor = TRUE)
## Call:
## princomp(x = na.omit(allpurpose_cor), cor = TRUE)
## 
## Standard deviations:
##       Comp.1       Comp.2       Comp.3       Comp.4       Comp.5 
## 3.458287e+00 2.140434e+00 1.834325e+00 9.742516e-01 5.766034e-01 
##       Comp.6       Comp.7       Comp.8       Comp.9      Comp.10 
## 5.188197e-01 4.796313e-01 4.520150e-01 4.434186e-01 3.810556e-01 
##      Comp.11      Comp.12      Comp.13      Comp.14      Comp.15 
## 3.533112e-01 3.293431e-01 2.911212e-01 2.674597e-01 2.536552e-01 
##      Comp.16      Comp.17      Comp.18      Comp.19      Comp.20 
## 2.419281e-01 2.234571e-01 2.172348e-01 2.122314e-01 2.015208e-01 
##      Comp.21      Comp.22      Comp.23 
## 1.994738e-01 1.789674e-01 8.918170e-09 
## 
##  23  variables and  23 observations.
parallel2<-princomp(na.omit(allpurpose_cor), cor = TRUE)
summary(parallel2)
## Importance of components:
##                          Comp.1    Comp.2    Comp.3     Comp.4     Comp.5
## Standard deviation     3.458287 2.1404338 1.8343255 0.97425156 0.57660345
## Proportion of Variance 0.519989 0.1991938 0.1462935 0.04126809 0.01445528
## Cumulative Proportion  0.519989 0.7191828 0.8654762 0.90674432 0.92119961
##                            Comp.6     Comp.7      Comp.8      Comp.9
## Standard deviation     0.51881967 0.47963134 0.452015041 0.443418593
## Proportion of Variance 0.01170321 0.01000201 0.008883374 0.008548698
## Cumulative Proportion  0.93290282 0.94290483 0.951788199 0.960336897
##                           Comp.10     Comp.11     Comp.12     Comp.13
## Standard deviation     0.38105560 0.353311159 0.329343115 0.291121172
## Proportion of Variance 0.00631319 0.005427338 0.004715952 0.003684849
## Cumulative Proportion  0.96665009 0.972077425 0.976793377 0.980478226
##                            Comp.14     Comp.15     Comp.16     Comp.17
## Standard deviation     0.267459674 0.253655171 0.241928133 0.223457145
## Proportion of Variance 0.003110203 0.002797432 0.002544749 0.002171004
## Cumulative Proportion  0.983588430 0.986385862 0.988930611 0.991101615
##                           Comp.18     Comp.19     Comp.20     Comp.21
## Standard deviation     0.21723477 0.212231380 0.201520769 0.199473841
## Proportion of Variance 0.00205178 0.001958355 0.001765679 0.001729992
## Cumulative Proportion  0.99315340 0.995111750 0.996877429 0.998607421
##                            Comp.22      Comp.23
## Standard deviation     0.178967356 8.918170e-09
## Proportion of Variance 0.001392579 3.457989e-18
## Cumulative Proportion  1.000000000 1.000000e+00
plot(parallel2)##results show at least two factors

#simple structure
twofactor<-fa(allpurpose_cor, nfactors=2, n.obs=1160,rotate="oblimin", fm="ml")
twofactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 2, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML1   ML2    h2   u2 com
## 1   0.05 -0.39 0.163 0.84 1.0
## 2   0.76  0.03 0.577 0.42 1.0
## 3   0.80  0.06 0.635 0.36 1.0
## 4   0.58 -0.10 0.361 0.64 1.1
## 5   0.76  0.10 0.561 0.44 1.0
## 6   0.80  0.11 0.626 0.37 1.0
## 7   0.66  0.18 0.440 0.56 1.1
## 8   0.84  0.08 0.698 0.30 1.0
## 9   0.59 -0.04 0.354 0.65 1.0
## 10  0.01 -0.30 0.092 0.91 1.0
## 11 -0.07 -0.77 0.579 0.42 1.0
## 12  0.03  0.70 0.489 0.51 1.0
## 13  0.65 -0.26 0.533 0.47 1.3
## 14  0.50 -0.44 0.489 0.51 2.0
## 15  0.66 -0.24 0.541 0.46 1.3
## 16  0.49 -0.42 0.472 0.53 2.0
## 17  0.09  0.81 0.650 0.35 1.0
## 18 -0.09  0.68 0.485 0.52 1.0
## 19  0.12  0.27 0.082 0.92 1.4
## 20  0.25  0.22 0.099 0.90 2.0
## 21  0.17  0.15 0.045 0.95 2.0
## 22  0.21  0.16 0.064 0.94 1.9
## 23  0.03  0.26 0.065 0.93 1.0
## 
##                        ML1  ML2
## SS loadings           5.81 3.29
## Proportion Var        0.25 0.14
## Cumulative Var        0.25 0.40
## Proportion Explained  0.64 0.36
## Cumulative Proportion 0.64 1.00
## 
##  With factor correlations of 
##       ML1   ML2
## ML1  1.00 -0.13
## ML2 -0.13  1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 2 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 208  and the objective function was  3.6 
## 
## The root mean square of the residuals (RMSR) is  0.12 
## The df corrected root mean square of the residuals is  0.13 
## 
## The harmonic number of observations is  1160 with the empirical chi square  8068.22  with prob <  0 
## The total number of observations was  1160  with MLE Chi Square =  4134.49  with prob <  0 
## 
## Tucker Lewis Index of factoring reliability =  0.646
## RMSEA index =  0.128  and the 90 % confidence intervals are  0.124 0.131
## BIC =  2666.81
## Fit based upon off diagonal values = 0.86
## Measures of factor score adequacy             
##                                                 ML1  ML2
## Correlation of scores with factors             0.96 0.93
## Multiple R square of scores with factors       0.93 0.87
## Minimum correlation of possible factor scores  0.86 0.75
threefactor<-fa(allpurpose_cor, nfactors=3, n.obs=1160,rotate="oblimin", fm="ml")
threefactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 3, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML1   ML3   ML2   h2   u2 com
## 1   0.05  0.37 -0.08 0.16 0.84 1.1
## 2   0.78 -0.04 -0.07 0.60 0.40 1.0
## 3   0.82 -0.07 -0.04 0.65 0.35 1.0
## 4   0.58  0.10 -0.04 0.36 0.64 1.1
## 5   0.74 -0.07  0.08 0.56 0.44 1.0
## 6   0.80 -0.10 -0.01 0.63 0.37 1.0
## 7   0.66 -0.16  0.05 0.44 0.56 1.1
## 8   0.86 -0.08 -0.04 0.71 0.29 1.0
## 9   0.59  0.05  0.00 0.36 0.64 1.0
## 10  0.00  0.30 -0.01 0.09 0.91 1.0
## 11 -0.10  0.77 -0.01 0.58 0.42 1.0
## 12  0.07 -0.71  0.00 0.50 0.50 1.0
## 13  0.61  0.31  0.09 0.55 0.45 1.5
## 14  0.44  0.50  0.13 0.52 0.48 2.1
## 15  0.64  0.27  0.04 0.55 0.45 1.4
## 16  0.45  0.47  0.09 0.49 0.51 2.1
## 17  0.12 -0.81  0.06 0.65 0.35 1.1
## 18 -0.10 -0.64  0.17 0.49 0.51 1.2
## 19 -0.04 -0.07  0.79 0.64 0.36 1.0
## 20  0.11 -0.03  0.73 0.57 0.43 1.0
## 21  0.02  0.05  0.73 0.53 0.47 1.0
## 22  0.06  0.04  0.73 0.55 0.45 1.0
## 23 -0.14 -0.05  0.82 0.67 0.33 1.1
## 
##                        ML1  ML3  ML2
## SS loadings           5.66 3.17 3.02
## Proportion Var        0.25 0.14 0.13
## Cumulative Var        0.25 0.38 0.52
## Proportion Explained  0.48 0.27 0.25
## Cumulative Proportion 0.48 0.75 1.00
## 
##  With factor correlations of 
##      ML1   ML3   ML2
## ML1 1.00  0.15  0.12
## ML3 0.15  1.00 -0.11
## ML2 0.12 -0.11  1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 187  and the objective function was  1.24 
## 
## The root mean square of the residuals (RMSR) is  0.04 
## The df corrected root mean square of the residuals is  0.05 
## 
## The harmonic number of observations is  1160 with the empirical chi square  1093.31  with prob <  6.8e-128 
## The total number of observations was  1160  with MLE Chi Square =  1419.02  with prob <  3.6e-188 
## 
## Tucker Lewis Index of factoring reliability =  0.876
## RMSEA index =  0.076  and the 90 % confidence intervals are  0.072 0.079
## BIC =  99.52
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy             
##                                                 ML1  ML3  ML2
## Correlation of scores with factors             0.97 0.93 0.94
## Multiple R square of scores with factors       0.93 0.87 0.88
## Minimum correlation of possible factor scores  0.86 0.75 0.77
fourfactor<-fa(allpurpose_cor, nfactors=4, n.obs=1160,rotate="oblimin", fm="ml")
fourfactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 4, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML1   ML2   ML3   ML4   h2   u2 com
## 1   0.17 -0.05  0.50 -0.16 0.24 0.76 1.5
## 2   0.74 -0.07 -0.01  0.09 0.60 0.40 1.0
## 3   0.77 -0.04 -0.04  0.09 0.65 0.35 1.0
## 4   0.57 -0.04  0.13  0.06 0.37 0.63 1.1
## 5   0.76  0.10  0.02 -0.02 0.59 0.41 1.0
## 6   0.79  0.00 -0.03  0.03 0.65 0.35 1.0
## 7   0.75  0.08  0.00 -0.16 0.50 0.50 1.1
## 8   0.78 -0.05 -0.08  0.13 0.71 0.29 1.1
## 9   0.55  0.00  0.07  0.08 0.36 0.64 1.1
## 10  0.22  0.04  0.54 -0.34 0.27 0.73 2.1
## 11 -0.06  0.01  0.80  0.04 0.66 0.34 1.0
## 12  0.00 -0.02 -0.77  0.00 0.58 0.42 1.0
## 13  0.35  0.06  0.06  0.53 0.60 0.40 1.8
## 14  0.15  0.08  0.19  0.62 0.61 0.39 1.4
## 15  0.36  0.00  0.01  0.56 0.62 0.38 1.7
## 16  0.05  0.03  0.07  0.79 0.71 0.29 1.0
## 17  0.21  0.07 -0.65 -0.29 0.64 0.36 1.6
## 18 -0.03  0.17 -0.54 -0.21 0.48 0.52 1.5
## 19  0.01  0.80 -0.02 -0.06 0.65 0.35 1.0
## 20  0.10  0.73 -0.01  0.03 0.57 0.43 1.0
## 21 -0.05  0.72 -0.02  0.14 0.53 0.47 1.1
## 22  0.08  0.74  0.06  0.01 0.55 0.45 1.0
## 23 -0.13  0.82 -0.03 -0.01 0.67 0.33 1.1
## 
##                        ML1  ML2  ML3  ML4
## SS loadings           4.82 3.00 2.69 2.31
## Proportion Var        0.21 0.13 0.12 0.10
## Cumulative Var        0.21 0.34 0.46 0.56
## Proportion Explained  0.38 0.23 0.21 0.18
## Cumulative Proportion 0.38 0.61 0.82 1.00
## 
##  With factor correlations of 
##      ML1   ML2   ML3  ML4
## ML1 1.00  0.10  0.01 0.44
## ML2 0.10  1.00 -0.15 0.03
## ML3 0.01 -0.15  1.00 0.34
## ML4 0.44  0.03  0.34 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 167  and the objective function was  0.56 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  306.34  with prob <  2.8e-10 
## The total number of observations was  1160  with MLE Chi Square =  639.33  with prob <  2e-56 
## 
## Tucker Lewis Index of factoring reliability =  0.947
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.045 0.053
## BIC =  -539.05
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 ML1  ML2  ML3  ML4
## Correlation of scores with factors             0.96 0.94 0.93 0.92
## Multiple R square of scores with factors       0.92 0.88 0.86 0.85
## Minimum correlation of possible factor scores  0.84 0.77 0.72 0.70
fivefactor<-fa(allpurpose_cor, nfactors=5,n.obs=1160, rotate="oblimin", fm="ml")
fivefactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 5, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML3   ML2   ML4   ML1   ML5   h2   u2 com
## 1  -0.05  0.50 -0.13  0.09  0.13 0.24 0.76 1.4
## 2  -0.04 -0.04  0.21  0.27  0.50 0.64 0.36 2.0
## 3  -0.07 -0.05  0.14  0.70  0.10 0.68 0.32 1.1
## 4  -0.03  0.11  0.13  0.34  0.24 0.37 0.63 2.4
## 5   0.06  0.04 -0.03  0.90 -0.07 0.72 0.28 1.0
## 6  -0.02 -0.04  0.08  0.69  0.13 0.67 0.33 1.1
## 7   0.10 -0.01 -0.05  0.33  0.48 0.53 0.47 1.9
## 8  -0.04 -0.10  0.25  0.40  0.39 0.72 0.28 2.8
## 9   0.03  0.05  0.19  0.12  0.46 0.41 0.59 1.5
## 10  0.05  0.54 -0.30  0.06  0.23 0.27 0.73 2.0
## 11  0.01  0.79  0.06 -0.11  0.06 0.66 0.34 1.1
## 12 -0.01 -0.78  0.02 -0.14  0.12 0.61 0.39 1.1
## 13  0.07  0.03  0.63  0.06  0.24 0.62 0.38 1.3
## 14  0.07  0.17  0.66  0.11 -0.05 0.61 0.39 1.2
## 15  0.00 -0.02  0.64  0.16  0.13 0.62 0.38 1.2
## 16  0.02  0.04  0.84  0.00 -0.05 0.71 0.29 1.0
## 17  0.08 -0.64 -0.28  0.08  0.17 0.64 0.36 1.6
## 18  0.16 -0.53 -0.26  0.11 -0.13 0.49 0.51 1.9
## 19  0.81 -0.02 -0.05 -0.04  0.06 0.65 0.35 1.0
## 20  0.74 -0.02  0.06 -0.01  0.12 0.58 0.42 1.1
## 21  0.71 -0.01  0.13  0.06 -0.13 0.54 0.46 1.1
## 22  0.74  0.06  0.02  0.07  0.02 0.55 0.45 1.0
## 23  0.81 -0.03 -0.03 -0.06 -0.07 0.67 0.33 1.0
## 
##                        ML3  ML2  ML4  ML1  ML5
## SS loadings           3.00 2.63 2.85 3.02 1.72
## Proportion Var        0.13 0.11 0.12 0.13 0.07
## Cumulative Var        0.13 0.24 0.37 0.50 0.57
## Proportion Explained  0.23 0.20 0.22 0.23 0.13
## Cumulative Proportion 0.23 0.43 0.64 0.87 1.00
## 
##  With factor correlations of 
##       ML3   ML2  ML4   ML1   ML5
## ML3  1.00 -0.16 0.04  0.13  0.01
## ML2 -0.16  1.00 0.32 -0.03 -0.04
## ML4  0.04  0.32 1.00  0.48  0.29
## ML1  0.13 -0.03 0.48  1.00  0.60
## ML5  0.01 -0.04 0.29  0.60  1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 148  and the objective function was  0.35 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  1160 with the empirical chi square  193.23  with prob <  0.0074 
## The total number of observations was  1160  with MLE Chi Square =  399.82  with prob <  4.9e-25 
## 
## Tucker Lewis Index of factoring reliability =  0.968
## RMSEA index =  0.039  and the 90 % confidence intervals are  0.034 0.043
## BIC =  -644.5
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 ML3  ML2  ML4  ML1  ML5
## Correlation of scores with factors             0.94 0.93 0.94 0.94 0.87
## Multiple R square of scores with factors       0.88 0.86 0.87 0.89 0.76
## Minimum correlation of possible factor scores  0.77 0.72 0.75 0.78 0.53
sixfactor<-fa(allpurpose_cor, nfactors=6,n.obs=1160, rotate="oblimin", fm="ml")
sixfactor
## Factor Analysis using method =  ml
## Call: fa(r = allpurpose_cor, nfactors = 6, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML3   ML4   ML1   ML2   ML5   ML6   h2   u2 com
## 1  -0.07  0.09 -0.01 -0.15 -0.08  0.54 0.40 0.60 1.3
## 2  -0.03  0.16  0.27 -0.03  0.55 -0.02 0.67 0.33 1.6
## 3  -0.06  0.10  0.70  0.00  0.13 -0.05 0.69 0.31 1.1
## 4  -0.04  0.15  0.33 -0.07  0.21  0.08 0.37 0.63 2.5
## 5   0.05 -0.03  0.90 -0.02 -0.07  0.02 0.73 0.27 1.0
## 6  -0.02  0.08  0.68  0.05  0.13  0.03 0.67 0.33 1.1
## 7   0.10 -0.05  0.32  0.04  0.47  0.09 0.53 0.47 2.0
## 8  -0.04  0.25  0.39  0.10  0.38  0.03 0.72 0.28 2.9
## 9   0.03  0.20  0.11 -0.02  0.42  0.09 0.40 0.60 1.7
## 10  0.03 -0.12 -0.03 -0.21  0.06  0.54 0.39 0.61 1.5
## 11  0.03 -0.03 -0.06 -0.84  0.12  0.04 0.70 0.30 1.1
## 12 -0.01  0.04 -0.16  0.72  0.13 -0.13 0.60 0.40 1.2
## 13  0.06  0.70  0.01  0.03  0.16  0.09 0.63 0.37 1.2
## 14  0.07  0.67  0.10 -0.18 -0.06 -0.02 0.61 0.39 1.2
## 15 -0.02  0.75  0.10  0.11  0.04  0.11 0.66 0.34 1.1
## 16  0.02  0.79  0.00 -0.14 -0.02 -0.13 0.70 0.30 1.1
## 17  0.08 -0.22  0.05  0.68  0.14  0.01 0.64 0.36 1.3
## 18  0.16 -0.24  0.09  0.52 -0.12 -0.07 0.49 0.51 1.9
## 19  0.80  0.00 -0.06  0.09  0.01  0.10 0.66 0.34 1.1
## 20  0.74  0.05  0.00  0.00  0.12 -0.01 0.58 0.42 1.1
## 21  0.69  0.17  0.05  0.05 -0.16  0.02 0.54 0.46 1.2
## 22  0.73  0.04  0.07 -0.03  0.00  0.05 0.55 0.45 1.0
## 23  0.83 -0.10 -0.02 -0.08  0.00 -0.14 0.70 0.30 1.1
## 
##                        ML3  ML4  ML1  ML2  ML5  ML6
## SS loadings           3.00 2.93 2.90 2.35 1.60 0.84
## Proportion Var        0.13 0.13 0.13 0.10 0.07 0.04
## Cumulative Var        0.13 0.26 0.38 0.49 0.56 0.59
## Proportion Explained  0.22 0.22 0.21 0.17 0.12 0.06
## Cumulative Proportion 0.22 0.44 0.65 0.82 0.94 1.00
## 
##  With factor correlations of 
##       ML3   ML4  ML1   ML2  ML5   ML6
## ML3  1.00  0.05 0.13  0.16 0.00 -0.05
## ML4  0.05  1.00 0.54 -0.33 0.36  0.10
## ML1  0.13  0.54 1.00  0.08 0.58  0.20
## ML2  0.16 -0.33 0.08  1.00 0.13 -0.34
## ML5  0.00  0.36 0.58  0.13 1.00  0.16
## ML6 -0.05  0.10 0.20 -0.34 0.16  1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 6 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 130  and the objective function was  0.23 
## 
## 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  1160 with the empirical chi square  95  with prob <  0.99 
## The total number of observations was  1160  with MLE Chi Square =  263.58  with prob <  4.1e-11 
## 
## Tucker Lewis Index of factoring reliability =  0.981
## RMSEA index =  0.03  and the 90 % confidence intervals are  0.025 0.035
## BIC =  -653.72
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 ML3  ML4  ML1  ML2  ML5
## Correlation of scores with factors             0.94 0.94 0.94 0.93 0.87
## Multiple R square of scores with factors       0.89 0.89 0.89 0.87 0.76
## Minimum correlation of possible factor scores  0.78 0.77 0.78 0.73 0.52
##                                                 ML6
## Correlation of scores with factors             0.78
## Multiple R square of scores with factors       0.61
## Minimum correlation of possible factor scores  0.21
fourfactor2<-fa(purposescales, nfactors=4, n.obs=1160, rotate="oblimin", fm="ml")
fourfactor2
## Factor Analysis using method =  ml
## Call: fa(r = purposescales, nfactors = 4, n.obs = 1160, rotate = "oblimin", 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##      ML1   ML2   ML3   ML4   h2   u2 com
## 1   0.17 -0.05  0.50 -0.16 0.24 0.76 1.5
## 2   0.74 -0.06 -0.01  0.09 0.60 0.40 1.0
## 3   0.77 -0.04 -0.04  0.09 0.65 0.35 1.0
## 4   0.57 -0.04  0.13  0.05 0.38 0.62 1.1
## 5   0.76  0.10  0.02 -0.01 0.59 0.41 1.0
## 6   0.79  0.00 -0.04  0.03 0.65 0.35 1.0
## 7   0.75  0.08  0.00 -0.16 0.50 0.50 1.1
## 8   0.78 -0.05 -0.08  0.13 0.71 0.29 1.1
## 9   0.56  0.00  0.07  0.07 0.36 0.64 1.1
## 10  0.22  0.04  0.54 -0.34 0.27 0.73 2.1
## 11 -0.06  0.01  0.80  0.04 0.66 0.34 1.0
## 12  0.00 -0.02 -0.77  0.00 0.58 0.42 1.0
## 13  0.35  0.06  0.06  0.53 0.60 0.40 1.8
## 14  0.15  0.09  0.20  0.61 0.61 0.39 1.4
## 15  0.36  0.00  0.01  0.56 0.62 0.38 1.7
## 16  0.05  0.03  0.07  0.79 0.71 0.29 1.0
## 17  0.21  0.07 -0.65 -0.28 0.64 0.36 1.6
## 18 -0.03  0.17 -0.54 -0.21 0.48 0.52 1.5
## 19  0.01  0.80 -0.01 -0.06 0.65 0.35 1.0
## 20  0.10  0.73 -0.01  0.03 0.57 0.43 1.0
## 21 -0.05  0.72 -0.02  0.14 0.53 0.47 1.1
## 22  0.08  0.74  0.06  0.01 0.55 0.45 1.0
## 23 -0.13  0.82 -0.03 -0.01 0.67 0.33 1.1
## 
##                        ML1  ML2  ML3  ML4
## SS loadings           4.84 3.00 2.69 2.30
## Proportion Var        0.21 0.13 0.12 0.10
## Cumulative Var        0.21 0.34 0.46 0.56
## Proportion Explained  0.38 0.23 0.21 0.18
## Cumulative Proportion 0.38 0.61 0.82 1.00
## 
##  With factor correlations of 
##      ML1   ML2   ML3  ML4
## ML1 1.00  0.11  0.01 0.44
## ML2 0.11  1.00 -0.16 0.03
## ML3 0.01 -0.16  1.00 0.34
## ML4 0.44  0.03  0.34 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  12 with Chi Square of  13806.27
## The degrees of freedom for the model are 167  and the objective function was  0.56 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  816 with the empirical chi square  214.92  with prob <  0.0073 
## The total number of observations was  1160  with MLE Chi Square =  641.82  with prob <  7.9e-57 
## 
## Tucker Lewis Index of factoring reliability =  0.947
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.045 0.054
## BIC =  -536.56
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 ML1  ML2  ML3  ML4
## Correlation of scores with factors             0.96 0.94 0.93 0.92
## Multiple R square of scores with factors       0.92 0.88 0.86 0.85
## Minimum correlation of possible factor scores  0.84 0.77 0.72 0.70
fa2latex(fa(allpurpose_cor,2,n.obs=1160, rotate="oblimin", fm="ml"),heading="2f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 2, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  2f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r }
##  \multicolumn{ 5 }{l}{ 2f } \cr 
##  \hline Variable  &   ML1  &  ML2  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.05  &  \bf{-0.39}  &  0.16  &  0.84  &  1.03 \cr 
##  2   &  \bf{ 0.76}  &   0.03  &  0.58  &  0.42  &  1.00 \cr 
##  3   &  \bf{ 0.80}  &   0.06  &  0.64  &  0.36  &  1.01 \cr 
##  4   &  \bf{ 0.58}  &  -0.10  &  0.36  &  0.64  &  1.06 \cr 
##  5   &  \bf{ 0.76}  &   0.10  &  0.56  &  0.44  &  1.04 \cr 
##  6   &  \bf{ 0.80}  &   0.11  &  0.63  &  0.37  &  1.04 \cr 
##  7   &  \bf{ 0.66}  &   0.18  &  0.44  &  0.56  &  1.15 \cr 
##  8   &  \bf{ 0.84}  &   0.08  &  0.70  &  0.30  &  1.02 \cr 
##  9   &  \bf{ 0.59}  &  -0.04  &  0.35  &  0.65  &  1.01 \cr 
##  10   &   0.01  &  -0.30  &  0.09  &  0.91  &  1.00 \cr 
##  11   &  -0.07  &  \bf{-0.77}  &  0.58  &  0.42  &  1.02 \cr 
##  12   &   0.03  &  \bf{ 0.70}  &  0.49  &  0.51  &  1.00 \cr 
##  13   &  \bf{ 0.65}  &  -0.26  &  0.53  &  0.47  &  1.32 \cr 
##  14   &  \bf{ 0.50}  &  \bf{-0.44}  &  0.49  &  0.51  &  1.97 \cr 
##  15   &  \bf{ 0.66}  &  -0.24  &  0.54  &  0.46  &  1.26 \cr 
##  16   &  \bf{ 0.49}  &  \bf{-0.42}  &  0.47  &  0.53  &  1.95 \cr 
##  17   &   0.09  &  \bf{ 0.81}  &  0.65  &  0.35  &  1.03 \cr 
##  18   &  -0.09  &  \bf{ 0.68}  &  0.48  &  0.52  &  1.04 \cr 
##  19   &   0.12  &   0.27  &  0.08  &  0.92  &  1.38 \cr 
##  20   &   0.25  &   0.22  &  0.10  &  0.90  &  1.97 \cr 
##  21   &   0.17  &   0.15  &  0.05  &  0.95  &  1.99 \cr 
##  22   &   0.21  &   0.16  &  0.06  &  0.94  &  1.87 \cr 
##  23   &   0.03  &   0.26  &  0.07  &  0.93  &  1.02 \cr 
## \hline \cr SS loadings & 5.81 &  3.29 &  \cr  
## \cr 
##             \hline \cr 
## ML1   &  1.00 & -0.13 \cr 
##  ML2   & -0.13 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,3,n.obs=1160, rotate="oblimin", fm="ml"),heading="3f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 3, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  3f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r }
##  \multicolumn{ 6 }{l}{ 3f } \cr 
##  \hline Variable  &   ML1  &  ML3  &  ML2  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.05  &  \bf{ 0.37}  &  -0.08  &  0.16  &  0.84  &  1.14 \cr 
##  2   &  \bf{ 0.78}  &  -0.04  &  -0.07  &  0.60  &  0.40  &  1.02 \cr 
##  3   &  \bf{ 0.82}  &  -0.07  &  -0.04  &  0.65  &  0.35  &  1.02 \cr 
##  4   &  \bf{ 0.58}  &   0.10  &  -0.04  &  0.36  &  0.64  &  1.07 \cr 
##  5   &  \bf{ 0.74}  &  -0.07  &   0.08  &  0.56  &  0.44  &  1.04 \cr 
##  6   &  \bf{ 0.80}  &  -0.10  &  -0.01  &  0.63  &  0.37  &  1.03 \cr 
##  7   &  \bf{ 0.66}  &  -0.16  &   0.05  &  0.44  &  0.56  &  1.14 \cr 
##  8   &  \bf{ 0.86}  &  -0.08  &  -0.04  &  0.71  &  0.29  &  1.02 \cr 
##  9   &  \bf{ 0.59}  &   0.05  &   0.00  &  0.36  &  0.64  &  1.01 \cr 
##  10   &   0.00  &   0.30  &  -0.01  &  0.09  &  0.91  &  1.01 \cr 
##  11   &  -0.10  &  \bf{ 0.77}  &  -0.01  &  0.58  &  0.42  &  1.04 \cr 
##  12   &   0.07  &  \bf{-0.71}  &   0.00  &  0.50  &  0.50  &  1.02 \cr 
##  13   &  \bf{ 0.61}  &  \bf{ 0.31}  &   0.09  &  0.55  &  0.45  &  1.53 \cr 
##  14   &  \bf{ 0.44}  &  \bf{ 0.50}  &   0.13  &  0.52  &  0.48  &  2.12 \cr 
##  15   &  \bf{ 0.64}  &   0.27  &   0.04  &  0.55  &  0.45  &  1.37 \cr 
##  16   &  \bf{ 0.45}  &  \bf{ 0.47}  &   0.09  &  0.49  &  0.51  &  2.07 \cr 
##  17   &   0.12  &  \bf{-0.81}  &   0.06  &  0.65  &  0.35  &  1.05 \cr 
##  18   &  -0.10  &  \bf{-0.64}  &   0.17  &  0.49  &  0.51  &  1.18 \cr 
##  19   &  -0.04  &  -0.07  &  \bf{ 0.79}  &  0.64  &  0.36  &  1.02 \cr 
##  20   &   0.11  &  -0.03  &  \bf{ 0.73}  &  0.57  &  0.43  &  1.05 \cr 
##  21   &   0.02  &   0.05  &  \bf{ 0.73}  &  0.53  &  0.47  &  1.01 \cr 
##  22   &   0.06  &   0.04  &  \bf{ 0.73}  &  0.55  &  0.45  &  1.02 \cr 
##  23   &  -0.14  &  -0.05  &  \bf{ 0.82}  &  0.67  &  0.33  &  1.07 \cr 
## \hline \cr SS loadings & 5.66 &  3.17 &  3.02 &  \cr  
## \cr 
##             \hline \cr 
## ML1   &  1.00 &  0.15 &  0.12 \cr 
##  ML3   &  0.15 &  1.00 & -0.11 \cr 
##  ML2   &  0.12 & -0.11 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,4,n.obs=1160, rotate="oblimin", fm="ml"),heading="4f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 4, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  4f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ 4f } \cr 
##  \hline Variable  &   ML1  &  ML2  &  ML3  &  ML4  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.17  &  -0.05  &  \bf{ 0.50}  &  -0.16  &  0.24  &  0.76  &  1.47 \cr 
##  2   &  \bf{ 0.74}  &  -0.07  &  -0.01  &   0.09  &  0.60  &  0.40  &  1.04 \cr 
##  3   &  \bf{ 0.77}  &  -0.04  &  -0.04  &   0.09  &  0.65  &  0.35  &  1.04 \cr 
##  4   &  \bf{ 0.57}  &  -0.04  &   0.13  &   0.06  &  0.37  &  0.63  &  1.13 \cr 
##  5   &  \bf{ 0.76}  &   0.10  &   0.02  &  -0.02  &  0.59  &  0.41  &  1.04 \cr 
##  6   &  \bf{ 0.79}  &   0.00  &  -0.03  &   0.03  &  0.65  &  0.35  &  1.01 \cr 
##  7   &  \bf{ 0.75}  &   0.08  &   0.00  &  -0.16  &  0.50  &  0.50  &  1.11 \cr 
##  8   &  \bf{ 0.78}  &  -0.05  &  -0.08  &   0.13  &  0.71  &  0.29  &  1.09 \cr 
##  9   &  \bf{ 0.55}  &   0.00  &   0.07  &   0.08  &  0.36  &  0.64  &  1.07 \cr 
##  10   &   0.22  &   0.04  &  \bf{ 0.54}  &  \bf{-0.34}  &  0.27  &  0.73  &  2.06 \cr 
##  11   &  -0.06  &   0.01  &  \bf{ 0.80}  &   0.04  &  0.66  &  0.34  &  1.02 \cr 
##  12   &   0.00  &  -0.02  &  \bf{-0.77}  &   0.00  &  0.58  &  0.42  &  1.00 \cr 
##  13   &  \bf{ 0.35}  &   0.06  &   0.06  &  \bf{ 0.53}  &  0.60  &  0.40  &  1.80 \cr 
##  14   &   0.15  &   0.08  &   0.19  &  \bf{ 0.62}  &  0.61  &  0.39  &  1.36 \cr 
##  15   &  \bf{ 0.36}  &   0.00  &   0.01  &  \bf{ 0.56}  &  0.62  &  0.38  &  1.69 \cr 
##  16   &   0.05  &   0.03  &   0.07  &  \bf{ 0.79}  &  0.71  &  0.29  &  1.03 \cr 
##  17   &   0.21  &   0.07  &  \bf{-0.65}  &  -0.29  &  0.64  &  0.36  &  1.65 \cr 
##  18   &  -0.03  &   0.17  &  \bf{-0.54}  &  -0.21  &  0.48  &  0.52  &  1.51 \cr 
##  19   &   0.01  &  \bf{ 0.80}  &  -0.02  &  -0.06  &  0.65  &  0.35  &  1.01 \cr 
##  20   &   0.10  &  \bf{ 0.73}  &  -0.01  &   0.03  &  0.57  &  0.43  &  1.04 \cr 
##  21   &  -0.05  &  \bf{ 0.72}  &  -0.02  &   0.14  &  0.53  &  0.47  &  1.09 \cr 
##  22   &   0.08  &  \bf{ 0.74}  &   0.06  &   0.01  &  0.55  &  0.45  &  1.04 \cr 
##  23   &  -0.13  &  \bf{ 0.82}  &  -0.03  &  -0.01  &  0.67  &  0.33  &  1.05 \cr 
## \hline \cr SS loadings & 4.82 &  3 &  2.69 &  2.31 &  \cr  
## \cr 
##             \hline \cr 
## ML1   &  1.00 &  0.10 &  0.01 &  0.44 \cr 
##  ML2   &  0.10 &  1.00 & -0.15 &  0.03 \cr 
##  ML3   &  0.01 & -0.15 &  1.00 &  0.34 \cr 
##  ML4   &  0.44 &  0.03 &  0.34 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,5,n.obs=1160, rotate="oblimin", fm="ml"),heading="5f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 5, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  5f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ 5f } \cr 
##  \hline Variable  &   ML3  &  ML2  &  ML4  &  ML1  &  ML5  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.05  &  \bf{ 0.50}  &  -0.13  &   0.09  &   0.13  &  0.24  &  0.76  &  1.35 \cr 
##  2   &  -0.04  &  -0.04  &   0.21  &   0.27  &  \bf{ 0.50}  &  0.64  &  0.36  &  1.97 \cr 
##  3   &  -0.07  &  -0.05  &   0.14  &  \bf{ 0.70}  &   0.10  &  0.68  &  0.32  &  1.15 \cr 
##  4   &  -0.03  &   0.11  &   0.13  &  \bf{ 0.34}  &   0.24  &  0.37  &  0.63  &  2.44 \cr 
##  5   &   0.06  &   0.04  &  -0.03  &  \bf{ 0.90}  &  -0.07  &  0.72  &  0.28  &  1.03 \cr 
##  6   &  -0.02  &  -0.04  &   0.08  &  \bf{ 0.69}  &   0.13  &  0.67  &  0.33  &  1.11 \cr 
##  7   &   0.10  &  -0.01  &  -0.05  &  \bf{ 0.33}  &  \bf{ 0.48}  &  0.53  &  0.47  &  1.91 \cr 
##  8   &  -0.04  &  -0.10  &   0.25  &  \bf{ 0.40}  &  \bf{ 0.39}  &  0.72  &  0.28  &  2.81 \cr 
##  9   &   0.03  &   0.05  &   0.19  &   0.12  &  \bf{ 0.46}  &  0.41  &  0.59  &  1.53 \cr 
##  10   &   0.05  &  \bf{ 0.54}  &  -0.30  &   0.06  &   0.23  &  0.27  &  0.73  &  2.03 \cr 
##  11   &   0.01  &  \bf{ 0.79}  &   0.06  &  -0.11  &   0.06  &  0.66  &  0.34  &  1.06 \cr 
##  12   &  -0.01  &  \bf{-0.78}  &   0.02  &  -0.14  &   0.12  &  0.61  &  0.39  &  1.12 \cr 
##  13   &   0.07  &   0.03  &  \bf{ 0.63}  &   0.06  &   0.24  &  0.62  &  0.38  &  1.32 \cr 
##  14   &   0.07  &   0.17  &  \bf{ 0.66}  &   0.11  &  -0.05  &  0.61  &  0.39  &  1.23 \cr 
##  15   &   0.00  &  -0.02  &  \bf{ 0.64}  &   0.16  &   0.13  &  0.62  &  0.38  &  1.22 \cr 
##  16   &   0.02  &   0.04  &  \bf{ 0.84}  &   0.00  &  -0.05  &  0.71  &  0.29  &  1.01 \cr 
##  17   &   0.08  &  \bf{-0.64}  &  -0.28  &   0.08  &   0.17  &  0.64  &  0.36  &  1.60 \cr 
##  18   &   0.16  &  \bf{-0.53}  &  -0.26  &   0.11  &  -0.13  &  0.49  &  0.51  &  1.92 \cr 
##  19   &  \bf{ 0.81}  &  -0.02  &  -0.05  &  -0.04  &   0.06  &  0.65  &  0.35  &  1.02 \cr 
##  20   &  \bf{ 0.74}  &  -0.02  &   0.06  &  -0.01  &   0.12  &  0.58  &  0.42  &  1.07 \cr 
##  21   &  \bf{ 0.71}  &  -0.01  &   0.13  &   0.06  &  -0.13  &  0.54  &  0.46  &  1.15 \cr 
##  22   &  \bf{ 0.74}  &   0.06  &   0.02  &   0.07  &   0.02  &  0.55  &  0.45  &  1.04 \cr 
##  23   &  \bf{ 0.81}  &  -0.03  &  -0.03  &  -0.06  &  -0.07  &  0.67  &  0.33  &  1.03 \cr 
## \hline \cr SS loadings & 3 &  2.63 &  2.85 &  3.02 &  1.72 &  \cr  
## \cr 
##             \hline \cr 
## ML3   &  1.00 & -0.16 &  0.04 &  0.13 &  0.01 \cr 
##  ML2   & -0.16 &  1.00 &  0.32 & -0.03 & -0.04 \cr 
##  ML4   &  0.04 &  0.32 &  1.00 &  0.48 &  0.29 \cr 
##  ML1   &  0.13 & -0.03 &  0.48 &  1.00 &  0.60 \cr 
##  ML5   &  0.01 & -0.04 &  0.29 &  0.60 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
fa2latex(fa(allpurpose_cor,6,n.obs=1160, rotate="oblimin", fm="ml"),heading="6f")
## % Called in the psych package  fa2latex % Called in the psych package  fa(allpurpose_cor, 6, n.obs = 1160, rotate = "oblimin", fm = "ml") % Called in the psych package  6f 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r }
##  \multicolumn{ 9 }{l}{ 6f } \cr 
##  \hline Variable  &   ML3  &  ML4  &  ML1  &  ML2  &  ML5  &  ML6  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.07  &   0.09  &  -0.01  &  -0.15  &  -0.08  &  \bf{ 0.54}  &  0.40  &  0.60  &  1.29 \cr 
##  2   &  -0.03  &   0.16  &   0.27  &  -0.03  &  \bf{ 0.55}  &  -0.02  &  0.67  &  0.33  &  1.64 \cr 
##  3   &  -0.06  &   0.10  &  \bf{ 0.70}  &   0.00  &   0.13  &  -0.05  &  0.69  &  0.31  &  1.14 \cr 
##  4   &  -0.04  &   0.15  &  \bf{ 0.33}  &  -0.07  &   0.21  &   0.08  &  0.37  &  0.63  &  2.52 \cr 
##  5   &   0.05  &  -0.03  &  \bf{ 0.90}  &  -0.02  &  -0.07  &   0.02  &  0.73  &  0.27  &  1.02 \cr 
##  6   &  -0.02  &   0.08  &  \bf{ 0.68}  &   0.05  &   0.13  &   0.03  &  0.67  &  0.33  &  1.13 \cr 
##  7   &   0.10  &  -0.05  &  \bf{ 0.32}  &   0.04  &  \bf{ 0.47}  &   0.09  &  0.53  &  0.47  &  2.04 \cr 
##  8   &  -0.04  &   0.25  &  \bf{ 0.39}  &   0.10  &  \bf{ 0.38}  &   0.03  &  0.72  &  0.28  &  2.90 \cr 
##  9   &   0.03  &   0.20  &   0.11  &  -0.02  &  \bf{ 0.42}  &   0.09  &  0.40  &  0.60  &  1.72 \cr 
##  10   &   0.03  &  -0.12  &  -0.03  &  -0.21  &   0.06  &  \bf{ 0.54}  &  0.39  &  0.61  &  1.46 \cr 
##  11   &   0.03  &  -0.03  &  -0.06  &  \bf{-0.84}  &   0.12  &   0.04  &  0.70  &  0.30  &  1.06 \cr 
##  12   &  -0.01  &   0.04  &  -0.16  &  \bf{ 0.72}  &   0.13  &  -0.13  &  0.60  &  0.40  &  1.24 \cr 
##  13   &   0.06  &  \bf{ 0.70}  &   0.01  &   0.03  &   0.16  &   0.09  &  0.63  &  0.37  &  1.16 \cr 
##  14   &   0.07  &  \bf{ 0.67}  &   0.10  &  -0.18  &  -0.06  &  -0.02  &  0.61  &  0.39  &  1.24 \cr 
##  15   &  -0.02  &  \bf{ 0.75}  &   0.10  &   0.11  &   0.04  &   0.11  &  0.66  &  0.34  &  1.13 \cr 
##  16   &   0.02  &  \bf{ 0.79}  &   0.00  &  -0.14  &  -0.02  &  -0.13  &  0.70  &  0.30  &  1.12 \cr 
##  17   &   0.08  &  -0.22  &   0.05  &  \bf{ 0.68}  &   0.14  &   0.01  &  0.64  &  0.36  &  1.33 \cr 
##  18   &   0.16  &  -0.24  &   0.09  &  \bf{ 0.52}  &  -0.12  &  -0.07  &  0.49  &  0.51  &  1.87 \cr 
##  19   &  \bf{ 0.80}  &   0.00  &  -0.06  &   0.09  &   0.01  &   0.10  &  0.66  &  0.34  &  1.07 \cr 
##  20   &  \bf{ 0.74}  &   0.05  &   0.00  &   0.00  &   0.12  &  -0.01  &  0.58  &  0.42  &  1.06 \cr 
##  21   &  \bf{ 0.69}  &   0.17  &   0.05  &   0.05  &  -0.16  &   0.02  &  0.54  &  0.46  &  1.25 \cr 
##  22   &  \bf{ 0.73}  &   0.04  &   0.07  &  -0.03  &   0.00  &   0.05  &  0.55  &  0.45  &  1.03 \cr 
##  23   &  \bf{ 0.83}  &  -0.10  &  -0.02  &  -0.08  &   0.00  &  -0.14  &  0.70  &  0.30  &  1.11 \cr 
## \hline \cr SS loadings & 3 &  2.93 &  2.9 &  2.35 &  1.6 &  0.84 &  \cr  
## \cr 
##             \hline \cr 
## ML3   &  1.00 &  0.05 &  0.13 &  0.16 &  0.00 & -0.05 \cr 
##  ML4   &  0.05 &  1.00 &  0.54 & -0.33 &  0.36 &  0.10 \cr 
##  ML1   &  0.13 &  0.54 &  1.00 &  0.08 &  0.58 &  0.20 \cr 
##  ML2   &  0.16 & -0.33 &  0.08 &  1.00 &  0.13 & -0.34 \cr 
##  ML5   &  0.00 &  0.36 &  0.58 &  0.13 &  1.00 &  0.16 \cr 
##  ML6   & -0.05 &  0.10 &  0.20 & -0.34 &  0.16 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33

Create dataset for Target rotation

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  PWB_7, PWB_8, APSI_1, APSI_2, APSI_4,  APSI_5, APSI_7,  APSI_8, LET_2, LET_4, PWB_1,  PWB_2,  PWB_3,  PWB_4,  PWB_5,  PWB_6,  PWB_9, APSI_3, APSI_6,  LET_1, LET_3,    LET_5,  LET_6, MLQ_9,  MLQ_2, MLQ_3, MLQ_7, MLQ_8,MLQ_10,    MLQ_1, MLQ_4, MLQ_5, MLQ_6)
purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))
library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 33]
## 
##    PWB_7 PWB_8 APSI_1 APSI_2 APSI_4 APSI_5 APSI_7 APSI_8 LET_2 LET_4 PWB_1
## 1      4     3      2      4      4      4      4      4     4     5     4
## 2      3     2      4      3      5      4      4      4     3     4     4
## 3      6     3      3      4      3      3      4      3     4     4     5
## 4      5     4      4      4      4      5      4      3     4     4     2
## 5      2     3      3      3      3      4      2      3     2     4     2
## 6      3     4      3      4      4      4      5      3     5     5     5
## 7      3     3      2      2      3      4      2      2     4     3     2
## 8      4     4      3      3      3      5      3      1     4     4     6
## 9      5     5      4      5      4      4      4      5     4     5     5
## 10     6     3      2      2      3      5      3      4     3     5     6
## ..   ...   ...    ...    ...    ...    ...    ...    ...   ...   ...   ...
## Variables not shown: PWB_2 (dbl), PWB_3 (dbl), PWB_4 (dbl), PWB_5 (dbl),
##   PWB_6 (dbl), PWB_9 (dbl), APSI_3 (dbl), APSI_6 (dbl), LET_1 (dbl), LET_3
##   (dbl), LET_5 (dbl), LET_6 (dbl), MLQ_9 (dbl), MLQ_2 (dbl), MLQ_3 (dbl),
##   MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl), MLQ_1 (dbl), MLQ_4 (dbl), MLQ_5
##   (dbl), MLQ_6 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  33 variables:
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_3: num  4 4 4 5 4 4 4 4 5 2 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(33,list(f1=1:10,f2=11:24, f3=25:29,f4=30:33))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR1    MR3    MR4   
## 1          0.604         0.140
## 2   0.134  0.560              
## 3          0.755         0.179
## 4          0.719         0.120
## 5          0.730         0.132
## 6          0.747        -0.131
## 7          0.739              
## 8          0.772              
## 9          0.572              
## 10         0.534              
## 11  0.659               -0.199
## 12  0.519  0.201        -0.226
## 13  0.832                     
## 14  0.513  0.318              
## 15 -0.775                     
## 16  0.532         0.173  0.151
## 17  0.532  0.244        -0.391
## 18  0.340  0.114  0.126  0.109
## 19 -0.683  0.240        -0.238
## 20  0.564        -0.166  0.185
## 21  0.777 -0.162              
## 22  0.750 -0.241              
## 23  0.422  0.257         0.131
## 24  0.520        -0.142  0.203
## 25                0.797       
## 26                0.723       
## 27                0.717  0.141
## 28                0.736       
## 29        -0.122  0.815       
## 30                       0.801
## 31         0.302         0.564
## 32  0.221                0.615
## 33         0.309         0.583
## 
##                  MR2   MR1   MR3   MR4
## SS loadings    5.451 5.275 3.036 2.254
## Proportion Var 0.165 0.160 0.092 0.068
## Cumulative Var 0.165 0.325 0.417 0.485
## 
## $score.cor
##            [,1]      [,2]       [,3]      [,4]
## [1,]  1.0000000 0.1455312 -0.1295486 0.4274069
## [2,]  0.1455312 1.0000000  0.1120732 0.6172193
## [3,] -0.1295486 0.1120732  1.0000000 0.1083251
## [4,]  0.4274069 0.6172193  0.1083251 1.0000000
## 
## $TLI
## [1] 0.8839974
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.06256369 0.05953080 0.06461021 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR1   MR3   MR4   h2   u2 com
## 1   0.07  0.60  0.06  0.14 0.50 0.50 1.2
## 2   0.13  0.56 -0.03  0.07 0.39 0.61 1.1
## 3  -0.10  0.75 -0.06  0.18 0.71 0.29 1.2
## 4  -0.03  0.72 -0.07  0.12 0.60 0.40 1.1
## 5  -0.05  0.73 -0.04  0.13 0.63 0.37 1.1
## 6  -0.01  0.75  0.08 -0.13 0.50 0.50 1.1
## 7   0.01  0.74  0.10  0.01 0.58 0.42 1.0
## 8  -0.04  0.77  0.00  0.05 0.64 0.36 1.0
## 9   0.04  0.57  0.00  0.09 0.39 0.61 1.1
## 10  0.06  0.53  0.02  0.02 0.31 0.69 1.0
## 11  0.66 -0.10 -0.01 -0.20 0.39 0.61 1.2
## 12  0.52  0.20 -0.05 -0.23 0.25 0.75 1.7
## 13  0.83 -0.06  0.02 -0.04 0.66 0.34 1.0
## 14  0.51  0.32 -0.09  0.03 0.42 0.58 1.7
## 15 -0.78  0.01 -0.04  0.06 0.56 0.44 1.0
## 16  0.53  0.02  0.17  0.15 0.38 0.62 1.4
## 17  0.53  0.24  0.04 -0.39 0.26 0.74 2.3
## 18  0.34  0.11  0.13  0.11 0.20 0.80 1.8
## 19 -0.68  0.24  0.06 -0.24 0.65 0.35 1.5
## 20  0.56  0.00 -0.17  0.19 0.48 0.52 1.4
## 21  0.78 -0.16 -0.03  0.00 0.62 0.38 1.1
## 22  0.75 -0.24  0.03  0.03 0.60 0.40 1.2
## 23  0.42  0.26  0.06  0.13 0.35 0.65 1.9
## 24  0.52  0.00 -0.14  0.20 0.43 0.57 1.5
## 25 -0.03  0.01  0.80 -0.07 0.64 0.36 1.0
## 26 -0.04  0.09  0.72  0.04 0.56 0.44 1.0
## 27 -0.01 -0.06  0.72  0.14 0.53 0.47 1.1
## 28  0.05  0.07  0.74  0.01 0.55 0.45 1.0
## 29 -0.04 -0.12  0.82 -0.02 0.67 0.33 1.1
## 30  0.08  0.00  0.02  0.80 0.70 0.30 1.0
## 31  0.04  0.30  0.04  0.56 0.60 0.40 1.6
## 32  0.22  0.10  0.09  0.61 0.61 0.39 1.4
## 33  0.01  0.31 -0.01  0.58 0.61 0.39 1.5
## 
##                        MR2  MR1  MR3  MR4
## SS loadings           5.57 5.63 3.06 2.72
## Proportion Var        0.17 0.17 0.09 0.08
## Cumulative Var        0.17 0.34 0.43 0.51
## Proportion Explained  0.33 0.33 0.18 0.16
## Cumulative Proportion 0.33 0.66 0.84 1.00
## 
##  With factor correlations of 
##       MR2  MR1   MR3  MR4
## MR2  1.00 0.07 -0.14 0.39
## MR1  0.07 1.00  0.11 0.48
## MR3 -0.14 0.11  1.00 0.06
## MR4  0.39 0.48  0.06 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  528  and the objective function was  18.23 with Chi Square of  20910.11
## The degrees of freedom for the model are 402  and the objective function was  1.92 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  1160 with the empirical chi square  1430.22  with prob <  3.6e-115 
## The total number of observations was  1160  with MLE Chi Square =  2197.86  with prob <  1.3e-244 
## 
## Tucker Lewis Index of factoring reliability =  0.884
## RMSEA index =  0.063  and the 90 % confidence intervals are  0.06 0.065
## BIC =  -638.72
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR1  MR3  MR4
## Correlation of scores with factors             0.96 0.96 0.94 0.93
## Multiple R square of scores with factors       0.92 0.93 0.88 0.86
## Minimum correlation of possible factor scores  0.85 0.85 0.77 0.73
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation Droping 18 (APSI_3)

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  PWB_7, PWB_8, APSI_1, APSI_2, APSI_4,  APSI_5, APSI_7,  APSI_8, LET_2, LET_4, PWB_1,  PWB_2,  PWB_3,  PWB_4,  PWB_5,  PWB_6,  PWB_9, APSI_6,  LET_1, LET_3,    LET_5,  LET_6, MLQ_9,  MLQ_2, MLQ_3, MLQ_7, MLQ_8,MLQ_10,    MLQ_1, MLQ_4, MLQ_5, MLQ_6)
purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 32]
## 
##    PWB_7 PWB_8 APSI_1 APSI_2 APSI_4 APSI_5 APSI_7 APSI_8 LET_2 LET_4 PWB_1
## 1      4     3      2      4      4      4      4      4     4     5     4
## 2      3     2      4      3      5      4      4      4     3     4     4
## 3      6     3      3      4      3      3      4      3     4     4     5
## 4      5     4      4      4      4      5      4      3     4     4     2
## 5      2     3      3      3      3      4      2      3     2     4     2
## 6      3     4      3      4      4      4      5      3     5     5     5
## 7      3     3      2      2      3      4      2      2     4     3     2
## 8      4     4      3      3      3      5      3      1     4     4     6
## 9      5     5      4      5      4      4      4      5     4     5     5
## 10     6     3      2      2      3      5      3      4     3     5     6
## ..   ...   ...    ...    ...    ...    ...    ...    ...   ...   ...   ...
## Variables not shown: PWB_2 (dbl), PWB_3 (dbl), PWB_4 (dbl), PWB_5 (dbl),
##   PWB_6 (dbl), PWB_9 (dbl), APSI_6 (dbl), LET_1 (dbl), LET_3 (dbl), LET_5
##   (dbl), LET_6 (dbl), MLQ_9 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl),
##   MLQ_8 (dbl), MLQ_10 (dbl), MLQ_1 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6
##   (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  32 variables:
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(32,list(f1=1:10,f2=11:23, f3=24:28,f4=29:32))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR1    MR3    MR4   
## 1          0.605         0.142
## 2   0.132  0.560              
## 3          0.755         0.179
## 4          0.718         0.121
## 5          0.730         0.132
## 6          0.742        -0.125
## 7          0.738              
## 8          0.773              
## 9          0.573              
## 10         0.534              
## 11  0.657               -0.196
## 12  0.524  0.206        -0.226
## 13  0.831                     
## 14  0.518  0.324              
## 15 -0.773                     
## 16  0.524         0.174  0.158
## 17  0.539  0.248        -0.389
## 18 -0.680  0.236        -0.244
## 19  0.566        -0.159  0.189
## 20  0.775 -0.158              
## 21  0.746 -0.238              
## 22  0.416  0.258         0.137
## 23  0.519        -0.136  0.208
## 24                0.798       
## 25                0.724       
## 26                0.718  0.143
## 27                0.736       
## 28        -0.121  0.812       
## 29                       0.797
## 30         0.304         0.565
## 31  0.215  0.102         0.616
## 32         0.312         0.583
## 
##                  MR2   MR1   MR3   MR4
## SS loadings    5.315 5.261 3.015 2.246
## Proportion Var 0.166 0.164 0.094 0.070
## Cumulative Var 0.166 0.330 0.425 0.495
## 
## $score.cor
##            [,1]      [,2]       [,3]      [,4]
## [1,]  1.0000000 0.1255420 -0.1440666 0.4107911
## [2,]  0.1255420 1.0000000  0.1120651 0.6172085
## [3,] -0.1440666 0.1120651  1.0000000 0.1083005
## [4,]  0.4107911 0.6172085  0.1083005 1.0000000
## 
## $TLI
## [1] 0.8988709
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05951876 0.05640655 0.06170032 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR1   MR3   MR4   h2   u2 com
## 1   0.07  0.60  0.06  0.14 0.50 0.50 1.2
## 2   0.13  0.56 -0.03  0.07 0.39 0.61 1.1
## 3  -0.10  0.76 -0.06  0.18 0.71 0.29 1.2
## 4  -0.03  0.72 -0.07  0.12 0.60 0.40 1.1
## 5  -0.05  0.73 -0.04  0.13 0.63 0.37 1.1
## 6  -0.02  0.74  0.07 -0.13 0.49 0.51 1.1
## 7   0.01  0.74  0.10  0.01 0.58 0.42 1.0
## 8  -0.04  0.77  0.00  0.05 0.64 0.36 1.0
## 9   0.04  0.57  0.00  0.09 0.39 0.61 1.1
## 10  0.06  0.53  0.03  0.02 0.31 0.69 1.0
## 11  0.66 -0.10  0.00 -0.20 0.39 0.61 1.2
## 12  0.52  0.21 -0.04 -0.23 0.25 0.75 1.7
## 13  0.83 -0.06  0.03 -0.03 0.66 0.34 1.0
## 14  0.52  0.32 -0.08  0.03 0.43 0.57 1.7
## 15 -0.77  0.00 -0.04  0.06 0.56 0.44 1.0
## 16  0.52  0.03  0.17  0.16 0.38 0.62 1.4
## 17  0.54  0.25  0.04 -0.39 0.26 0.74 2.3
## 18 -0.68  0.24  0.05 -0.24 0.65 0.35 1.5
## 19  0.57  0.00 -0.16  0.19 0.49 0.51 1.4
## 20  0.77 -0.16 -0.02  0.01 0.62 0.38 1.1
## 21  0.75 -0.24  0.04  0.04 0.60 0.40 1.2
## 22  0.42  0.26  0.07  0.14 0.35 0.65 2.0
## 23  0.52  0.01 -0.14  0.21 0.43 0.57 1.5
## 24 -0.03  0.02  0.80 -0.07 0.65 0.35 1.0
## 25 -0.04  0.09  0.72  0.04 0.57 0.43 1.0
## 26 -0.01 -0.06  0.72  0.14 0.54 0.46 1.1
## 27  0.05  0.07  0.74  0.01 0.55 0.45 1.0
## 28 -0.04 -0.12  0.81 -0.02 0.67 0.33 1.1
## 29  0.08  0.00  0.02  0.80 0.69 0.31 1.0
## 30  0.04  0.30  0.05  0.57 0.61 0.39 1.6
## 31  0.22  0.10  0.09  0.62 0.61 0.39 1.3
## 32  0.01  0.31  0.00  0.58 0.62 0.38 1.5
## 
##                        MR2  MR1  MR3  MR4
## SS loadings           5.43 5.62 3.04 2.70
## Proportion Var        0.17 0.18 0.09 0.08
## Cumulative Var        0.17 0.35 0.44 0.52
## Proportion Explained  0.32 0.33 0.18 0.16
## Cumulative Proportion 0.32 0.66 0.84 1.00
## 
##  With factor correlations of 
##       MR2  MR1   MR3  MR4
## MR2  1.00 0.06 -0.15 0.38
## MR1  0.06 1.00  0.11 0.48
## MR3 -0.15 0.11  1.00 0.05
## MR4  0.38 0.48  0.05 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  496  and the objective function was  17.76 with Chi Square of  20374.35
## The degrees of freedom for the model are 374  and the objective function was  1.65 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  1160 with the empirical chi square  1145.64  with prob <  3.2e-79 
## The total number of observations was  1160  with MLE Chi Square =  1886.21  with prob <  7.8e-200 
## 
## Tucker Lewis Index of factoring reliability =  0.899
## RMSEA index =  0.06  and the 90 % confidence intervals are  0.056 0.062
## BIC =  -752.8
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR1  MR3  MR4
## Correlation of scores with factors             0.96 0.96 0.94 0.93
## Multiple R square of scores with factors       0.92 0.93 0.88 0.86
## Minimum correlation of possible factor scores  0.84 0.85 0.76 0.72
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

``` # Target rotation Droping 18 (APSI_3), 14(APSI_5), 17(APSI_8), 23(LET_6)

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  PWB_7, PWB_8, APSI_1, APSI_2, APSI_4,  APSI_7, LET_2, LET_4, PWB_1,  PWB_2,  PWB_3,  PWB_4,  PWB_5,  PWB_6,  PWB_9, APSI_6,  LET_1, LET_3,    LET_5, MLQ_9,  MLQ_2, MLQ_3, MLQ_7, MLQ_8,MLQ_10,    MLQ_1, MLQ_4, MLQ_5, MLQ_6)
purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 29]
## 
##    PWB_7 PWB_8 APSI_1 APSI_2 APSI_4 APSI_7 LET_2 LET_4 PWB_1 PWB_2 PWB_3
## 1      4     3      2      4      4      4     4     5     4     3     5
## 2      3     2      4      3      5      4     3     4     4     5     5
## 3      6     3      3      4      3      4     4     4     5     6     5
## 4      5     4      4      4      4      4     4     4     2     2     4
## 5      2     3      3      3      3      2     2     4     2     2     3
## 6      3     4      3      4      4      5     5     5     5     4     6
## 7      3     3      2      2      3      2     4     3     2     2     5
## 8      4     4      3      3      3      3     4     4     6     6     5
## 9      5     5      4      5      4      4     4     5     5     5     5
## 10     6     3      2      2      3      3     3     5     6     6     3
## ..   ...   ...    ...    ...    ...    ...   ...   ...   ...   ...   ...
## Variables not shown: PWB_4 (dbl), PWB_5 (dbl), PWB_6 (dbl), PWB_9 (dbl),
##   APSI_6 (dbl), LET_1 (dbl), LET_3 (dbl), LET_5 (dbl), MLQ_9 (dbl), MLQ_2
##   (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl), MLQ_1 (dbl),
##   MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  29 variables:
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(29,list(f1=1:10,f2=11:20, f3=21:25,f4=26:29))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR1    MR3    MR4   
## 1          0.621         0.128
## 2          0.559              
## 3  -0.127  0.753         0.166
## 4          0.702         0.127
## 5          0.705         0.140
## 6          0.717  0.111       
## 7          0.614              
## 8          0.543              
## 9   0.635               -0.171
## 10  0.489  0.258        -0.228
## 11  0.817                     
## 12  0.503  0.357              
## 13 -0.753                     
## 14  0.524         0.165  0.189
## 15  0.475  0.279        -0.365
## 16 -0.708  0.205        -0.262
## 17  0.582        -0.166  0.193
## 18  0.772 -0.126              
## 19  0.752 -0.220              
## 20  0.531        -0.145  0.230
## 21                0.800       
## 22                0.727       
## 23                0.719  0.131
## 24                0.737       
## 25        -0.135  0.810       
## 26  0.166                0.769
## 27         0.317         0.540
## 28  0.270  0.110         0.606
## 29         0.321         0.557
## 
##                  MR2   MR1   MR3   MR4
## SS loadings    5.072 4.079 3.012 2.093
## Proportion Var 0.175 0.141 0.104 0.072
## Cumulative Var 0.175 0.316 0.419 0.492
## 
## $score.cor
##            [,1]       [,2]        [,3]      [,4]
## [1,]  1.0000000 0.10648663 -0.15626593 0.3802711
## [2,]  0.1064866 1.00000000  0.09884156 0.6324372
## [3,] -0.1562659 0.09884156  1.00000000 0.1083479
## [4,]  0.3802711 0.63243722  0.10834790 1.0000000
## 
## $TLI
## [1] 0.9026726
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.06047110 0.05706720 0.06300695 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR1   MR3   MR4   h2   u2 com
## 1   0.05  0.62  0.07  0.13 0.50 0.50 1.1
## 2   0.10  0.56 -0.02  0.08 0.38 0.62 1.1
## 3  -0.13  0.75 -0.04  0.17 0.71 0.29 1.2
## 4  -0.07  0.70 -0.06  0.13 0.59 0.41 1.1
## 5  -0.09  0.70 -0.03  0.14 0.61 0.39 1.1
## 6  -0.04  0.72  0.11  0.02 0.56 0.44 1.1
## 7   0.01  0.61  0.01  0.05 0.42 0.58 1.0
## 8   0.03  0.54  0.03  0.01 0.31 0.69 1.0
## 9   0.64 -0.06 -0.01 -0.17 0.40 0.60 1.2
## 10  0.49  0.26 -0.04 -0.23 0.27 0.73 2.0
## 11  0.82 -0.01  0.01  0.00 0.66 0.34 1.0
## 12  0.50  0.36 -0.08  0.03 0.44 0.56 1.9
## 13 -0.75 -0.03 -0.03  0.03 0.56 0.44 1.0
## 14  0.52  0.03  0.16  0.19 0.37 0.63 1.5
## 15  0.47  0.28  0.04 -0.36 0.26 0.74 2.6
## 16 -0.71  0.21  0.07 -0.26 0.64 0.36 1.5
## 17  0.58  0.04 -0.17  0.19 0.49 0.51 1.4
## 18  0.77 -0.13 -0.04  0.04 0.62 0.38 1.1
## 19  0.75 -0.22  0.02  0.08 0.60 0.40 1.2
## 20  0.53  0.02 -0.14  0.23 0.44 0.56 1.5
## 21 -0.03  0.02  0.80 -0.07 0.65 0.35 1.0
## 22 -0.04  0.09  0.73  0.04 0.57 0.43 1.0
## 23  0.01 -0.05  0.72  0.13 0.54 0.46 1.1
## 24  0.05  0.07  0.74  0.01 0.55 0.45 1.0
## 25 -0.04 -0.14  0.81  0.00 0.67 0.33 1.1
## 26  0.17  0.01  0.02  0.77 0.69 0.31 1.1
## 27  0.08  0.32  0.05  0.54 0.61 0.39 1.7
## 28  0.27  0.11  0.09  0.61 0.61 0.39 1.5
## 29  0.06  0.32  0.00  0.56 0.62 0.38 1.6
## 
##                        MR2  MR1  MR3  MR4
## SS loadings           5.22 4.45 3.05 2.59
## Proportion Var        0.18 0.15 0.11 0.09
## Cumulative Var        0.18 0.33 0.44 0.53
## Proportion Explained  0.34 0.29 0.20 0.17
## Cumulative Proportion 0.34 0.63 0.83 1.00
## 
##  With factor correlations of 
##       MR2  MR1   MR3  MR4
## MR2  1.00 0.06 -0.15 0.23
## MR1  0.06 1.00  0.08 0.51
## MR3 -0.15 0.08  1.00 0.07
## MR4  0.23 0.51  0.07 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  406  and the objective function was  15.57 with Chi Square of  17878.78
## The degrees of freedom for the model are 296  and the objective function was  1.34 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.04 
## 
## The harmonic number of observations is  1160 with the empirical chi square  891.24  with prob <  6.4e-61 
## The total number of observations was  1160  with MLE Chi Square =  1532.89  with prob <  1e-165 
## 
## Tucker Lewis Index of factoring reliability =  0.903
## RMSEA index =  0.06  and the 90 % confidence intervals are  0.057 0.063
## BIC =  -555.74
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR1  MR3  MR4
## Correlation of scores with factors             0.96 0.95 0.94 0.92
## Multiple R square of scores with factors       0.92 0.90 0.88 0.85
## Minimum correlation of possible factor scores  0.84 0.81 0.76 0.69
fa2latex(fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 4, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR1  &  MR3  &  MR4  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.05  &  \bf{ 0.62}  &   0.07  &   0.13  &  0.50  &  0.50  &  1.12 \cr 
##  2   &   0.10  &  \bf{ 0.56}  &  -0.02  &   0.08  &  0.38  &  0.62  &  1.10 \cr 
##  3   &  -0.13  &  \bf{ 0.75}  &  -0.04  &   0.17  &  0.71  &  0.29  &  1.16 \cr 
##  4   &  -0.07  &  \bf{ 0.70}  &  -0.06  &   0.13  &  0.59  &  0.41  &  1.10 \cr 
##  5   &  -0.09  &  \bf{ 0.70}  &  -0.03  &   0.14  &  0.61  &  0.39  &  1.11 \cr 
##  6   &  -0.04  &  \bf{ 0.72}  &   0.11  &   0.02  &  0.56  &  0.44  &  1.06 \cr 
##  7   &   0.01  &  \bf{ 0.61}  &   0.01  &   0.05  &  0.42  &  0.58  &  1.02 \cr 
##  8   &   0.03  &  \bf{ 0.54}  &   0.03  &   0.01  &  0.31  &  0.69  &  1.01 \cr 
##  9   &  \bf{ 0.64}  &  -0.06  &  -0.01  &  -0.17  &  0.40  &  0.60  &  1.17 \cr 
##  10   &  \bf{ 0.49}  &   0.26  &  -0.04  &  -0.23  &  0.27  &  0.73  &  2.01 \cr 
##  11   &  \bf{ 0.82}  &  -0.01  &   0.01  &   0.00  &  0.66  &  0.34  &  1.00 \cr 
##  12   &  \bf{ 0.50}  &  \bf{ 0.36}  &  -0.08  &   0.03  &  0.44  &  0.56  &  1.87 \cr 
##  13   &  \bf{-0.75}  &  -0.03  &  -0.03  &   0.03  &  0.56  &  0.44  &  1.01 \cr 
##  14   &  \bf{ 0.52}  &   0.03  &   0.16  &   0.19  &  0.37  &  0.63  &  1.48 \cr 
##  15   &  \bf{ 0.47}  &   0.28  &   0.04  &  \bf{-0.36}  &  0.26  &  0.74  &  2.57 \cr 
##  16   &  \bf{-0.71}  &   0.21  &   0.07  &  -0.26  &  0.64  &  0.36  &  1.47 \cr 
##  17   &  \bf{ 0.58}  &   0.04  &  -0.17  &   0.19  &  0.49  &  0.51  &  1.41 \cr 
##  18   &  \bf{ 0.77}  &  -0.13  &  -0.04  &   0.04  &  0.62  &  0.38  &  1.06 \cr 
##  19   &  \bf{ 0.75}  &  -0.22  &   0.02  &   0.08  &  0.60  &  0.40  &  1.20 \cr 
##  20   &  \bf{ 0.53}  &   0.02  &  -0.14  &   0.23  &  0.44  &  0.56  &  1.53 \cr 
##  21   &  -0.03  &   0.02  &  \bf{ 0.80}  &  -0.07  &  0.65  &  0.35  &  1.02 \cr 
##  22   &  -0.04  &   0.09  &  \bf{ 0.73}  &   0.04  &  0.57  &  0.43  &  1.05 \cr 
##  23   &   0.01  &  -0.05  &  \bf{ 0.72}  &   0.13  &  0.54  &  0.46  &  1.08 \cr 
##  24   &   0.05  &   0.07  &  \bf{ 0.74}  &   0.01  &  0.55  &  0.45  &  1.03 \cr 
##  25   &  -0.04  &  -0.14  &  \bf{ 0.81}  &   0.00  &  0.67  &  0.33  &  1.06 \cr 
##  26   &   0.17  &   0.01  &   0.02  &  \bf{ 0.77}  &  0.69  &  0.31  &  1.09 \cr 
##  27   &   0.08  &  \bf{ 0.32}  &   0.05  &  \bf{ 0.54}  &  0.61  &  0.39  &  1.70 \cr 
##  28   &   0.27  &   0.11  &   0.09  &  \bf{ 0.61}  &  0.61  &  0.39  &  1.51 \cr 
##  29   &   0.06  &  \bf{ 0.32}  &   0.00  &  \bf{ 0.56}  &  0.62  &  0.38  &  1.62 \cr 
## \hline \cr SS loadings & 5.22 &  4.45 &  3.05 &  2.59 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.06 & -0.15 &  0.23 \cr 
##  MR1   &  0.06 &  1.00 &  0.08 &  0.51 \cr 
##  MR3   & -0.15 &  0.08 &  1.00 &  0.07 \cr 
##  MR4   &  0.23 &  0.51 &  0.07 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on content anlysis 7 factors

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys, 
#Factor 1 Present Focused:
PWB_1, PWB_2, 
#Factor 2 Understanding Self and Life:
APSI_2,  APSI_4,  APSI_6, LET_6, PWB_8, PWB_4,
#Factor 3 Making Plans:
APSI_7, APSI_8,  PWB_7, PWB_5, PWB_6, PWB_9,
#Factor 4 Meaningful activities:
LET_4,  PWB_3, LET_2, LET_3,  LET_5,  
#Factor 5 Values and Morals:
APSI_5,  APSI_3,  
#Factor 6 Have Purpose:
APSI_1, LET_1, MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1,
#Factor 7 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10
)
purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 33]
## 
##    PWB_1 PWB_2 APSI_2 APSI_4 APSI_6 LET_6 PWB_8 PWB_4 APSI_7 APSI_8 PWB_7
## 1      4     3      4      4      4     5     3     2      4      4     4
## 2      4     5      3      5      3     5     2     2      4      4     3
## 3      5     6      4      3      3     5     3     6      4      3     6
## 4      2     2      4      4      4     4     4     4      4      3     5
## 5      2     2      3      3      3     4     3     3      2      3     2
## 6      5     4      4      4      2     4     4     5      5      3     3
## 7      2     2      2      3      4     5     3     2      2      2     3
## 8      6     6      3      3      3     5     4     1      3      1     4
## 9      5     5      5      4      2     5     5     5      4      5     5
## 10     6     6      2      3      3     5     3     3      3      4     6
## ..   ...   ...    ...    ...    ...   ...   ...   ...    ...    ...   ...
## Variables not shown: PWB_5 (dbl), PWB_6 (dbl), PWB_9 (dbl), LET_4 (dbl),
##   PWB_3 (dbl), LET_2 (dbl), LET_3 (dbl), LET_5 (dbl), APSI_5 (dbl), APSI_3
##   (dbl), APSI_1 (dbl), LET_1 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl),
##   MLQ_9 (dbl), MLQ_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8
##   (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  33 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_3: num  4 4 4 5 4 4 4 4 5 2 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(33,list(f1=1:2,f2=3:8, f3=9:14,f4=15:19, f5=20:21,f6=22:28, f7=29:33))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,7,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR6    MR7    MR4    MR2    MR1    MR5    MR3   
## 1                               0.741  0.102       
## 2                        0.103  0.638 -0.186  0.273
## 3   0.265                0.344 -0.148  0.210  0.237
## 4   0.256        -0.154  0.498         0.243       
## 5  -0.358  0.102 -0.407  0.151 -0.239              
## 6   0.234         0.105 -0.182         0.417  0.196
## 7   0.186                0.263         0.278  0.125
## 8   0.293         0.246  0.315  0.280 -0.158  0.189
## 9   0.116  0.113 -0.155  0.506         0.303       
## 10  0.194        -0.137  0.571         0.187       
## 11  0.294                0.186         0.238  0.235
## 12               -0.295        -0.431 -0.172       
## 13  0.172  0.101  0.268         0.209  0.411 -0.204
## 14 -0.184         0.151  0.127  0.407         0.354
## 15  0.149        -0.240 -0.105         0.338  0.422
## 16  0.115         0.517 -0.153  0.237  0.122  0.199
## 17  0.272        -0.145        -0.113  0.155  0.548
## 18                0.827                            
## 19                0.658         0.102  0.108       
## 20                       0.352 -0.114  0.382  0.236
## 21                0.157                0.527 -0.189
## 22  0.349        -0.118  0.428 -0.133  0.123  0.204
## 23  0.344 -0.154  0.509                       0.120
## 24  0.793                                     0.108
## 25  0.772                                    -0.101
## 26  0.803        -0.112  0.154        -0.111       
## 27  0.339 -0.136  0.461  0.102                     
## 28  0.960        -0.109 -0.136               -0.194
## 29         0.829                                   
## 30         0.752                                   
## 31  0.145  0.727                             -0.107
## 32         0.753  0.118                            
## 33 -0.102  0.815        -0.114                     
## 
##                  MR6   MR7   MR4   MR2   MR1   MR5   MR3
## SS loadings    3.971 3.133 2.531 1.676 1.658 1.464 1.229
## Proportion Var 0.120 0.095 0.077 0.051 0.050 0.044 0.037
## Cumulative Var 0.120 0.215 0.292 0.343 0.393 0.437 0.475
## 
## $score.cor
##           [,1]        [,2]        [,3]        [,4]        [,5]       [,6]
## [1,] 1.0000000  0.08387500  0.40864514  0.64386635  0.24605268 0.59896458
## [2,] 0.0838750  1.00000000 -0.18928899  0.11661378 -0.12074667 0.07689791
## [3,] 0.4086451 -0.18928899  1.00000000 -0.04207668  0.61971541 0.48927974
## [4,] 0.6438664  0.11661378 -0.04207668  1.00000000 -0.01070144 0.45472856
## [5,] 0.2460527 -0.12074667  0.61971541 -0.01070144  1.00000000 0.36131603
## [6,] 0.5989646  0.07689791  0.48927974  0.45472856  0.36131603 1.00000000
## [7,] 0.5118378  0.07270189  0.05112551  0.59483568  0.03067560 0.36494863
##            [,7]
## [1,] 0.51183779
## [2,] 0.07270189
## [3,] 0.05112551
## [4,] 0.59483568
## [5,] 0.03067560
## [6,] 0.36494863
## [7,] 1.00000000
## 
## $TLI
## [1] 0.936139
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04648843 0.04304837 0.04899023 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 7, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR6   MR7   MR4   MR2   MR1   MR5   MR3   h2   u2 com
## 1  -0.08 -0.07  0.01 -0.06  0.74  0.10 -0.07 0.60 0.40 1.1
## 2   0.04 -0.04 -0.07  0.10  0.64 -0.19  0.27 0.45 0.55 1.7
## 3   0.27 -0.04 -0.07  0.34 -0.15  0.21  0.24 0.61 0.39 4.1
## 4   0.26 -0.02 -0.15  0.50  0.00  0.24  0.03 0.67 0.33 2.3
## 5  -0.36  0.10 -0.41  0.15 -0.24 -0.04  0.09 0.64 0.36 3.3
## 6   0.23  0.00  0.11 -0.18  0.07  0.42  0.20 0.47 0.53 2.8
## 7   0.19 -0.03 -0.02  0.26  0.00  0.28  0.12 0.39 0.61 3.2
## 8   0.29 -0.04  0.25  0.31  0.28 -0.16  0.19 0.52 0.48 5.2
## 9   0.12  0.11 -0.15  0.51  0.09  0.30  0.03 0.64 0.36 2.2
## 10  0.19  0.04 -0.14  0.57  0.03  0.19  0.07 0.69 0.31 1.6
## 11  0.29  0.07 -0.10  0.19 -0.02  0.24  0.24 0.51 0.49 4.1
## 12 -0.10  0.02 -0.30  0.09 -0.43 -0.17 -0.07 0.58 0.42 2.5
## 13  0.17  0.10  0.27 -0.02  0.21  0.41 -0.20 0.50 0.50 3.5
## 14 -0.18  0.05  0.15  0.13  0.41 -0.08  0.35 0.32 0.68 3.1
## 15  0.15  0.00 -0.24 -0.11  0.01  0.34  0.42 0.48 0.52 3.0
## 16  0.11 -0.02  0.52 -0.15  0.24  0.12  0.20 0.68 0.32 2.2
## 17  0.27  0.01 -0.14 -0.05 -0.11  0.16  0.55 0.59 0.41 1.9
## 18  0.06 -0.03  0.83  0.01 -0.02  0.04  0.09 0.72 0.28 1.0
## 19  0.08  0.00  0.66 -0.10  0.10  0.11 -0.02 0.63 0.37 1.2
## 20 -0.06  0.09 -0.05  0.35 -0.11  0.38  0.24 0.52 0.48 3.1
## 21  0.07  0.04  0.16 -0.03  0.08  0.53 -0.19 0.36 0.64 1.6
## 22  0.35  0.00 -0.12  0.43 -0.13  0.12  0.20 0.72 0.28 3.0
## 23  0.34 -0.15  0.51  0.04  0.00 -0.07  0.12 0.53 0.47 2.2
## 24  0.79  0.08 -0.08  0.03 -0.06 -0.08  0.11 0.64 0.36 1.1
## 25  0.77  0.07  0.00 -0.06  0.06  0.07 -0.10 0.62 0.38 1.1
## 26  0.80  0.03 -0.11  0.15  0.00 -0.11 -0.01 0.64 0.36 1.2
## 27  0.34 -0.14  0.46  0.10  0.03 -0.03  0.00 0.46 0.54 2.2
## 28  0.96  0.01 -0.11 -0.14  0.03 -0.01 -0.19 0.71 0.29 1.2
## 29 -0.06  0.83  0.02 -0.03  0.03 -0.08  0.09 0.66 0.34 1.1
## 30  0.07  0.75  0.03  0.01 -0.04 -0.04  0.08 0.57 0.43 1.1
## 31  0.14  0.73 -0.01 -0.03  0.07 -0.04 -0.11 0.54 0.46 1.2
## 32  0.01  0.75  0.12  0.04 -0.02  0.02  0.02 0.55 0.45 1.1
## 33 -0.10  0.81  0.07 -0.11 -0.04  0.05 -0.06 0.68 0.32 1.1
## 
##                        MR6  MR7  MR4  MR2  MR1  MR5  MR3
## SS loadings           4.65 3.17 3.11 2.28 2.10 1.98 1.58
## Proportion Var        0.14 0.10 0.09 0.07 0.06 0.06 0.05
## Cumulative Var        0.14 0.24 0.33 0.40 0.46 0.52 0.57
## Proportion Explained  0.25 0.17 0.16 0.12 0.11 0.11 0.08
## Cumulative Proportion 0.25 0.41 0.58 0.70 0.81 0.92 1.00
## 
##  With factor correlations of 
##      MR6   MR7   MR4   MR2   MR1  MR5   MR3
## MR6 1.00  0.04  0.23  0.36  0.22 0.56  0.37
## MR7 0.04  1.00 -0.22  0.08 -0.13 0.13 -0.01
## MR4 0.23 -0.22  1.00 -0.29  0.61 0.05 -0.02
## MR2 0.36  0.08 -0.29  1.00 -0.08 0.30  0.30
## MR1 0.22 -0.13  0.61 -0.08  1.00 0.13  0.03
## MR5 0.56  0.13  0.05  0.30  0.13 1.00  0.31
## MR3 0.37 -0.01 -0.02  0.30  0.03 0.31  1.00
## 
## Mean item complexity =  2.2
## Test of the hypothesis that 7 factors are sufficient.
## 
## The degrees of freedom for the null model are  528  and the objective function was  18.23 with Chi Square of  20910.11
## The degrees of freedom for the model are 318  and the objective function was  0.96 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  469.7  with prob <  6.3e-08 
## The total number of observations was  1160  with MLE Chi Square =  1098.66  with prob <  1.6e-86 
## 
## Tucker Lewis Index of factoring reliability =  0.936
## RMSEA index =  0.046  and the 90 % confidence intervals are  0.043 0.049
## BIC =  -1145.2
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR6  MR7  MR4  MR2  MR1
## Correlation of scores with factors             0.96 0.94 0.94 0.90 0.90
## Multiple R square of scores with factors       0.92 0.89 0.89 0.81 0.81
## Minimum correlation of possible factor scores  0.84 0.78 0.77 0.63 0.62
##                                                 MR5  MR3
## Correlation of scores with factors             0.87 0.86
## Multiple R square of scores with factors       0.77 0.73
## Minimum correlation of possible factor scores  0.53 0.47
fa2latex(fa(purposescales_cor,7,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 7, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r r }
##  \multicolumn{ 10 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR6  &  MR7  &  MR4  &  MR2  &  MR1  &  MR5  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.08  &  -0.07  &   0.01  &  -0.06  &  \bf{ 0.74}  &   0.10  &  -0.07  &  0.60  &  0.40  &  1.12 \cr 
##  2   &   0.04  &  -0.04  &  -0.07  &   0.10  &  \bf{ 0.64}  &  -0.19  &   0.27  &  0.45  &  0.55  &  1.66 \cr 
##  3   &   0.27  &  -0.04  &  -0.07  &  \bf{ 0.34}  &  -0.15  &   0.21  &   0.24  &  0.61  &  0.39  &  4.08 \cr 
##  4   &   0.26  &  -0.02  &  -0.15  &  \bf{ 0.50}  &   0.00  &   0.24  &   0.03  &  0.67  &  0.33  &  2.26 \cr 
##  5   &  \bf{-0.36}  &   0.10  &  \bf{-0.41}  &   0.15  &  -0.24  &  -0.04  &   0.09  &  0.64  &  0.36  &  3.26 \cr 
##  6   &   0.23  &   0.00  &   0.11  &  -0.18  &   0.07  &  \bf{ 0.42}  &   0.20  &  0.47  &  0.53  &  2.79 \cr 
##  7   &   0.19  &  -0.03  &  -0.02  &   0.26  &   0.00  &   0.28  &   0.12  &  0.39  &  0.61  &  3.20 \cr 
##  8   &   0.29  &  -0.04  &   0.25  &  \bf{ 0.31}  &   0.28  &  -0.16  &   0.19  &  0.52  &  0.48  &  5.17 \cr 
##  9   &   0.12  &   0.11  &  -0.15  &  \bf{ 0.51}  &   0.09  &   0.30  &   0.03  &  0.64  &  0.36  &  2.21 \cr 
##  10   &   0.19  &   0.04  &  -0.14  &  \bf{ 0.57}  &   0.03  &   0.19  &   0.07  &  0.69  &  0.31  &  1.65 \cr 
##  11   &   0.29  &   0.07  &  -0.10  &   0.19  &  -0.02  &   0.24  &   0.24  &  0.51  &  0.49  &  4.06 \cr 
##  12   &  -0.10  &   0.02  &  -0.30  &   0.09  &  \bf{-0.43}  &  -0.17  &  -0.07  &  0.58  &  0.42  &  2.45 \cr 
##  13   &   0.17  &   0.10  &   0.27  &  -0.02  &   0.21  &  \bf{ 0.41}  &  -0.20  &  0.50  &  0.50  &  3.50 \cr 
##  14   &  -0.18  &   0.05  &   0.15  &   0.13  &  \bf{ 0.41}  &  -0.08  &  \bf{ 0.35}  &  0.32  &  0.68  &  3.06 \cr 
##  15   &   0.15  &   0.00  &  -0.24  &  -0.11  &   0.01  &  \bf{ 0.34}  &  \bf{ 0.42}  &  0.48  &  0.52  &  3.02 \cr 
##  16   &   0.11  &  -0.02  &  \bf{ 0.52}  &  -0.15  &   0.24  &   0.12  &   0.20  &  0.68  &  0.32  &  2.24 \cr 
##  17   &   0.27  &   0.01  &  -0.14  &  -0.05  &  -0.11  &   0.16  &  \bf{ 0.55}  &  0.59  &  0.41  &  1.95 \cr 
##  18   &   0.06  &  -0.03  &  \bf{ 0.83}  &   0.01  &  -0.02  &   0.04  &   0.09  &  0.72  &  0.28  &  1.04 \cr 
##  19   &   0.08  &   0.00  &  \bf{ 0.66}  &  -0.10  &   0.10  &   0.11  &  -0.02  &  0.63  &  0.37  &  1.18 \cr 
##  20   &  -0.06  &   0.09  &  -0.05  &  \bf{ 0.35}  &  -0.11  &  \bf{ 0.38}  &   0.24  &  0.52  &  0.48  &  3.11 \cr 
##  21   &   0.07  &   0.04  &   0.16  &  -0.03  &   0.08  &  \bf{ 0.53}  &  -0.19  &  0.36  &  0.64  &  1.56 \cr 
##  22   &  \bf{ 0.35}  &   0.00  &  -0.12  &  \bf{ 0.43}  &  -0.13  &   0.12  &   0.20  &  0.72  &  0.28  &  3.04 \cr 
##  23   &  \bf{ 0.34}  &  -0.15  &  \bf{ 0.51}  &   0.04  &   0.00  &  -0.07  &   0.12  &  0.53  &  0.47  &  2.18 \cr 
##  24   &  \bf{ 0.79}  &   0.08  &  -0.08  &   0.03  &  -0.06  &  -0.08  &   0.11  &  0.64  &  0.36  &  1.12 \cr 
##  25   &  \bf{ 0.77}  &   0.07  &   0.00  &  -0.06  &   0.06  &   0.07  &  -0.10  &  0.62  &  0.38  &  1.10 \cr 
##  26   &  \bf{ 0.80}  &   0.03  &  -0.11  &   0.15  &   0.00  &  -0.11  &  -0.01  &  0.64  &  0.36  &  1.16 \cr 
##  27   &  \bf{ 0.34}  &  -0.14  &  \bf{ 0.46}  &   0.10  &   0.03  &  -0.03  &   0.00  &  0.46  &  0.54  &  2.19 \cr 
##  28   &  \bf{ 0.96}  &   0.01  &  -0.11  &  -0.14  &   0.03  &  -0.01  &  -0.19  &  0.71  &  0.29  &  1.15 \cr 
##  29   &  -0.06  &  \bf{ 0.83}  &   0.02  &  -0.03  &   0.03  &  -0.08  &   0.09  &  0.66  &  0.34  &  1.06 \cr 
##  30   &   0.07  &  \bf{ 0.75}  &   0.03  &   0.01  &  -0.04  &  -0.04  &   0.08  &  0.57  &  0.43  &  1.05 \cr 
##  31   &   0.14  &  \bf{ 0.73}  &  -0.01  &  -0.03  &   0.07  &  -0.04  &  -0.11  &  0.54  &  0.46  &  1.15 \cr 
##  32   &   0.01  &  \bf{ 0.75}  &   0.12  &   0.04  &  -0.02  &   0.02  &   0.02  &  0.55  &  0.45  &  1.06 \cr 
##  33   &  -0.10  &  \bf{ 0.81}  &   0.07  &  -0.11  &  -0.04  &   0.05  &  -0.06  &  0.68  &  0.32  &  1.11 \cr 
## \hline \cr SS loadings & 4.65 &  3.17 &  3.11 &  2.28 &  2.1 &  1.98 &  1.58 &  \cr  
## \cr 
##             \hline \cr 
## MR6   &  1.00 &  0.04 &  0.23 &  0.36 &  0.22 &  0.56 &  0.37 \cr 
##  MR7   &  0.04 &  1.00 & -0.22 &  0.08 & -0.13 &  0.13 & -0.01 \cr 
##  MR4   &  0.23 & -0.22 &  1.00 & -0.29 &  0.61 &  0.05 & -0.02 \cr 
##  MR2   &  0.36 &  0.08 & -0.29 &  1.00 & -0.08 &  0.30 &  0.30 \cr 
##  MR1   &  0.22 & -0.13 &  0.61 & -0.08 &  1.00 &  0.13 &  0.03 \cr 
##  MR5   &  0.56 &  0.13 &  0.05 &  0.30 &  0.13 &  1.00 &  0.31 \cr 
##  MR3   &  0.37 & -0.01 & -0.02 &  0.30 &  0.03 &  0.31 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation Droping based on theory 6 factors

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  
#Factor 1 Present Focused:
PWB_1, PWB_2, 
#Factor 2 Understanding Self and Life, Making Plans::
APSI_1,  APSI_2,  APSI_4,  APSI_6, LET_6, PWB_8, PWB_4, APSI_7, APSI_8,  PWB_7, PWB_5, PWB_6, PWB_9,
#Factor 3 Meaningful activities:
LET_4,  PWB_3, LET_2, LET_3,  LET_5,  
#Factor 4 Values and Morals:
APSI_5,  APSI_3,  
#Factor 5 Have Purpose:
 LET_1, MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1,
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10
)
purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_4  <-  7- purposescales$PWB_4
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 33]
## 
##    PWB_1 PWB_2 APSI_1 APSI_2 APSI_4 APSI_6 LET_6 PWB_8 PWB_4 APSI_7 APSI_8
## 1      4     3      2      4      4      4     5     3     2      4      4
## 2      4     5      4      3      5      3     5     2     2      4      4
## 3      5     6      3      4      3      3     5     3     6      4      3
## 4      2     2      4      4      4      4     4     4     4      4      3
## 5      2     2      3      3      3      3     4     3     3      2      3
## 6      5     4      3      4      4      2     4     4     5      5      3
## 7      2     2      2      2      3      4     5     3     2      2      2
## 8      6     6      3      3      3      3     5     4     1      3      1
## 9      5     5      4      5      4      2     5     5     5      4      5
## 10     6     6      2      2      3      3     5     3     3      3      4
## ..   ...   ...    ...    ...    ...    ...   ...   ...   ...    ...    ...
## Variables not shown: PWB_7 (dbl), PWB_5 (dbl), PWB_6 (dbl), PWB_9 (dbl),
##   LET_4 (dbl), PWB_3 (dbl), LET_2 (dbl), LET_3 (dbl), LET_5 (dbl), APSI_5
##   (dbl), APSI_3 (dbl), LET_1 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl),
##   MLQ_9 (dbl), MLQ_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8
##   (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  33 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ PWB_4 : num  2 2 6 4 3 5 2 1 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_3: num  4 4 4 5 4 4 4 4 5 2 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(33,list(f1=1:2,f2=3:14, f3=15:19, f4=20:21,f5=22:28, f6=29:33))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR5    MR6    MR3    MR1    MR4   
## 1                               0.524  0.261
## 2   0.175                0.270  0.471 -0.115
## 3   0.683  0.205               -0.101 -0.139
## 4   0.607  0.132         0.181 -0.168       
## 5   0.809  0.144        -0.104              
## 6   0.206 -0.437  0.106 -0.172 -0.253 -0.216
## 7   0.121  0.186         0.401 -0.176  0.287
## 8   0.523  0.105         0.126              
## 9   0.303  0.256         0.224  0.431 -0.158
## 10  0.850                       0.158       
## 11  0.850                       0.144       
## 12  0.501  0.172         0.207 -0.131       
## 13        -0.134        -0.312 -0.349 -0.260
## 14  0.142  0.243                0.178  0.481
## 15  0.130 -0.217         0.419  0.385       
## 16  0.328                0.408 -0.300       
## 17 -0.187  0.174         0.522  0.218  0.190
## 18  0.289                0.503 -0.344 -0.165
## 19 -0.248  0.219         0.407  0.235  0.175
## 20 -0.271  0.221         0.313  0.234  0.267
## 21  0.647 -0.170         0.212 -0.152  0.108
## 22  0.203                              0.549
## 23         0.389 -0.173  0.320  0.145       
## 24  0.214  0.670               -0.155 -0.175
## 25  0.135  0.713                            
## 26  0.321  0.689                      -0.161
## 27         0.392 -0.160  0.185  0.200       
## 28         0.869        -0.141 -0.124       
## 29                0.834                     
## 30                0.757                     
## 31         0.159  0.734 -0.100              
## 32                0.747                     
## 33 -0.141         0.820                     
## 
##                  MR2   MR5   MR6   MR3   MR1   MR4
## SS loadings    4.703 3.251 3.179 1.923 1.695 1.152
## Proportion Var 0.143 0.099 0.096 0.058 0.051 0.035
## Cumulative Var 0.143 0.241 0.337 0.396 0.447 0.482
## 
## $score.cor
##            [,1]        [,2]         [,3]       [,4]       [,5]      [,6]
## [1,]  1.0000000 0.495778249  0.112073142  0.1958982 -0.0731306 0.2582537
## [2,]  0.4957782 1.000000000  0.006009564  0.6152412  0.3575539 0.4887588
## [3,]  0.1120731 0.006009564  1.000000000 -0.1347144 -0.1475729 0.1016746
## [4,]  0.1958982 0.615241150 -0.134714443  1.0000000  0.6952982 0.4853942
## [5,] -0.0731306 0.357553887 -0.147572857  0.6952982  1.0000000 0.4068429
## [6,]  0.2582537 0.488758819  0.101674585  0.4853942  0.4068429 1.0000000
## 
## $TLI
## [1] 0.9227126
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05111220 0.04782935 0.05344921 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 6, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR5   MR6   MR3   MR1   MR4   h2   u2 com
## 1   0.03 -0.04 -0.08  0.09  0.52  0.26 0.47 0.53 1.6
## 2   0.18 -0.03 -0.05  0.27  0.47 -0.11 0.34 0.66 2.1
## 3   0.68  0.21 -0.02  0.08 -0.10 -0.14 0.71 0.29 1.4
## 4   0.61  0.13 -0.05  0.18 -0.17 -0.06 0.61 0.39 1.5
## 5   0.81  0.14 -0.05 -0.10  0.06  0.02 0.67 0.33 1.1
## 6   0.21 -0.44  0.11 -0.17 -0.25 -0.22 0.65 0.35 3.3
## 7   0.12  0.19  0.02  0.40 -0.18  0.29 0.45 0.55 3.0
## 8   0.52  0.11 -0.04  0.13 -0.03  0.09 0.39 0.61 1.3
## 9   0.30  0.26 -0.07  0.22  0.43 -0.16 0.52 0.48 3.6
## 10  0.85  0.01  0.08 -0.10  0.16  0.10 0.65 0.35 1.1
## 11  0.85  0.08  0.01 -0.09  0.14 -0.04 0.69 0.31 1.1
## 12  0.50  0.17  0.07  0.21 -0.13  0.01 0.51 0.49 1.8
## 13  0.01 -0.13  0.03 -0.31 -0.35 -0.26 0.57 0.43 3.2
## 14  0.14  0.24  0.09  0.03  0.18  0.48 0.50 0.50 2.1
## 15  0.13 -0.22  0.03  0.42  0.38 -0.09 0.31 0.69 2.8
## 16  0.33  0.00  0.03  0.41 -0.30  0.02 0.41 0.59 2.8
## 17 -0.19  0.17 -0.02  0.52  0.22  0.19 0.69 0.31 2.2
## 18  0.29  0.10  0.04  0.50 -0.34 -0.17 0.56 0.44 2.8
## 19 -0.25  0.22 -0.07  0.41  0.24  0.18 0.62 0.38 3.6
## 20 -0.27  0.22 -0.03  0.31  0.23  0.27 0.60 0.40 4.7
## 21  0.65 -0.17  0.07  0.21 -0.15  0.11 0.53 0.47 1.6
## 22  0.20  0.10  0.03  0.03 -0.04  0.55 0.39 0.61 1.4
## 23 -0.09  0.39 -0.17  0.32  0.15 -0.01 0.51 0.49 2.8
## 24  0.21  0.67  0.09  0.08 -0.15 -0.17 0.64 0.36 1.6
## 25  0.14  0.71  0.08 -0.02 -0.05  0.09 0.61 0.39 1.1
## 26  0.32  0.69  0.04 -0.08 -0.03 -0.16 0.64 0.36 1.6
## 27 -0.01  0.39 -0.16  0.19  0.20  0.05 0.44 0.56 2.4
## 28  0.07  0.87  0.04 -0.14 -0.12  0.04 0.69 0.31 1.1
## 29 -0.05 -0.06  0.83  0.09  0.06 -0.07 0.66 0.34 1.1
## 30  0.02  0.05  0.76  0.08 -0.01 -0.07 0.57 0.43 1.1
## 31 -0.02  0.16  0.73 -0.10  0.10  0.02 0.55 0.45 1.2
## 32  0.03  0.03  0.75  0.06  0.06  0.03 0.55 0.45 1.0
## 33 -0.14 -0.05  0.82  0.01 -0.01  0.09 0.68 0.32 1.1
## 
##                        MR2  MR5  MR6  MR3  MR1  MR4
## SS loadings           5.16 3.91 3.20 2.53 2.08 1.46
## Proportion Var        0.16 0.12 0.10 0.08 0.06 0.04
## Cumulative Var        0.16 0.27 0.37 0.45 0.51 0.56
## Proportion Explained  0.28 0.21 0.17 0.14 0.11 0.08
## Cumulative Proportion 0.28 0.49 0.67 0.81 0.92 1.00
## 
##  With factor correlations of 
##       MR2   MR5   MR6   MR3   MR1   MR4
## MR2  1.00  0.32  0.17  0.21 -0.33 -0.11
## MR5  0.32  1.00 -0.05  0.52  0.22  0.32
## MR6  0.17 -0.05  1.00 -0.15 -0.20  0.00
## MR3  0.21  0.52 -0.15  1.00  0.32  0.28
## MR1 -0.33  0.22 -0.20  0.32  1.00  0.28
## MR4 -0.11  0.32  0.00  0.28  0.28  1.00
## 
## Mean item complexity =  2
## Test of the hypothesis that 6 factors are sufficient.
## 
## The degrees of freedom for the null model are  528  and the objective function was  18.23 with Chi Square of  20910.11
## The degrees of freedom for the model are 345  and the objective function was  1.2 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  649.93  with prob <  5.8e-21 
## The total number of observations was  1160  with MLE Chi Square =  1370.62  with prob <  4.4e-122 
## 
## Tucker Lewis Index of factoring reliability =  0.923
## RMSEA index =  0.051  and the 90 % confidence intervals are  0.048 0.053
## BIC =  -1063.76
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR5  MR6  MR3  MR1
## Correlation of scores with factors             0.96 0.95 0.94 0.91 0.89
## Multiple R square of scores with factors       0.93 0.90 0.89 0.82 0.79
## Minimum correlation of possible factor scores  0.85 0.80 0.78 0.65 0.57
##                                                 MR4
## Correlation of scores with factors             0.84
## Multiple R square of scores with factors       0.71
## Minimum correlation of possible factor scores  0.42
fa2latex(fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 6, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r }
##  \multicolumn{ 9 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR5  &  MR6  &  MR3  &  MR1  &  MR4  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.03  &  -0.04  &  -0.08  &   0.09  &  \bf{ 0.52}  &   0.26  &  0.47  &  0.53  &  1.61 \cr 
##  2   &   0.18  &  -0.03  &  -0.05  &   0.27  &  \bf{ 0.47}  &  -0.11  &  0.34  &  0.66  &  2.10 \cr 
##  3   &  \bf{ 0.68}  &   0.21  &  -0.02  &   0.08  &  -0.10  &  -0.14  &  0.71  &  0.29  &  1.35 \cr 
##  4   &  \bf{ 0.61}  &   0.13  &  -0.05  &   0.18  &  -0.17  &  -0.06  &  0.61  &  0.39  &  1.49 \cr 
##  5   &  \bf{ 0.81}  &   0.14  &  -0.05  &  -0.10  &   0.06  &   0.02  &  0.67  &  0.33  &  1.12 \cr 
##  6   &   0.21  &  \bf{-0.44}  &   0.11  &  -0.17  &  -0.25  &  -0.22  &  0.65  &  0.35  &  3.26 \cr 
##  7   &   0.12  &   0.19  &   0.02  &  \bf{ 0.40}  &  -0.18  &   0.29  &  0.45  &  0.55  &  3.00 \cr 
##  8   &  \bf{ 0.52}  &   0.11  &  -0.04  &   0.13  &  -0.03  &   0.09  &  0.39  &  0.61  &  1.29 \cr 
##  9   &   0.30  &   0.26  &  -0.07  &   0.22  &  \bf{ 0.43}  &  -0.16  &  0.52  &  0.48  &  3.56 \cr 
##  10   &  \bf{ 0.85}  &   0.01  &   0.08  &  -0.10  &   0.16  &   0.10  &  0.65  &  0.35  &  1.14 \cr 
##  11   &  \bf{ 0.85}  &   0.08  &   0.01  &  -0.09  &   0.14  &  -0.04  &  0.69  &  0.31  &  1.10 \cr 
##  12   &  \bf{ 0.50}  &   0.17  &   0.07  &   0.21  &  -0.13  &   0.01  &  0.51  &  0.49  &  1.80 \cr 
##  13   &   0.01  &  -0.13  &   0.03  &  \bf{-0.31}  &  \bf{-0.35}  &  -0.26  &  0.57  &  0.43  &  3.20 \cr 
##  14   &   0.14  &   0.24  &   0.09  &   0.03  &   0.18  &  \bf{ 0.48}  &  0.50  &  0.50  &  2.10 \cr 
##  15   &   0.13  &  -0.22  &   0.03  &  \bf{ 0.42}  &  \bf{ 0.38}  &  -0.09  &  0.31  &  0.69  &  2.85 \cr 
##  16   &  \bf{ 0.33}  &   0.00  &   0.03  &  \bf{ 0.41}  &  -0.30  &   0.02  &  0.41  &  0.59  &  2.82 \cr 
##  17   &  -0.19  &   0.17  &  -0.02  &  \bf{ 0.52}  &   0.22  &   0.19  &  0.69  &  0.31  &  2.23 \cr 
##  18   &   0.29  &   0.10  &   0.04  &  \bf{ 0.50}  &  \bf{-0.34}  &  -0.17  &  0.56  &  0.44  &  2.84 \cr 
##  19   &  -0.25  &   0.22  &  -0.07  &  \bf{ 0.41}  &   0.24  &   0.18  &  0.62  &  0.38  &  3.57 \cr 
##  20   &  -0.27  &   0.22  &  -0.03  &  \bf{ 0.31}  &   0.23  &   0.27  &  0.60  &  0.40  &  4.73 \cr 
##  21   &  \bf{ 0.65}  &  -0.17  &   0.07  &   0.21  &  -0.15  &   0.11  &  0.53  &  0.47  &  1.58 \cr 
##  22   &   0.20  &   0.10  &   0.03  &   0.03  &  -0.04  &  \bf{ 0.55}  &  0.39  &  0.61  &  1.36 \cr 
##  23   &  -0.09  &  \bf{ 0.39}  &  -0.17  &  \bf{ 0.32}  &   0.15  &  -0.01  &  0.51  &  0.49  &  2.83 \cr 
##  24   &   0.21  &  \bf{ 0.67}  &   0.09  &   0.08  &  -0.15  &  -0.17  &  0.64  &  0.36  &  1.56 \cr 
##  25   &   0.14  &  \bf{ 0.71}  &   0.08  &  -0.02  &  -0.05  &   0.09  &  0.61  &  0.39  &  1.15 \cr 
##  26   &  \bf{ 0.32}  &  \bf{ 0.69}  &   0.04  &  -0.08  &  -0.03  &  -0.16  &  0.64  &  0.36  &  1.58 \cr 
##  27   &  -0.01  &  \bf{ 0.39}  &  -0.16  &   0.19  &   0.20  &   0.05  &  0.44  &  0.56  &  2.42 \cr 
##  28   &   0.07  &  \bf{ 0.87}  &   0.04  &  -0.14  &  -0.12  &   0.04  &  0.69  &  0.31  &  1.11 \cr 
##  29   &  -0.05  &  -0.06  &  \bf{ 0.83}  &   0.09  &   0.06  &  -0.07  &  0.66  &  0.34  &  1.07 \cr 
##  30   &   0.02  &   0.05  &  \bf{ 0.76}  &   0.08  &  -0.01  &  -0.07  &  0.57  &  0.43  &  1.05 \cr 
##  31   &  -0.02  &   0.16  &  \bf{ 0.73}  &  -0.10  &   0.10  &   0.02  &  0.55  &  0.45  &  1.17 \cr 
##  32   &   0.03  &   0.03  &  \bf{ 0.75}  &   0.06  &   0.06  &   0.03  &  0.55  &  0.45  &  1.04 \cr 
##  33   &  -0.14  &  -0.05  &  \bf{ 0.82}  &   0.01  &  -0.01  &   0.09  &  0.68  &  0.32  &  1.10 \cr 
## \hline \cr SS loadings & 5.16 &  3.91 &  3.2 &  2.53 &  2.08 &  1.46 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.32 &  0.17 &  0.21 & -0.33 & -0.11 \cr 
##  MR5   &  0.32 &  1.00 & -0.05 &  0.52 &  0.22 &  0.32 \cr 
##  MR6   &  0.17 & -0.05 &  1.00 & -0.15 & -0.20 &  0.00 \cr 
##  MR3   &  0.21 &  0.52 & -0.15 &  1.00 &  0.32 &  0.28 \cr 
##  MR1   & -0.33 &  0.22 & -0.20 &  0.32 &  1.00 &  0.28 \cr 
##  MR4   & -0.11 &  0.32 &  0.00 &  0.28 &  0.28 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation Droping based on theory 5 factors and results of previous analysis of 6 factors

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  
#Factor 1 Present Focused:
PWB_1, PWB_2, PWB_4, PWB_5,
#Factor 2 Understanding Self and Life, Making Plans:
APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  PWB_7,  APSI_5,  APSI_1,
#Factor 3 Meaningful activities:
LET_4,  PWB_3, LET_2, LET_3,  LET_5,  LET_6, PWB_9, LET_1,
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, APSI_6,
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)

purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 31]
## 
##    PWB_1 PWB_2 PWB_4 PWB_5 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 PWB_7 APSI_5
## 1      4     3     5     4      4      4     3      4      4     4      4
## 2      4     5     5     2      3      5     2      4      4     3      4
## 3      5     6     1     1      4      3     3      4      3     6      3
## 4      2     2     3     3      4      4     4      4      3     5      5
## 5      2     2     4     4      3      3     3      2      3     2      4
## 6      5     4     2     3      4      4     4      5      3     3      4
## 7      2     2     5     1      2      3     3      2      2     3      4
## 8      6     6     6     2      3      3     4      3      1     4      5
## 9      5     5     2     1      5      4     5      4      5     5      4
## 10     6     6     4     2      2      3     3      3      4     6      5
## ..   ...   ...   ...   ...    ...    ...   ...    ...    ...   ...    ...
## Variables not shown: APSI_1 (dbl), LET_4 (dbl), PWB_3 (dbl), LET_2 (dbl),
##   LET_3 (dbl), LET_5 (dbl), LET_6 (dbl), PWB_9 (dbl), LET_1 (dbl), MLQ_4
##   (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_9 (dbl), MLQ_1 (dbl), APSI_6 (dbl),
##   MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  31 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(31,list(f1=1:4,f2=5:12, f3=13:20, f4=21:26,f5=27:31))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR5    MR4    MR3    MR1   
## 1                        0.136  0.591
## 2   0.224                0.205  0.442
## 3  -0.349        -0.186 -0.175 -0.402
## 4                -0.118 -0.390 -0.432
## 5   0.648         0.102  0.163 -0.132
## 6   0.805         0.175 -0.128  0.127
## 7   0.516         0.100  0.161       
## 8   0.830  0.103        -0.120  0.233
## 9   0.862         0.101 -0.138  0.185
## 10  0.518         0.132  0.242 -0.119
## 11  0.664        -0.149  0.190       
## 12  0.731         0.176              
## 13  0.368                0.453 -0.281
## 14 -0.183         0.104  0.611  0.275
## 15  0.373                0.512 -0.380
## 16 -0.257         0.161  0.495  0.279
## 17 -0.309         0.194  0.425  0.298
## 18                0.165  0.516       
## 19  0.200        -0.277  0.343  0.373
## 20        -0.173  0.308  0.374  0.146
## 21  0.252         0.591  0.105 -0.178
## 22                0.697              
## 23  0.334         0.637              
## 24        -0.149  0.352  0.226  0.239
## 25                0.847        -0.102
## 26  0.253        -0.414 -0.280 -0.312
## 27         0.807                     
## 28         0.739                     
## 29         0.727  0.172              
## 30         0.742                     
## 31 -0.134  0.823                     
## 
##                  MR2   MR5   MR4   MR3   MR1
## SS loadings    4.985 3.076 2.763 2.401 1.884
## Proportion Var 0.161 0.099 0.089 0.077 0.061
## Cumulative Var 0.161 0.260 0.349 0.427 0.487
## 
## $score.cor
##             [,1]       [,2]      [,3]       [,4]        [,5]
## [1,]  1.00000000  0.1120504 0.6172364  0.2221590 -0.02122252
## [2,]  0.11205039  1.0000000 0.1082917 -0.1644822 -0.14549440
## [3,]  0.61723637  0.1082917 1.0000000  0.4847094  0.24749080
## [4,]  0.22215902 -0.1644822 0.4847094  1.0000000  0.74769162
## [5,] -0.02122252 -0.1454944 0.2474908  0.7476916  1.00000000
## 
## $TLI
## [1] 0.9299961
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05028266 0.04692984 0.05277840 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR5   MR4   MR3   MR1   h2   u2 com
## 1  -0.03 -0.03 -0.01  0.14  0.59 0.45 0.55 1.1
## 2   0.22 -0.06 -0.09  0.20  0.44 0.28 0.72 2.1
## 3  -0.35  0.09 -0.19 -0.18 -0.40 0.46 0.54 2.9
## 4   0.04 -0.02 -0.12 -0.39 -0.43 0.56 0.44 2.2
## 5   0.65 -0.06  0.10  0.16 -0.13 0.61 0.39 1.3
## 6   0.80 -0.03  0.18 -0.13  0.13 0.66 0.34 1.2
## 7   0.52 -0.03  0.10  0.16  0.02 0.38 0.62 1.3
## 8   0.83  0.10  0.07 -0.12  0.23 0.63 0.37 1.2
## 9   0.86  0.01  0.10 -0.14  0.19 0.68 0.32 1.2
## 10  0.52  0.06  0.13  0.24 -0.12 0.51 0.49 1.7
## 11  0.66  0.08 -0.15  0.19 -0.06 0.50 0.50 1.3
## 12  0.73 -0.04  0.18  0.04 -0.09 0.71 0.29 1.2
## 13  0.37  0.04 -0.07  0.45 -0.28 0.42 0.58 2.7
## 14 -0.18  0.00  0.10  0.61  0.28 0.69 0.31 1.7
## 15  0.37  0.01 -0.02  0.51 -0.38 0.55 0.45 2.7
## 16 -0.26 -0.05  0.16  0.50  0.28 0.62 0.38 2.4
## 17 -0.31  0.01  0.19  0.43  0.30 0.59 0.41 3.2
## 18  0.10  0.06  0.16  0.52 -0.07 0.40 0.60 1.4
## 19  0.20  0.02 -0.28  0.34  0.37 0.26 0.74 3.4
## 20 -0.08 -0.17  0.31  0.37  0.15 0.49 0.51 2.9
## 21  0.25  0.07  0.59  0.10 -0.18 0.62 0.38 1.7
## 22  0.10  0.10  0.70  0.07 -0.01 0.61 0.39 1.1
## 23  0.33  0.02  0.64 -0.06 -0.06 0.62 0.38 1.6
## 24 -0.02 -0.15  0.35  0.23  0.24 0.44 0.56 3.0
## 25  0.02  0.04  0.85 -0.04 -0.10 0.68 0.32 1.0
## 26  0.25  0.07 -0.41 -0.28 -0.31 0.64 0.36 3.5
## 27 -0.01  0.81 -0.08  0.04  0.01 0.65 0.35 1.0
## 28  0.06  0.74  0.03  0.05 -0.04 0.57 0.43 1.0
## 29 -0.02  0.73  0.17 -0.10  0.08 0.54 0.46 1.2
## 30  0.06  0.74  0.03  0.05  0.06 0.55 0.45 1.0
## 31 -0.13  0.82 -0.03  0.01  0.00 0.67 0.33 1.1
## 
##                        MR2  MR5  MR4  MR3  MR1
## SS loadings           5.32 3.11 3.34 3.03 2.25
## Proportion Var        0.17 0.10 0.11 0.10 0.07
## Cumulative Var        0.17 0.27 0.38 0.48 0.55
## Proportion Explained  0.31 0.18 0.20 0.18 0.13
## Cumulative Proportion 0.31 0.49 0.69 0.87 1.00
## 
##  With factor correlations of 
##       MR2   MR5   MR4   MR3   MR1
## MR2  1.00  0.13  0.34  0.18 -0.35
## MR5  0.13  1.00 -0.03 -0.13 -0.18
## MR4  0.34 -0.03  1.00  0.55  0.20
## MR3  0.18 -0.13  0.55  1.00  0.40
## MR1 -0.35 -0.18  0.20  0.40  1.00
## 
## Mean item complexity =  1.8
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  465  and the objective function was  17.13 with Chi Square of  19660.29
## The degrees of freedom for the model are 320  and the objective function was  1.09 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  611.68  with prob <  1.6e-20 
## The total number of observations was  1160  with MLE Chi Square =  1241.98  with prob <  1.2e-108 
## 
## Tucker Lewis Index of factoring reliability =  0.93
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.047 0.053
## BIC =  -1016
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR5  MR4  MR3  MR1
## Correlation of scores with factors             0.96 0.94 0.94 0.93 0.90
## Multiple R square of scores with factors       0.93 0.88 0.88 0.86 0.81
## Minimum correlation of possible factor scores  0.86 0.77 0.77 0.71 0.63
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR5  &  MR4  &  MR3  &  MR1  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.03  &  -0.03  &  -0.01  &   0.14  &  \bf{ 0.59}  &  0.45  &  0.55  &  1.12 \cr 
##  2   &   0.22  &  -0.06  &  -0.09  &   0.20  &  \bf{ 0.44}  &  0.28  &  0.72  &  2.10 \cr 
##  3   &  \bf{-0.35}  &   0.09  &  -0.19  &  -0.18  &  \bf{-0.40}  &  0.46  &  0.54  &  2.95 \cr 
##  4   &   0.04  &  -0.02  &  -0.12  &  \bf{-0.39}  &  \bf{-0.43}  &  0.56  &  0.44  &  2.16 \cr 
##  5   &  \bf{ 0.65}  &  -0.06  &   0.10  &   0.16  &  -0.13  &  0.61  &  0.39  &  1.29 \cr 
##  6   &  \bf{ 0.80}  &  -0.03  &   0.18  &  -0.13  &   0.13  &  0.66  &  0.34  &  1.20 \cr 
##  7   &  \bf{ 0.52}  &  -0.03  &   0.10  &   0.16  &   0.02  &  0.38  &  0.62  &  1.29 \cr 
##  8   &  \bf{ 0.83}  &   0.10  &   0.07  &  -0.12  &   0.23  &  0.63  &  0.37  &  1.25 \cr 
##  9   &  \bf{ 0.86}  &   0.01  &   0.10  &  -0.14  &   0.19  &  0.68  &  0.32  &  1.17 \cr 
##  10   &  \bf{ 0.52}  &   0.06  &   0.13  &   0.24  &  -0.12  &  0.51  &  0.49  &  1.73 \cr 
##  11   &  \bf{ 0.66}  &   0.08  &  -0.15  &   0.19  &  -0.06  &  0.50  &  0.50  &  1.33 \cr 
##  12   &  \bf{ 0.73}  &  -0.04  &   0.18  &   0.04  &  -0.09  &  0.71  &  0.29  &  1.16 \cr 
##  13   &  \bf{ 0.37}  &   0.04  &  -0.07  &  \bf{ 0.45}  &  -0.28  &  0.42  &  0.58  &  2.71 \cr 
##  14   &  -0.18  &   0.00  &   0.10  &  \bf{ 0.61}  &   0.28  &  0.69  &  0.31  &  1.66 \cr 
##  15   &  \bf{ 0.37}  &   0.01  &  -0.02  &  \bf{ 0.51}  &  \bf{-0.38}  &  0.55  &  0.45  &  2.74 \cr 
##  16   &  -0.26  &  -0.05  &   0.16  &  \bf{ 0.50}  &   0.28  &  0.62  &  0.38  &  2.44 \cr 
##  17   &  \bf{-0.31}  &   0.01  &   0.19  &  \bf{ 0.43}  &   0.30  &  0.59  &  0.41  &  3.17 \cr 
##  18   &   0.10  &   0.06  &   0.16  &  \bf{ 0.52}  &  -0.07  &  0.40  &  0.60  &  1.36 \cr 
##  19   &   0.20  &   0.02  &  -0.28  &  \bf{ 0.34}  &  \bf{ 0.37}  &  0.26  &  0.74  &  3.44 \cr 
##  20   &  -0.08  &  -0.17  &  \bf{ 0.31}  &  \bf{ 0.37}  &   0.15  &  0.49  &  0.51  &  2.85 \cr 
##  21   &   0.25  &   0.07  &  \bf{ 0.59}  &   0.10  &  -0.18  &  0.62  &  0.38  &  1.66 \cr 
##  22   &   0.10  &   0.10  &  \bf{ 0.70}  &   0.07  &  -0.01  &  0.61  &  0.39  &  1.10 \cr 
##  23   &  \bf{ 0.33}  &   0.02  &  \bf{ 0.64}  &  -0.06  &  -0.06  &  0.62  &  0.38  &  1.55 \cr 
##  24   &  -0.02  &  -0.15  &  \bf{ 0.35}  &   0.23  &   0.24  &  0.44  &  0.56  &  2.98 \cr 
##  25   &   0.02  &   0.04  &  \bf{ 0.85}  &  -0.04  &  -0.10  &  0.68  &  0.32  &  1.04 \cr 
##  26   &   0.25  &   0.07  &  \bf{-0.41}  &  -0.28  &  \bf{-0.31}  &  0.64  &  0.36  &  3.53 \cr 
##  27   &  -0.01  &  \bf{ 0.81}  &  -0.08  &   0.04  &   0.01  &  0.65  &  0.35  &  1.03 \cr 
##  28   &   0.06  &  \bf{ 0.74}  &   0.03  &   0.05  &  -0.04  &  0.57  &  0.43  &  1.03 \cr 
##  29   &  -0.02  &  \bf{ 0.73}  &   0.17  &  -0.10  &   0.08  &  0.54  &  0.46  &  1.18 \cr 
##  30   &   0.06  &  \bf{ 0.74}  &   0.03  &   0.05  &   0.06  &  0.55  &  0.45  &  1.04 \cr 
##  31   &  -0.13  &  \bf{ 0.82}  &  -0.03  &   0.01  &   0.00  &  0.67  &  0.33  &  1.06 \cr 
## \hline \cr SS loadings & 5.32 &  3.11 &  3.34 &  3.03 &  2.25 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.13 &  0.34 &  0.18 & -0.35 \cr 
##  MR5   &  0.13 &  1.00 & -0.03 & -0.13 & -0.18 \cr 
##  MR4   &  0.34 & -0.03 &  1.00 &  0.55 &  0.20 \cr 
##  MR3   &  0.18 & -0.13 &  0.55 &  1.00 &  0.40 \cr 
##  MR1   & -0.35 & -0.18 &  0.20 &  0.40 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on theory 5 factors and number 19 (PWB_9) was changed to factor 1 where it loaded better in the previous analysis

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  
#Factor 1 Present Focused:
PWB_1, PWB_2, PWB_4, PWB_5,PWB_9,
#Factor 2 Understanding Self and Life, Making Plans:
APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  PWB_7,  APSI_5,  APSI_1,
#Factor 3 Meaningful activities:
LET_4,  PWB_3, LET_2, LET_3,  LET_5,  LET_6,  LET_1,
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, APSI_6,
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)

purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 31]
## 
##    PWB_1 PWB_2 PWB_4 PWB_5 PWB_9 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 PWB_7
## 1      4     3     5     4     6      4      4     3      4      4     4
## 2      4     5     5     2     5      3      5     2      4      4     3
## 3      5     6     1     1     6      4      3     3      4      3     6
## 4      2     2     3     3     4      4      4     4      4      3     5
## 5      2     2     4     4     4      3      3     3      2      3     2
## 6      5     4     2     3     6      4      4     4      5      3     3
## 7      2     2     5     1     3      2      3     3      2      2     3
## 8      6     6     6     2     6      3      3     4      3      1     4
## 9      5     5     2     1     6      5      4     5      4      5     5
## 10     6     6     4     2     6      2      3     3      3      4     6
## ..   ...   ...   ...   ...   ...    ...    ...   ...    ...    ...   ...
## Variables not shown: APSI_5 (dbl), APSI_1 (dbl), LET_4 (dbl), PWB_3 (dbl),
##   LET_2 (dbl), LET_3 (dbl), LET_5 (dbl), LET_6 (dbl), LET_1 (dbl), MLQ_4
##   (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_9 (dbl), MLQ_1 (dbl), APSI_6 (dbl),
##   MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  31 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(31,list(f1=1:5,f2=6:13, f3=14:20, f4=21:26,f5=27:31))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR5    MR4    MR1    MR3   
## 1                        0.639       
## 2   0.228                0.505  0.123
## 3  -0.355        -0.197 -0.441 -0.113
## 4                -0.132 -0.498 -0.304
## 5   0.198        -0.267  0.466  0.257
## 6   0.647               -0.106  0.185
## 7   0.818         0.173  0.124 -0.126
## 8   0.518                       0.158
## 9   0.845  0.106         0.246 -0.139
## 10  0.877         0.101  0.191 -0.147
## 11  0.515         0.122         0.257
## 12  0.664        -0.158         0.190
## 13  0.736         0.166              
## 14  0.355               -0.215  0.472
## 15 -0.195         0.113  0.362  0.536
## 16  0.357               -0.315  0.546
## 17 -0.266         0.171  0.343  0.427
## 18 -0.317         0.205  0.349  0.359
## 19                0.159         0.505
## 20        -0.174  0.311  0.180  0.342
## 21  0.251         0.581 -0.210  0.151
## 22  0.100         0.694              
## 23  0.340         0.631 -0.108       
## 24        -0.148  0.359  0.254  0.190
## 25                0.842 -0.176       
## 26  0.255        -0.425 -0.328 -0.229
## 27         0.807                     
## 28         0.738                     
## 29         0.728  0.175        -0.104
## 30         0.743                     
## 31 -0.135  0.822                     
## 
##                  MR2   MR5   MR4   MR1   MR3
## SS loadings    5.065 3.076 2.752 2.284 2.039
## Proportion Var 0.163 0.099 0.089 0.074 0.066
## Cumulative Var 0.163 0.263 0.351 0.425 0.491
## 
## $score.cor
##             [,1]        [,2]       [,3]        [,4]       [,5]
## [1,]  1.00000000  0.11205038 0.57935527 -0.03343417  0.2381114
## [2,]  0.11205038  1.00000000 0.01868692 -0.15457446 -0.1227911
## [3,]  0.57935527  0.01868692 1.00000000  0.42752334  0.5894654
## [4,] -0.03343417 -0.15457446 0.42752334  1.00000000  0.7233879
## [5,]  0.23811141 -0.12279114 0.58946544  0.72338791  1.0000000
## 
## $TLI
## [1] 0.9299961
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05028265 0.04692984 0.05277840 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR5   MR4   MR1   MR3   h2   u2 com
## 1  -0.02 -0.03  0.01  0.64  0.04 0.45 0.55 1.0
## 2   0.23 -0.06 -0.08  0.51  0.12 0.28 0.72 1.6
## 3  -0.36  0.09 -0.20 -0.44 -0.11 0.46 0.54 2.6
## 4   0.04 -0.02 -0.13 -0.50 -0.30 0.56 0.44 1.8
## 5   0.20  0.02 -0.27  0.47  0.26 0.26 0.74 2.7
## 6   0.65 -0.06  0.09 -0.11  0.19 0.61 0.39 1.3
## 7   0.82 -0.03  0.17  0.12 -0.13 0.66 0.34 1.2
## 8   0.52 -0.03  0.10  0.05  0.16 0.38 0.62 1.3
## 9   0.85  0.11  0.07  0.25 -0.14 0.63 0.37 1.3
## 10  0.88  0.01  0.10  0.19 -0.15 0.68 0.32 1.2
## 11  0.52  0.06  0.12 -0.09  0.26 0.51 0.49 1.7
## 12  0.66  0.08 -0.16 -0.01  0.19 0.50 0.50 1.3
## 13  0.74 -0.04  0.17 -0.08  0.06 0.71 0.29 1.1
## 14  0.35  0.03 -0.08 -0.22  0.47 0.42 0.58 2.4
## 15 -0.19  0.00  0.11  0.36  0.54 0.69 0.31 2.2
## 16  0.36  0.01 -0.03 -0.32  0.55 0.55 0.45 2.4
## 17 -0.27 -0.05  0.17  0.34  0.43 0.62 0.38 3.1
## 18 -0.32  0.01  0.20  0.35  0.36 0.59 0.41 3.6
## 19  0.09  0.06  0.16 -0.01  0.51 0.40 0.60 1.3
## 20 -0.08 -0.17  0.31  0.18  0.34 0.49 0.51 3.2
## 21  0.25  0.07  0.58 -0.21  0.15 0.62 0.38 1.8
## 22  0.10  0.10  0.69 -0.05  0.10 0.61 0.39 1.1
## 23  0.34  0.02  0.63 -0.11 -0.02 0.62 0.38 1.6
## 24 -0.02 -0.15  0.36  0.25  0.19 0.44 0.56 2.8
## 25  0.03  0.04  0.84 -0.18  0.01 0.68 0.32 1.1
## 26  0.26  0.07 -0.43 -0.33 -0.23 0.64 0.36 3.3
## 27 -0.01  0.81 -0.08  0.03  0.03 0.65 0.35 1.0
## 28  0.06  0.74  0.03 -0.03  0.05 0.57 0.43 1.0
## 29 -0.02  0.73  0.18  0.06 -0.10 0.54 0.46 1.2
## 30  0.06  0.74  0.03  0.07  0.04 0.55 0.45 1.0
## 31 -0.14  0.82 -0.03  0.00  0.00 0.67 0.33 1.1
## 
##                        MR2  MR5  MR4  MR1  MR3
## SS loadings           5.34 3.11 3.32 2.59 2.69
## Proportion Var        0.17 0.10 0.11 0.08 0.09
## Cumulative Var        0.17 0.27 0.38 0.46 0.55
## Proportion Explained  0.31 0.18 0.19 0.15 0.16
## Cumulative Proportion 0.31 0.50 0.69 0.84 1.00
## 
##  With factor correlations of 
##       MR2   MR5   MR4   MR1   MR3
## MR2  1.00  0.14  0.29 -0.34  0.25
## MR5  0.14  1.00 -0.04 -0.20 -0.10
## MR4  0.29 -0.04  1.00  0.30  0.55
## MR1 -0.34 -0.20  0.30  1.00  0.39
## MR3  0.25 -0.10  0.55  0.39  1.00
## 
## Mean item complexity =  1.8
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  465  and the objective function was  17.13 with Chi Square of  19660.29
## The degrees of freedom for the model are 320  and the objective function was  1.09 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  611.68  with prob <  1.6e-20 
## The total number of observations was  1160  with MLE Chi Square =  1241.98  with prob <  1.2e-108 
## 
## Tucker Lewis Index of factoring reliability =  0.93
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.047 0.053
## BIC =  -1016
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR5  MR4  MR1  MR3
## Correlation of scores with factors             0.96 0.94 0.94 0.92 0.91
## Multiple R square of scores with factors       0.93 0.88 0.88 0.84 0.83
## Minimum correlation of possible factor scores  0.86 0.77 0.76 0.68 0.67
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR5  &  MR4  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.02  &  -0.03  &   0.01  &  \bf{ 0.64}  &   0.04  &  0.45  &  0.55  &  1.01 \cr 
##  2   &   0.23  &  -0.06  &  -0.08  &  \bf{ 0.51}  &   0.12  &  0.28  &  0.72  &  1.61 \cr 
##  3   &  \bf{-0.36}  &   0.09  &  -0.20  &  \bf{-0.44}  &  -0.11  &  0.46  &  0.54  &  2.60 \cr 
##  4   &   0.04  &  -0.02  &  -0.13  &  \bf{-0.50}  &  -0.30  &  0.56  &  0.44  &  1.84 \cr 
##  5   &   0.20  &   0.02  &  -0.27  &  \bf{ 0.47}  &   0.26  &  0.26  &  0.74  &  2.67 \cr 
##  6   &  \bf{ 0.65}  &  -0.06  &   0.09  &  -0.11  &   0.19  &  0.61  &  0.39  &  1.28 \cr 
##  7   &  \bf{ 0.82}  &  -0.03  &   0.17  &   0.12  &  -0.13  &  0.66  &  0.34  &  1.19 \cr 
##  8   &  \bf{ 0.52}  &  -0.03  &   0.10  &   0.05  &   0.16  &  0.38  &  0.62  &  1.29 \cr 
##  9   &  \bf{ 0.85}  &   0.11  &   0.07  &   0.25  &  -0.14  &  0.63  &  0.37  &  1.28 \cr 
##  10   &  \bf{ 0.88}  &   0.01  &   0.10  &   0.19  &  -0.15  &  0.68  &  0.32  &  1.18 \cr 
##  11   &  \bf{ 0.52}  &   0.06  &   0.12  &  -0.09  &   0.26  &  0.51  &  0.49  &  1.71 \cr 
##  12   &  \bf{ 0.66}  &   0.08  &  -0.16  &  -0.01  &   0.19  &  0.50  &  0.50  &  1.32 \cr 
##  13   &  \bf{ 0.74}  &  -0.04  &   0.17  &  -0.08  &   0.06  &  0.71  &  0.29  &  1.14 \cr 
##  14   &  \bf{ 0.35}  &   0.03  &  -0.08  &  -0.22  &  \bf{ 0.47}  &  0.42  &  0.58  &  2.40 \cr 
##  15   &  -0.19  &   0.00  &   0.11  &  \bf{ 0.36}  &  \bf{ 0.54}  &  0.69  &  0.31  &  2.17 \cr 
##  16   &  \bf{ 0.36}  &   0.01  &  -0.03  &  \bf{-0.32}  &  \bf{ 0.55}  &  0.55  &  0.45  &  2.41 \cr 
##  17   &  -0.27  &  -0.05  &   0.17  &  \bf{ 0.34}  &  \bf{ 0.43}  &  0.62  &  0.38  &  3.05 \cr 
##  18   &  \bf{-0.32}  &   0.01  &   0.20  &  \bf{ 0.35}  &  \bf{ 0.36}  &  0.59  &  0.41  &  3.57 \cr 
##  19   &   0.09  &   0.06  &   0.16  &  -0.01  &  \bf{ 0.51}  &  0.40  &  0.60  &  1.29 \cr 
##  20   &  -0.08  &  -0.17  &  \bf{ 0.31}  &   0.18  &  \bf{ 0.34}  &  0.49  &  0.51  &  3.21 \cr 
##  21   &   0.25  &   0.07  &  \bf{ 0.58}  &  -0.21  &   0.15  &  0.62  &  0.38  &  1.85 \cr 
##  22   &   0.10  &   0.10  &  \bf{ 0.69}  &  -0.05  &   0.10  &  0.61  &  0.39  &  1.13 \cr 
##  23   &  \bf{ 0.34}  &   0.02  &  \bf{ 0.63}  &  -0.11  &  -0.02  &  0.62  &  0.38  &  1.61 \cr 
##  24   &  -0.02  &  -0.15  &  \bf{ 0.36}  &   0.25  &   0.19  &  0.44  &  0.56  &  2.81 \cr 
##  25   &   0.03  &   0.04  &  \bf{ 0.84}  &  -0.18  &   0.01  &  0.68  &  0.32  &  1.09 \cr 
##  26   &   0.26  &   0.07  &  \bf{-0.43}  &  \bf{-0.33}  &  -0.23  &  0.64  &  0.36  &  3.30 \cr 
##  27   &  -0.01  &  \bf{ 0.81}  &  -0.08  &   0.03  &   0.03  &  0.65  &  0.35  &  1.02 \cr 
##  28   &   0.06  &  \bf{ 0.74}  &   0.03  &  -0.03  &   0.05  &  0.57  &  0.43  &  1.03 \cr 
##  29   &  -0.02  &  \bf{ 0.73}  &   0.18  &   0.06  &  -0.10  &  0.54  &  0.46  &  1.17 \cr 
##  30   &   0.06  &  \bf{ 0.74}  &   0.03  &   0.07  &   0.04  &  0.55  &  0.45  &  1.04 \cr 
##  31   &  -0.14  &  \bf{ 0.82}  &  -0.03  &   0.00  &   0.00  &  0.67  &  0.33  &  1.06 \cr 
## \hline \cr SS loadings & 5.34 &  3.11 &  3.32 &  2.59 &  2.69 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.14 &  0.29 & -0.34 &  0.25 \cr 
##  MR5   &  0.14 &  1.00 & -0.04 & -0.20 & -0.10 \cr 
##  MR4   &  0.29 & -0.04 &  1.00 &  0.30 &  0.55 \cr 
##  MR1   & -0.34 & -0.20 &  0.30 &  1.00 &  0.39 \cr 
##  MR3   &  0.25 & -0.10 &  0.55 &  0.39 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on theory 5 factors same as previous but droping number 18 (LET_5) because it loaded on two factors (1 and 3)

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  
#Factor 1 Present Focused:
PWB_1, PWB_2, PWB_4, PWB_5,PWB_9,
#Factor 2 Understanding Self and Life, Making Plans:
APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  PWB_7,  APSI_5,  APSI_1,
#Factor 3 Meaningful activities:
LET_4,  PWB_3, LET_2, LET_3, LET_6,  LET_1,
#Factor 4 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, APSI_6,
#Factor 5 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)

purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 30]
## 
##    PWB_1 PWB_2 PWB_4 PWB_5 PWB_9 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 PWB_7
## 1      4     3     5     4     6      4      4     3      4      4     4
## 2      4     5     5     2     5      3      5     2      4      4     3
## 3      5     6     1     1     6      4      3     3      4      3     6
## 4      2     2     3     3     4      4      4     4      4      3     5
## 5      2     2     4     4     4      3      3     3      2      3     2
## 6      5     4     2     3     6      4      4     4      5      3     3
## 7      2     2     5     1     3      2      3     3      2      2     3
## 8      6     6     6     2     6      3      3     4      3      1     4
## 9      5     5     2     1     6      5      4     5      4      5     5
## 10     6     6     4     2     6      2      3     3      3      4     6
## ..   ...   ...   ...   ...   ...    ...    ...   ...    ...    ...   ...
## Variables not shown: APSI_5 (dbl), APSI_1 (dbl), LET_4 (dbl), PWB_3 (dbl),
##   LET_2 (dbl), LET_3 (dbl), LET_6 (dbl), LET_1 (dbl), MLQ_4 (dbl), MLQ_5
##   (dbl), MLQ_6 (dbl), MLQ_9 (dbl), MLQ_1 (dbl), APSI_6 (dbl), MLQ_2 (dbl),
##   MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  30 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(30,list(f1=1:5,f2=6:13, f3=14:19, f4=20:25,f5=26:30))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR5    MR4    MR1    MR3   
## 1                        0.656       
## 2   0.207                0.531       
## 3  -0.340        -0.205 -0.462       
## 4                -0.154 -0.546 -0.251
## 5   0.169        -0.257  0.504  0.223
## 6   0.629                       0.206
## 7   0.823         0.154  0.106 -0.106
## 8   0.504                       0.157
## 9   0.849  0.104         0.229 -0.125
## 10  0.886                0.172 -0.133
## 11  0.493         0.121         0.266
## 12  0.644        -0.167         0.208
## 13  0.723         0.152              
## 14  0.306               -0.169  0.502
## 15 -0.243         0.146  0.429  0.475
## 16  0.304               -0.264  0.577
## 17 -0.289         0.209  0.388  0.341
## 18                0.177         0.490
## 19 -0.111 -0.171  0.337  0.220  0.295
## 20  0.237         0.583 -0.200  0.163
## 21         0.100  0.703              
## 22  0.342         0.629 -0.118       
## 23        -0.145  0.379  0.278  0.144
## 24                0.848 -0.181       
## 25  0.274        -0.453 -0.359 -0.172
## 26         0.807                     
## 27         0.739                     
## 28         0.729  0.175        -0.110
## 29         0.744                     
## 30 -0.135  0.824                     
## 
##                  MR2   MR5   MR4   MR1   MR3
## SS loadings    4.830 3.079 2.805 2.380 1.718
## Proportion Var 0.161 0.103 0.093 0.079 0.057
## Cumulative Var 0.161 0.264 0.357 0.436 0.494
## 
## $score.cor
##             [,1]        [,2]        [,3]        [,4]       [,5]
## [1,]  1.00000000  0.11343906  0.53616337 -0.00946579 0.60184781
## [2,]  0.11343906  1.00000000 -0.02508599 -0.15405454 0.05528958
## [3,]  0.53616337 -0.02508599  1.00000000  0.50483736 0.52720609
## [4,] -0.00946579 -0.15405454  0.50483736  1.00000000 0.25799457
## [5,]  0.60184781  0.05528958  0.52720609  0.25799457 1.00000000
## 
## $TLI
## [1] 0.9325668
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04972455 0.04625895 0.05236026 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR5   MR4   MR1   MR3   h2   u2 com
## 1  -0.03 -0.03  0.02  0.66 -0.02 0.45 0.55 1.0
## 2   0.21 -0.06 -0.07  0.53  0.09 0.29 0.71 1.4
## 3  -0.34  0.08 -0.21 -0.46 -0.08 0.46 0.54 2.4
## 4   0.07 -0.02 -0.15 -0.55 -0.25 0.57 0.43 1.6
## 5   0.17  0.03 -0.26  0.50  0.22 0.27 0.73 2.2
## 6   0.63 -0.06  0.08 -0.09  0.21 0.61 0.39 1.3
## 7   0.82 -0.03  0.15  0.11 -0.11 0.66 0.34 1.1
## 8   0.50 -0.03  0.09  0.06  0.16 0.38 0.62 1.3
## 9   0.85  0.10  0.05  0.23 -0.13 0.63 0.37 1.2
## 10  0.89  0.01  0.08  0.17 -0.13 0.69 0.31 1.1
## 11  0.49  0.06  0.12 -0.07  0.27 0.51 0.49 1.8
## 12  0.64  0.07 -0.17  0.00  0.21 0.50 0.50 1.4
## 13  0.72 -0.04  0.15 -0.08  0.09 0.70 0.30 1.2
## 14  0.31  0.03 -0.08 -0.17  0.50 0.42 0.58 2.0
## 15 -0.24  0.01  0.15  0.43  0.48 0.70 0.30 2.7
## 16  0.30  0.01 -0.03 -0.26  0.58 0.55 0.45 2.0
## 17 -0.29 -0.05  0.21  0.39  0.34 0.59 0.41 3.5
## 18  0.04  0.06  0.18  0.04  0.49 0.40 0.60 1.3
## 19 -0.11 -0.17  0.34  0.22  0.30 0.49 0.51 3.5
## 20  0.24  0.07  0.58 -0.20  0.16 0.62 0.38 1.8
## 21  0.10  0.10  0.70 -0.04  0.08 0.61 0.39 1.1
## 22  0.34  0.02  0.63 -0.12 -0.01 0.62 0.38 1.6
## 23 -0.03 -0.15  0.38  0.28  0.14 0.44 0.56 2.5
## 24  0.03  0.05  0.85 -0.18  0.02 0.68 0.32 1.1
## 25  0.27  0.07 -0.45 -0.36 -0.17 0.65 0.35 3.0
## 26 -0.01  0.81 -0.08  0.03  0.03 0.65 0.35 1.0
## 27  0.05  0.74  0.03 -0.02  0.06 0.57 0.43 1.0
## 28 -0.01  0.73  0.17  0.05 -0.11 0.54 0.46 1.2
## 29  0.05  0.74  0.03  0.08  0.03 0.55 0.45 1.0
## 30 -0.14  0.82 -0.03  0.00  0.00 0.67 0.33 1.1
## 
##                        MR2  MR5  MR4  MR1  MR3
## SS loadings           5.13 3.11 3.32 2.60 2.30
## Proportion Var        0.17 0.10 0.11 0.09 0.08
## Cumulative Var        0.17 0.27 0.39 0.47 0.55
## Proportion Explained  0.31 0.19 0.20 0.16 0.14
## Cumulative Proportion 0.31 0.50 0.70 0.86 1.00
## 
##  With factor correlations of 
##       MR2   MR5   MR4   MR1   MR3
## MR2  1.00  0.15  0.30 -0.31  0.36
## MR5  0.15  1.00 -0.05 -0.21 -0.07
## MR4  0.30 -0.05  1.00  0.33  0.54
## MR1 -0.31 -0.21  0.33  1.00  0.32
## MR3  0.36 -0.07  0.54  0.32  1.00
## 
## Mean item complexity =  1.7
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  435  and the objective function was  16.26 with Chi Square of  18670.29
## The degrees of freedom for the model are 295  and the objective function was  0.98 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  560.77  with prob <  9.8e-19 
## The total number of observations was  1160  with MLE Chi Square =  1126.43  with prob <  2.2e-97 
## 
## Tucker Lewis Index of factoring reliability =  0.933
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.046 0.052
## BIC =  -955.14
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR5  MR4  MR1  MR3
## Correlation of scores with factors             0.96 0.94 0.94 0.92 0.90
## Multiple R square of scores with factors       0.93 0.89 0.88 0.85 0.81
## Minimum correlation of possible factor scores  0.86 0.77 0.77 0.69 0.62
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR5  &  MR4  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.03  &  -0.03  &   0.02  &  \bf{ 0.66}  &  -0.02  &  0.45  &  0.55  &  1.01 \cr 
##  2   &   0.21  &  -0.06  &  -0.07  &  \bf{ 0.53}  &   0.09  &  0.29  &  0.71  &  1.43 \cr 
##  3   &  \bf{-0.34}  &   0.08  &  -0.21  &  \bf{-0.46}  &  -0.08  &  0.46  &  0.54  &  2.43 \cr 
##  4   &   0.07  &  -0.02  &  -0.15  &  \bf{-0.55}  &  -0.25  &  0.57  &  0.43  &  1.63 \cr 
##  5   &   0.17  &   0.03  &  -0.26  &  \bf{ 0.50}  &   0.22  &  0.27  &  0.73  &  2.20 \cr 
##  6   &  \bf{ 0.63}  &  -0.06  &   0.08  &  -0.09  &   0.21  &  0.61  &  0.39  &  1.32 \cr 
##  7   &  \bf{ 0.82}  &  -0.03  &   0.15  &   0.11  &  -0.11  &  0.66  &  0.34  &  1.14 \cr 
##  8   &  \bf{ 0.50}  &  -0.03  &   0.09  &   0.06  &   0.16  &  0.38  &  0.62  &  1.31 \cr 
##  9   &  \bf{ 0.85}  &   0.10  &   0.05  &   0.23  &  -0.13  &  0.63  &  0.37  &  1.23 \cr 
##  10   &  \bf{ 0.89}  &   0.01  &   0.08  &   0.17  &  -0.13  &  0.69  &  0.31  &  1.14 \cr 
##  11   &  \bf{ 0.49}  &   0.06  &   0.12  &  -0.07  &   0.27  &  0.51  &  0.49  &  1.76 \cr 
##  12   &  \bf{ 0.64}  &   0.07  &  -0.17  &   0.00  &   0.21  &  0.50  &  0.50  &  1.38 \cr 
##  13   &  \bf{ 0.72}  &  -0.04  &   0.15  &  -0.08  &   0.09  &  0.70  &  0.30  &  1.15 \cr 
##  14   &  \bf{ 0.31}  &   0.03  &  -0.08  &  -0.17  &  \bf{ 0.50}  &  0.42  &  0.58  &  1.99 \cr 
##  15   &  -0.24  &   0.01  &   0.15  &  \bf{ 0.43}  &  \bf{ 0.48}  &  0.70  &  0.30  &  2.71 \cr 
##  16   &   0.30  &   0.01  &  -0.03  &  -0.26  &  \bf{ 0.58}  &  0.55  &  0.45  &  1.98 \cr 
##  17   &  -0.29  &  -0.05  &   0.21  &  \bf{ 0.39}  &  \bf{ 0.34}  &  0.59  &  0.41  &  3.49 \cr 
##  18   &   0.04  &   0.06  &   0.18  &   0.04  &  \bf{ 0.49}  &  0.40  &  0.60  &  1.32 \cr 
##  19   &  -0.11  &  -0.17  &  \bf{ 0.34}  &   0.22  &   0.30  &  0.49  &  0.51  &  3.55 \cr 
##  20   &   0.24  &   0.07  &  \bf{ 0.58}  &  -0.20  &   0.16  &  0.62  &  0.38  &  1.80 \cr 
##  21   &   0.10  &   0.10  &  \bf{ 0.70}  &  -0.04  &   0.08  &  0.61  &  0.39  &  1.12 \cr 
##  22   &  \bf{ 0.34}  &   0.02  &  \bf{ 0.63}  &  -0.12  &  -0.01  &  0.62  &  0.38  &  1.63 \cr 
##  23   &  -0.03  &  -0.15  &  \bf{ 0.38}  &   0.28  &   0.14  &  0.44  &  0.56  &  2.53 \cr 
##  24   &   0.03  &   0.05  &  \bf{ 0.85}  &  -0.18  &   0.02  &  0.68  &  0.32  &  1.10 \cr 
##  25   &   0.27  &   0.07  &  \bf{-0.45}  &  \bf{-0.36}  &  -0.17  &  0.65  &  0.35  &  3.01 \cr 
##  26   &  -0.01  &  \bf{ 0.81}  &  -0.08  &   0.03  &   0.03  &  0.65  &  0.35  &  1.02 \cr 
##  27   &   0.05  &  \bf{ 0.74}  &   0.03  &  -0.02  &   0.06  &  0.57  &  0.43  &  1.03 \cr 
##  28   &  -0.01  &  \bf{ 0.73}  &   0.17  &   0.05  &  -0.11  &  0.54  &  0.46  &  1.17 \cr 
##  29   &   0.05  &  \bf{ 0.74}  &   0.03  &   0.08  &   0.03  &  0.55  &  0.45  &  1.04 \cr 
##  30   &  -0.14  &  \bf{ 0.82}  &  -0.03  &   0.00  &   0.00  &  0.67  &  0.33  &  1.06 \cr 
## \hline \cr SS loadings & 5.13 &  3.11 &  3.32 &  2.6 &  2.3 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.15 &  0.30 & -0.31 &  0.36 \cr 
##  MR5   &  0.15 &  1.00 & -0.05 & -0.21 & -0.07 \cr 
##  MR4   &  0.30 & -0.05 &  1.00 &  0.33 &  0.54 \cr 
##  MR1   & -0.31 & -0.21 &  0.33 &  1.00 &  0.32 \cr 
##  MR3   &  0.36 & -0.07 &  0.54 &  0.32 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on theory 5 Factor Based in Theory (results) activities factor seems not to hold up on its own so I am making it into two factors:positive and negative questions

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Present Focused:
PWB_1, PWB_2, PWB_5, PWB_4, 
#Factor 2 Understanding Self and Life, Making Plans:
APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  PWB_7,  APSI_5,  APSI_1,
#Factor 3 Meaningful activities:
LET_4,  LET_2,  LET_6,  
#Factor 4 Meaningful activities Negative
PWB_9, LET_3, PWB_3,
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, APSI_6,LET_1,
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 30]
## 
##    PWB_1 PWB_2 PWB_5 PWB_4 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 PWB_7 APSI_5
## 1      4     3     4     5      4      4     3      4      4     4      4
## 2      4     5     2     5      3      5     2      4      4     3      4
## 3      5     6     1     1      4      3     3      4      3     6      3
## 4      2     2     3     3      4      4     4      4      3     5      5
## 5      2     2     4     4      3      3     3      2      3     2      4
## 6      5     4     3     2      4      4     4      5      3     3      4
## 7      2     2     1     5      2      3     3      2      2     3      4
## 8      6     6     2     6      3      3     4      3      1     4      5
## 9      5     5     1     2      5      4     5      4      5     5      4
## 10     6     6     2     4      2      3     3      3      4     6      5
## ..   ...   ...   ...   ...    ...    ...   ...    ...    ...   ...    ...
## Variables not shown: APSI_1 (dbl), LET_4 (dbl), LET_2 (dbl), LET_6 (dbl),
##   PWB_9 (dbl), LET_3 (dbl), PWB_3 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6
##   (dbl), MLQ_9 (dbl), MLQ_1 (dbl), APSI_6 (dbl), LET_1 (dbl), MLQ_2 (dbl),
##   MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  30 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(30,list(f1=1:6,f2=6:14, f3=14:18, f4=19:25,f5=26:30))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR4    MR5    MR1    MR3   
## 1  -0.119                0.567  0.134
## 2   0.183                0.448  0.181
## 3         -0.185        -0.444 -0.345
## 4  -0.287 -0.228        -0.411 -0.119
## 5   0.707  0.120                     
## 6   0.742  0.161         0.138 -0.179
## 7   0.544  0.122                     
## 8   0.760         0.109  0.240 -0.162
## 9   0.795                0.196 -0.191
## 10  0.592  0.162                0.156
## 11  0.741 -0.146                0.121
## 12  0.744  0.181                     
## 13  0.535               -0.205  0.378
## 14  0.569               -0.293  0.420
## 15  0.214  0.239                0.429
## 16  0.223 -0.246         0.396  0.308
## 17 -0.222  0.252         0.294  0.410
## 18 -0.120  0.200         0.309  0.538
## 19  0.262  0.633        -0.153       
## 20         0.746  0.104              
## 21  0.279  0.663               -0.119
## 22         0.415 -0.143  0.243  0.166
## 23         0.893        -0.109       
## 24  0.299 -0.490        -0.305 -0.235
## 25         0.387 -0.173  0.169  0.299
## 26                0.804              
## 27                0.737              
## 28         0.156  0.731              
## 29                0.742              
## 30 -0.114         0.822              
## 
##                  MR2   MR4   MR5   MR1   MR3
## SS loadings    5.189 3.251 3.068 1.715 1.600
## Proportion Var 0.173 0.108 0.102 0.057 0.053
## Cumulative Var 0.173 0.281 0.384 0.441 0.494
## 
## $score.cor
##             [,1]       [,2]        [,3]         [,4]       [,5]
## [1,] 1.000000000 0.57934558  0.11205829  0.008962812  0.1555875
## [2,] 0.579345584 1.00000000  0.01868717  0.399993384  0.5633471
## [3,] 0.112058290 0.01868717  1.00000000 -0.144712000 -0.1410586
## [4,] 0.008962812 0.39999338 -0.14471200  1.000000000  0.6817215
## [5,] 0.155587461 0.56334712 -0.14105863  0.681721493  1.0000000
## 
## $TLI
## [1] 0.9325668
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04972455 0.04625895 0.05236026 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR4   MR5   MR1   MR3   h2   u2 com
## 1  -0.12  0.01 -0.02  0.57  0.13 0.45 0.55 1.2
## 2   0.18 -0.06 -0.05  0.45  0.18 0.29 0.71 1.8
## 3   0.05 -0.18 -0.02 -0.44 -0.34 0.57 0.43 2.3
## 4  -0.29 -0.23  0.08 -0.41 -0.12 0.46 0.54 2.7
## 5   0.71  0.12 -0.06 -0.08  0.08 0.61 0.39 1.1
## 6   0.74  0.16 -0.03  0.14 -0.18 0.66 0.34 1.3
## 7   0.54  0.12 -0.03  0.06  0.09 0.38 0.62 1.2
## 8   0.76  0.05  0.11  0.24 -0.16 0.63 0.37 1.4
## 9   0.80  0.08  0.01  0.20 -0.19 0.69 0.31 1.3
## 10  0.59  0.16  0.06 -0.07  0.16 0.51 0.49 1.3
## 11  0.74 -0.15  0.07 -0.01  0.12 0.50 0.50 1.2
## 12  0.74  0.18 -0.04 -0.05 -0.03 0.70 0.30 1.1
## 13  0.53 -0.03  0.02 -0.21  0.38 0.42 0.58 2.1
## 14  0.57  0.04 -0.01 -0.29  0.42 0.55 0.45 2.4
## 15  0.21  0.24  0.05 -0.02  0.43 0.40 0.60 2.1
## 16  0.22 -0.25  0.02  0.40  0.31 0.27 0.73 3.3
## 17 -0.22  0.25 -0.05  0.29  0.41 0.59 0.41 3.2
## 18 -0.12  0.20  0.00  0.31  0.54 0.70 0.30 2.0
## 19  0.26  0.63  0.07 -0.15  0.04 0.62 0.38 1.5
## 20  0.06  0.75  0.10  0.00  0.01 0.61 0.39 1.1
## 21  0.28  0.66  0.02 -0.05 -0.12 0.62 0.38 1.4
## 22 -0.05  0.41 -0.14  0.24  0.17 0.44 0.56 2.3
## 23 -0.04  0.89  0.05 -0.11 -0.08 0.68 0.32 1.1
## 24  0.30 -0.49  0.07 -0.31 -0.23 0.65 0.35 3.0
## 25 -0.06  0.39 -0.17  0.17  0.30 0.49 0.51 2.8
## 26  0.02 -0.10  0.80  0.01  0.05 0.65 0.35 1.0
## 27  0.09  0.02  0.74 -0.03  0.05 0.57 0.43 1.0
## 28 -0.06  0.16  0.73  0.06 -0.08 0.54 0.46 1.1
## 29  0.07  0.02  0.74  0.06  0.05 0.55 0.45 1.0
## 30 -0.11 -0.05  0.82 -0.01  0.03 0.67 0.33 1.0
## 
##                        MR2  MR4  MR5  MR1  MR3
## SS loadings           5.47 3.78 3.10 2.08 2.04
## Proportion Var        0.18 0.13 0.10 0.07 0.07
## Cumulative Var        0.18 0.31 0.41 0.48 0.55
## Proportion Explained  0.33 0.23 0.19 0.13 0.12
## Cumulative Proportion 0.33 0.56 0.75 0.88 1.00
## 
##  With factor correlations of 
##       MR2   MR4   MR5   MR1   MR3
## MR2  1.00  0.42  0.12 -0.17 -0.02
## MR4  0.42  1.00 -0.03  0.28  0.40
## MR5  0.12 -0.03  1.00 -0.18 -0.15
## MR1 -0.17  0.28 -0.18  1.00  0.42
## MR3 -0.02  0.40 -0.15  0.42  1.00
## 
## Mean item complexity =  1.7
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  435  and the objective function was  16.26 with Chi Square of  18670.29
## The degrees of freedom for the model are 295  and the objective function was  0.98 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  560.77  with prob <  9.8e-19 
## The total number of observations was  1160  with MLE Chi Square =  1126.43  with prob <  2.2e-97 
## 
## Tucker Lewis Index of factoring reliability =  0.933
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.046 0.052
## BIC =  -955.14
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR4  MR5  MR1  MR3
## Correlation of scores with factors             0.96 0.95 0.94 0.89 0.89
## Multiple R square of scores with factors       0.93 0.90 0.88 0.79 0.79
## Minimum correlation of possible factor scores  0.86 0.80 0.77 0.58 0.59
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR4  &  MR5  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.12  &   0.01  &  -0.02  &  \bf{ 0.57}  &   0.13  &  0.45  &  0.55  &  1.21 \cr 
##  2   &   0.18  &  -0.06  &  -0.05  &  \bf{ 0.45}  &   0.18  &  0.29  &  0.71  &  1.76 \cr 
##  3   &   0.05  &  -0.18  &  -0.02  &  \bf{-0.44}  &  \bf{-0.34}  &  0.57  &  0.43  &  2.31 \cr 
##  4   &  -0.29  &  -0.23  &   0.08  &  \bf{-0.41}  &  -0.12  &  0.46  &  0.54  &  2.74 \cr 
##  5   &  \bf{ 0.71}  &   0.12  &  -0.06  &  -0.08  &   0.08  &  0.61  &  0.39  &  1.13 \cr 
##  6   &  \bf{ 0.74}  &   0.16  &  -0.03  &   0.14  &  -0.18  &  0.66  &  0.34  &  1.29 \cr 
##  7   &  \bf{ 0.54}  &   0.12  &  -0.03  &   0.06  &   0.09  &  0.38  &  0.62  &  1.18 \cr 
##  8   &  \bf{ 0.76}  &   0.05  &   0.11  &   0.24  &  -0.16  &  0.63  &  0.37  &  1.35 \cr 
##  9   &  \bf{ 0.80}  &   0.08  &   0.01  &   0.20  &  -0.19  &  0.69  &  0.31  &  1.26 \cr 
##  10   &  \bf{ 0.59}  &   0.16  &   0.06  &  -0.07  &   0.16  &  0.51  &  0.49  &  1.35 \cr 
##  11   &  \bf{ 0.74}  &  -0.15  &   0.07  &  -0.01  &   0.12  &  0.50  &  0.50  &  1.15 \cr 
##  12   &  \bf{ 0.74}  &   0.18  &  -0.04  &  -0.05  &  -0.03  &  0.70  &  0.30  &  1.14 \cr 
##  13   &  \bf{ 0.53}  &  -0.03  &   0.02  &  -0.21  &  \bf{ 0.38}  &  0.42  &  0.58  &  2.14 \cr 
##  14   &  \bf{ 0.57}  &   0.04  &  -0.01  &  -0.29  &  \bf{ 0.42}  &  0.55  &  0.45  &  2.41 \cr 
##  15   &   0.21  &   0.24  &   0.05  &  -0.02  &  \bf{ 0.43}  &  0.40  &  0.60  &  2.14 \cr 
##  16   &   0.22  &  -0.25  &   0.02  &  \bf{ 0.40}  &  \bf{ 0.31}  &  0.27  &  0.73  &  3.31 \cr 
##  17   &  -0.22  &   0.25  &  -0.05  &   0.29  &  \bf{ 0.41}  &  0.59  &  0.41  &  3.25 \cr 
##  18   &  -0.12  &   0.20  &   0.00  &  \bf{ 0.31}  &  \bf{ 0.54}  &  0.70  &  0.30  &  2.04 \cr 
##  19   &   0.26  &  \bf{ 0.63}  &   0.07  &  -0.15  &   0.04  &  0.62  &  0.38  &  1.50 \cr 
##  20   &   0.06  &  \bf{ 0.75}  &   0.10  &   0.00  &   0.01  &  0.61  &  0.39  &  1.05 \cr 
##  21   &   0.28  &  \bf{ 0.66}  &   0.02  &  -0.05  &  -0.12  &  0.62  &  0.38  &  1.44 \cr 
##  22   &  -0.05  &  \bf{ 0.41}  &  -0.14  &   0.24  &   0.17  &  0.44  &  0.56  &  2.32 \cr 
##  23   &  -0.04  &  \bf{ 0.89}  &   0.05  &  -0.11  &  -0.08  &  0.68  &  0.32  &  1.06 \cr 
##  24   &   0.30  &  \bf{-0.49}  &   0.07  &  \bf{-0.31}  &  -0.23  &  0.65  &  0.35  &  3.00 \cr 
##  25   &  -0.06  &  \bf{ 0.39}  &  -0.17  &   0.17  &   0.30  &  0.49  &  0.51  &  2.82 \cr 
##  26   &   0.02  &  -0.10  &  \bf{ 0.80}  &   0.01  &   0.05  &  0.65  &  0.35  &  1.04 \cr 
##  27   &   0.09  &   0.02  &  \bf{ 0.74}  &  -0.03  &   0.05  &  0.57  &  0.43  &  1.05 \cr 
##  28   &  -0.06  &   0.16  &  \bf{ 0.73}  &   0.06  &  -0.08  &  0.54  &  0.46  &  1.15 \cr 
##  29   &   0.07  &   0.02  &  \bf{ 0.74}  &   0.06  &   0.05  &  0.55  &  0.45  &  1.04 \cr 
##  30   &  -0.11  &  -0.05  &  \bf{ 0.82}  &  -0.01  &   0.03  &  0.67  &  0.33  &  1.05 \cr 
## \hline \cr SS loadings & 5.47 &  3.78 &  3.1 &  2.08 &  2.04 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.42 &  0.12 & -0.17 & -0.02 \cr 
##  MR4   &  0.42 &  1.00 & -0.03 &  0.28 &  0.40 \cr 
##  MR5   &  0.12 & -0.03 &  1.00 & -0.18 & -0.15 \cr 
##  MR1   & -0.17 &  0.28 & -0.18 &  1.00 &  0.42 \cr 
##  MR3   & -0.02 &  0.40 & -0.15 &  0.42 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on theory 5 Factor Based in Theory (results) but moving 17 (LET_3) to 1 and 19 (LET_1) to 4 where they load better

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys, 
#Factor 1 Present Focused:
PWB_1, PWB_2, PWB_4, 
#Factor 2 Understanding Self and Life, Making Plans:
APSI_2,  APSI_4,  PWB_8, APSI_7, APSI_8,  PWB_7,  APSI_5,  APSI_1, APSI_5, APSI_6,
#Factor 3 Meaningful activities:
LET_4,  LET_2,  LET_6,  
#Factor 4 Meaningful activities Negative
PWB_9, LET_3, PWB_3, PWB_5,
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, APSI_6,LET_1,
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_2  <-  7- purposescales$PWB_2
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 30]
## 
##    PWB_1 PWB_2 PWB_4 APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 PWB_7 APSI_5 APSI_1
## 1      4     3     5      4      4     3      4      4     4      4      2
## 2      4     5     5      3      5     2      4      4     3      4      4
## 3      5     6     1      4      3     3      4      3     6      3      3
## 4      2     2     3      4      4     4      4      3     5      5      4
## 5      2     2     4      3      3     3      2      3     2      4      3
## 6      5     4     2      4      4     4      5      3     3      4      3
## 7      2     2     5      2      3     3      2      2     3      4      2
## 8      6     6     6      3      3     4      3      1     4      5      3
## 9      5     5     2      5      4     5      4      5     5      4      4
## 10     6     6     4      2      3     3      3      4     6      5      2
## ..   ...   ...   ...    ...    ...   ...    ...    ...   ...    ...    ...
## Variables not shown: APSI_6 (dbl), LET_4 (dbl), LET_2 (dbl), LET_6 (dbl),
##   PWB_9 (dbl), LET_3 (dbl), PWB_3 (dbl), PWB_5 (dbl), MLQ_4 (dbl), MLQ_5
##   (dbl), MLQ_6 (dbl), MLQ_9 (dbl), MLQ_1 (dbl), LET_1 (dbl), MLQ_2 (dbl),
##   MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  30 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_2 : num  3 5 6 2 2 4 2 6 5 6 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(30,list(f1=1:3,f2=4:11, f3=12:14, f4=15:18,f5=19:25, f6=26:30))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR6    MR5    MR4    MR1    MR3   
## 1                        0.208  0.460 -0.267
## 2                       -0.173  0.903  0.125
## 3  -0.316        -0.182 -0.180 -0.316  0.116
## 4   0.587         0.115                0.211
## 5   0.861                             -0.114
## 6   0.478         0.107                0.102
## 7   0.886                             -0.144
## 8   0.878                                   
## 9   0.392         0.209                0.276
## 10  0.618        -0.146                0.211
## 11  0.661         0.167                0.144
## 12  0.142        -0.395 -0.421 -0.119  0.238
## 13  0.299                0.284         0.408
## 14  0.185         0.141  0.194         0.584
## 15  0.105         0.226  0.426         0.197
## 16               -0.208  0.229  0.450       
## 17 -0.158         0.183  0.555  0.147       
## 18                0.127  0.686  0.167       
## 19                      -0.508 -0.248  0.174
## 20  0.114         0.691                0.173
## 21         0.100  0.725                     
## 22  0.203         0.704 -0.214              
## 23        -0.152  0.326  0.328        -0.172
## 24                0.880                     
## 25        -0.178  0.345  0.375  0.108       
## 26         0.814                            
## 27         0.737                            
## 28         0.730  0.154               -0.106
## 29         0.740                            
## 30         0.826         0.105              
## 
##                  MR2   MR6   MR5   MR4   MR1   MR3
## SS loadings    4.232 3.085 3.022 2.033 1.518 1.078
## Proportion Var 0.141 0.103 0.101 0.068 0.051 0.036
## Cumulative Var 0.141 0.244 0.345 0.412 0.463 0.499
## 
## $score.cor
##            [,1]        [,2]      [,3]        [,4]        [,5]       [,6]
## [1,] 1.00000000  0.11347753 0.6164897  0.03540792  0.13256973 0.62061798
## [2,] 0.11347753  1.00000000 0.1001286 -0.18655392 -0.13248180 0.07270612
## [3,] 0.61648968  0.10012856 1.0000000  0.44663479  0.27300045 0.49033112
## [4,] 0.03540792 -0.18655392 0.4466348  1.00000000  0.60711152 0.08170085
## [5,] 0.13256973 -0.13248180 0.2730005  0.60711152  1.00000000 0.08881474
## [6,] 0.62061798  0.07270612 0.4903311  0.08170085  0.08881474 1.00000000
## 
## $TLI
## [1] 0.945109
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04489006 0.04123371 0.04772054 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 6, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR6   MR5   MR4   MR1   MR3   h2   u2 com
## 1  -0.01 -0.01 -0.04  0.21  0.46 -0.27 0.47 0.53 2.1
## 2  -0.07 -0.02  0.05 -0.17  0.90  0.12 0.69 0.31 1.1
## 3  -0.32  0.08 -0.18 -0.18 -0.32  0.12 0.46 0.54 3.6
## 4   0.59 -0.07  0.12  0.03 -0.04  0.21 0.60 0.40 1.4
## 5   0.86 -0.04  0.05 -0.06 -0.04 -0.11 0.69 0.31 1.1
## 6   0.48 -0.04  0.11  0.08  0.04  0.10 0.38 0.62 1.3
## 7   0.89  0.10 -0.06 -0.03  0.04 -0.14 0.65 0.35 1.1
## 8   0.88  0.00 -0.01 -0.09  0.03 -0.10 0.69 0.31 1.0
## 9   0.39  0.05  0.21  0.03  0.08  0.28 0.52 0.48 2.6
## 10  0.62  0.06 -0.15  0.07  0.00  0.21 0.49 0.51 1.4
## 11  0.66 -0.05  0.17 -0.07 -0.03  0.14 0.70 0.30 1.3
## 12  0.14  0.07 -0.39 -0.42 -0.12  0.24 0.66 0.34 3.1
## 13  0.30  0.01  0.01  0.28 -0.09  0.41 0.42 0.58 2.8
## 14  0.18 -0.01  0.14  0.19  0.00  0.58 0.58 0.42 1.6
## 15  0.11  0.04  0.23  0.43  0.01  0.20 0.40 0.60 2.2
## 16  0.10  0.03 -0.21  0.23  0.45  0.07 0.29 0.71 2.2
## 17 -0.16 -0.06  0.18  0.56  0.15 -0.09 0.60 0.40 1.6
## 18 -0.10  0.00  0.13  0.69  0.17 -0.02 0.71 0.29 1.2
## 19 -0.05 -0.02 -0.10 -0.51 -0.25  0.17 0.57 0.43 1.8
## 20  0.11  0.07  0.69 -0.09  0.03  0.17 0.63 0.37 1.2
## 21  0.07  0.10  0.73  0.03  0.02 -0.04 0.61 0.39 1.1
## 22  0.20  0.02  0.70 -0.21  0.07  0.04 0.65 0.35 1.4
## 23  0.07 -0.15  0.33  0.33  0.07 -0.17 0.45 0.55 3.1
## 24 -0.01  0.05  0.88 -0.08 -0.05 -0.05 0.68 0.32 1.0
## 25 -0.05 -0.18  0.35  0.37  0.11 -0.02 0.49 0.51 2.7
## 26 -0.05  0.81 -0.05  0.00  0.08  0.07 0.66 0.34 1.0
## 27  0.04  0.74  0.05  0.03  0.00  0.07 0.57 0.43 1.0
## 28 -0.01  0.73  0.15 -0.04  0.00 -0.11 0.54 0.46 1.1
## 29  0.08  0.74  0.02  0.09  0.01 -0.02 0.55 0.45 1.1
## 30 -0.06  0.83 -0.06  0.10 -0.09 -0.05 0.69 0.31 1.1
## 
##                        MR2  MR6  MR5  MR4  MR1  MR3
## SS loadings           4.74 3.11 3.53 2.48 1.85 1.37
## Proportion Var        0.16 0.10 0.12 0.08 0.06 0.05
## Cumulative Var        0.16 0.26 0.38 0.46 0.52 0.57
## Proportion Explained  0.28 0.18 0.21 0.15 0.11 0.08
## Cumulative Proportion 0.28 0.46 0.67 0.81 0.92 1.00
## 
##  With factor correlations of 
##      MR2   MR6   MR5   MR4   MR1   MR3
## MR2 1.00  0.11  0.53  0.02  0.08  0.54
## MR6 0.11  1.00 -0.03 -0.17 -0.17  0.13
## MR5 0.53 -0.03  1.00  0.43  0.26  0.14
## MR4 0.02 -0.17  0.43  1.00  0.49 -0.19
## MR1 0.08 -0.17  0.26  0.49  1.00 -0.14
## MR3 0.54  0.13  0.14 -0.19 -0.14  1.00
## 
## Mean item complexity =  1.7
## Test of the hypothesis that 6 factors are sufficient.
## 
## The degrees of freedom for the null model are  435  and the objective function was  16.26 with Chi Square of  18670.29
## The degrees of freedom for the model are 270  and the objective function was  0.78 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  1160 with the empirical chi square  389.45  with prob <  2.6e-06 
## The total number of observations was  1160  with MLE Chi Square =  889.06  with prob <  4.1e-67 
## 
## Tucker Lewis Index of factoring reliability =  0.945
## RMSEA index =  0.045  and the 90 % confidence intervals are  0.041 0.048
## BIC =  -1016.1
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR2  MR6  MR5  MR4  MR1
## Correlation of scores with factors             0.96 0.94 0.95 0.92 0.90
## Multiple R square of scores with factors       0.93 0.89 0.90 0.85 0.81
## Minimum correlation of possible factor scores  0.85 0.78 0.80 0.70 0.62
##                                                 MR3
## Correlation of scores with factors             0.86
## Multiple R square of scores with factors       0.75
## Minimum correlation of possible factor scores  0.49
fa2latex(fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 6, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r }
##  \multicolumn{ 9 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR6  &  MR5  &  MR4  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.01  &  -0.01  &  -0.04  &   0.21  &  \bf{ 0.46}  &  -0.27  &  0.47  &  0.53  &  2.07 \cr 
##  2   &  -0.07  &  -0.02  &   0.05  &  -0.17  &  \bf{ 0.90}  &   0.12  &  0.69  &  0.31  &  1.13 \cr 
##  3   &  \bf{-0.32}  &   0.08  &  -0.18  &  -0.18  &  \bf{-0.32}  &   0.12  &  0.46  &  0.54  &  3.64 \cr 
##  4   &  \bf{ 0.59}  &  -0.07  &   0.12  &   0.03  &  -0.04  &   0.21  &  0.60  &  0.40  &  1.39 \cr 
##  5   &  \bf{ 0.86}  &  -0.04  &   0.05  &  -0.06  &  -0.04  &  -0.11  &  0.69  &  0.31  &  1.06 \cr 
##  6   &  \bf{ 0.48}  &  -0.04  &   0.11  &   0.08  &   0.04  &   0.10  &  0.38  &  0.62  &  1.28 \cr 
##  7   &  \bf{ 0.89}  &   0.10  &  -0.06  &  -0.03  &   0.04  &  -0.14  &  0.65  &  0.35  &  1.10 \cr 
##  8   &  \bf{ 0.88}  &   0.00  &  -0.01  &  -0.09  &   0.03  &  -0.10  &  0.69  &  0.31  &  1.05 \cr 
##  9   &  \bf{ 0.39}  &   0.05  &   0.21  &   0.03  &   0.08  &   0.28  &  0.52  &  0.48  &  2.55 \cr 
##  10   &  \bf{ 0.62}  &   0.06  &  -0.15  &   0.07  &   0.00  &   0.21  &  0.49  &  0.51  &  1.41 \cr 
##  11   &  \bf{ 0.66}  &  -0.05  &   0.17  &  -0.07  &  -0.03  &   0.14  &  0.70  &  0.30  &  1.27 \cr 
##  12   &   0.14  &   0.07  &  \bf{-0.39}  &  \bf{-0.42}  &  -0.12  &   0.24  &  0.66  &  0.34  &  3.10 \cr 
##  13   &   0.30  &   0.01  &   0.01  &   0.28  &  -0.09  &  \bf{ 0.41}  &  0.42  &  0.58  &  2.81 \cr 
##  14   &   0.18  &  -0.01  &   0.14  &   0.19  &   0.00  &  \bf{ 0.58}  &  0.58  &  0.42  &  1.57 \cr 
##  15   &   0.11  &   0.04  &   0.23  &  \bf{ 0.43}  &   0.01  &   0.20  &  0.40  &  0.60  &  2.18 \cr 
##  16   &   0.10  &   0.03  &  -0.21  &   0.23  &  \bf{ 0.45}  &   0.07  &  0.29  &  0.71  &  2.15 \cr 
##  17   &  -0.16  &  -0.06  &   0.18  &  \bf{ 0.56}  &   0.15  &  -0.09  &  0.60  &  0.40  &  1.65 \cr 
##  18   &  -0.10  &   0.00  &   0.13  &  \bf{ 0.69}  &   0.17  &  -0.02  &  0.71  &  0.29  &  1.24 \cr 
##  19   &  -0.05  &  -0.02  &  -0.10  &  \bf{-0.51}  &  -0.25  &   0.17  &  0.57  &  0.43  &  1.83 \cr 
##  20   &   0.11  &   0.07  &  \bf{ 0.69}  &  -0.09  &   0.03  &   0.17  &  0.63  &  0.37  &  1.24 \cr 
##  21   &   0.07  &   0.10  &  \bf{ 0.73}  &   0.03  &   0.02  &  -0.04  &  0.61  &  0.39  &  1.07 \cr 
##  22   &   0.20  &   0.02  &  \bf{ 0.70}  &  -0.21  &   0.07  &   0.04  &  0.65  &  0.35  &  1.40 \cr 
##  23   &   0.07  &  -0.15  &  \bf{ 0.33}  &  \bf{ 0.33}  &   0.07  &  -0.17  &  0.45  &  0.55  &  3.13 \cr 
##  24   &  -0.01  &   0.05  &  \bf{ 0.88}  &  -0.08  &  -0.05  &  -0.05  &  0.68  &  0.32  &  1.04 \cr 
##  25   &  -0.05  &  -0.18  &  \bf{ 0.35}  &  \bf{ 0.37}  &   0.11  &  -0.02  &  0.49  &  0.51  &  2.67 \cr 
##  26   &  -0.05  &  \bf{ 0.81}  &  -0.05  &   0.00  &   0.08  &   0.07  &  0.66  &  0.34  &  1.05 \cr 
##  27   &   0.04  &  \bf{ 0.74}  &   0.05  &   0.03  &   0.00  &   0.07  &  0.57  &  0.43  &  1.04 \cr 
##  28   &  -0.01  &  \bf{ 0.73}  &   0.15  &  -0.04  &   0.00  &  -0.11  &  0.54  &  0.46  &  1.14 \cr 
##  29   &   0.08  &  \bf{ 0.74}  &   0.02  &   0.09  &   0.01  &  -0.02  &  0.55  &  0.45  &  1.06 \cr 
##  30   &  -0.06  &  \bf{ 0.83}  &  -0.06  &   0.10  &  -0.09  &  -0.05  &  0.69  &  0.31  &  1.09 \cr 
## \hline \cr SS loadings & 4.74 &  3.11 &  3.53 &  2.48 &  1.85 &  1.37 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.11 &  0.53 &  0.02 &  0.08 &  0.54 \cr 
##  MR6   &  0.11 &  1.00 & -0.03 & -0.17 & -0.17 &  0.13 \cr 
##  MR5   &  0.53 & -0.03 &  1.00 &  0.43 &  0.26 &  0.14 \cr 
##  MR4   &  0.02 & -0.17 &  0.43 &  1.00 &  0.49 & -0.19 \cr 
##  MR1   &  0.08 & -0.17 &  0.26 &  0.49 &  1.00 & -0.14 \cr 
##  MR3   &  0.54 &  0.13 &  0.14 & -0.19 & -0.14 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based taking out all questions that siqnificantly crossload PWB_1, PWB_4, PWB_7, LET_4, LET_6, LET_3, MLQ_9, LET_5

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,  
#Factor 1:
APSI_2, APSI_4,  PWB_8, APSI_7, APSI_8,  APSI_5,  APSI_1, LET_2,
#Factor2:
PWB_2, PWB_9, PWB_3, PWB_5, LET_1, APSI_6,
#Factor3
MLQ_4, MLQ_5, MLQ_6, MLQ_1, 
#Factor 4
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 23]
## 
##    APSI_2 APSI_4 PWB_8 APSI_7 APSI_8 APSI_5 APSI_1 LET_2 PWB_2 PWB_9 PWB_3
## 1       4      4     3      4      4      4      2     4     4     6     5
## 2       3      5     2      4      4      4      4     3     2     5     5
## 3       4      3     3      4      3      3      3     4     1     6     5
## 4       4      4     4      4      3      5      4     4     5     4     4
## 5       3      3     3      2      3      4      3     2     5     4     3
## 6       4      4     4      5      3      4      3     5     3     6     6
## 7       2      3     3      2      2      4      2     4     5     3     5
## 8       3      3     4      3      1      5      3     4     1     6     5
## 9       5      4     5      4      5      4      4     4     2     6     5
## 10      2      3     3      3      4      5      2     3     1     6     3
## ..    ...    ...   ...    ...    ...    ...    ...   ...   ...   ...   ...
## Variables not shown: PWB_5 (dbl), LET_1 (dbl), APSI_6 (dbl), MLQ_4 (dbl),
##   MLQ_5 (dbl), MLQ_6 (dbl), MLQ_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7
##   (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  23 variables:
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_5 : num  4 2 1 3 4 3 1 2 1 2 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(23,list(f1=1:8,f2=9:14, f3=15:18, f4=19:23))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR1    MR4    MR2    MR3   
## 1   0.716                0.120
## 2   0.745                0.126
## 3   0.546         0.127       
## 4   0.742                     
## 5   0.773                     
## 6   0.748               -0.135
## 7   0.756                0.173
## 8   0.535                0.102
## 9  -0.174        -0.516  0.163
## 10  0.232         0.559 -0.356
## 11                0.804       
## 12               -0.774       
## 13        -0.152  0.541  0.218
## 14  0.251        -0.644 -0.288
## 15  0.295                0.569
## 16                0.173  0.653
## 17  0.300                0.606
## 18                       0.832
## 19         0.802              
## 20         0.730              
## 21         0.714         0.152
## 22         0.739              
## 23 -0.129  0.815              
## 
##                  MR1   MR4   MR2   MR3
## SS loadings    4.304 2.966 2.603 2.224
## Proportion Var 0.187 0.129 0.113 0.097
## Cumulative Var 0.187 0.316 0.429 0.526
## 
## $score.cor
##            [,1]       [,2]        [,3]      [,4]
## [1,] 1.00000000  0.1068236  0.06369279 0.6044766
## [2,] 0.10682363  1.0000000 -0.16689627 0.1083969
## [3,] 0.06369279 -0.1668963  1.00000000 0.3392522
## [4,] 0.60447660  0.1083969  0.33925221 1.0000000
## 
## $TLI
## [1] 0.9469382
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04972782 0.04536105 0.05346715 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR1   MR4   MR2   MR3   h2   u2 com
## 1   0.72 -0.07 -0.02  0.12 0.60 0.40 1.1
## 2   0.74 -0.04 -0.04  0.13 0.65 0.35 1.1
## 3   0.55 -0.03  0.13  0.08 0.37 0.63 1.2
## 4   0.74  0.10  0.02  0.01 0.59 0.41 1.0
## 5   0.77  0.00 -0.04  0.06 0.65 0.35 1.0
## 6   0.75  0.08  0.00 -0.14 0.50 0.50 1.1
## 7   0.76 -0.05 -0.09  0.17 0.71 0.29 1.1
## 8   0.53  0.01  0.06  0.10 0.36 0.64 1.1
## 9  -0.17  0.04 -0.52  0.16 0.25 0.75 1.5
## 10  0.23  0.05  0.56 -0.36 0.27 0.73 2.1
## 11 -0.09  0.03  0.80  0.03 0.66 0.34 1.0
## 12  0.02 -0.05 -0.77  0.01 0.58 0.42 1.0
## 13  0.00 -0.15  0.54  0.22 0.48 0.52 1.5
## 14  0.25  0.05 -0.64 -0.29 0.64 0.36 1.7
## 15  0.30  0.06  0.04  0.57 0.60 0.40 1.5
## 16  0.08  0.09  0.17  0.65 0.61 0.39 1.2
## 17  0.30  0.00 -0.01  0.61 0.62 0.38 1.5
## 18 -0.02  0.02  0.04  0.83 0.71 0.29 1.0
## 19  0.01  0.80 -0.02 -0.06 0.65 0.35 1.0
## 20  0.09  0.73 -0.02  0.04 0.57 0.43 1.0
## 21 -0.07  0.71 -0.03  0.15 0.53 0.47 1.1
## 22  0.07  0.74  0.06  0.01 0.55 0.45 1.0
## 23 -0.13  0.82 -0.04 -0.01 0.67 0.33 1.1
## 
##                        MR1  MR4  MR2  MR3
## SS loadings           4.57 2.98 2.68 2.57
## Proportion Var        0.20 0.13 0.12 0.11
## Cumulative Var        0.20 0.33 0.45 0.56
## Proportion Explained  0.36 0.23 0.21 0.20
## Cumulative Proportion 0.36 0.59 0.80 1.00
## 
##  With factor correlations of 
##      MR1   MR4   MR2  MR3
## MR1 1.00  0.11  0.03 0.47
## MR4 0.11  1.00 -0.18 0.04
## MR2 0.03 -0.18  1.00 0.37
## MR3 0.47  0.04  0.37 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  11.97 with Chi Square of  13772.67
## The degrees of freedom for the model are 167  and the objective function was  0.56 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  305.7  with prob <  3.3e-10 
## The total number of observations was  1160  with MLE Chi Square =  639.41  with prob <  1.9e-56 
## 
## Tucker Lewis Index of factoring reliability =  0.947
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.045 0.053
## BIC =  -538.97
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR1  MR4  MR2  MR3
## Correlation of scores with factors             0.96 0.94 0.93 0.93
## Multiple R square of scores with factors       0.92 0.88 0.86 0.87
## Minimum correlation of possible factor scores  0.83 0.77 0.72 0.73
fa2latex(fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 4, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR1  &  MR4  &  MR2  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  \bf{ 0.72}  &  -0.07  &  -0.02  &   0.12  &  0.60  &  0.40  &  1.08 \cr 
##  2   &  \bf{ 0.74}  &  -0.04  &  -0.04  &   0.13  &  0.65  &  0.35  &  1.07 \cr 
##  3   &  \bf{ 0.55}  &  -0.03  &   0.13  &   0.08  &  0.37  &  0.63  &  1.16 \cr 
##  4   &  \bf{ 0.74}  &   0.10  &   0.02  &   0.01  &  0.59  &  0.41  &  1.04 \cr 
##  5   &  \bf{ 0.77}  &   0.00  &  -0.04  &   0.06  &  0.65  &  0.35  &  1.02 \cr 
##  6   &  \bf{ 0.75}  &   0.08  &   0.00  &  -0.14  &  0.50  &  0.50  &  1.09 \cr 
##  7   &  \bf{ 0.76}  &  -0.05  &  -0.09  &   0.17  &  0.71  &  0.29  &  1.14 \cr 
##  8   &  \bf{ 0.53}  &   0.01  &   0.06  &   0.10  &  0.36  &  0.64  &  1.10 \cr 
##  9   &  -0.17  &   0.04  &  \bf{-0.52}  &   0.16  &  0.25  &  0.75  &  1.45 \cr 
##  10   &   0.23  &   0.05  &  \bf{ 0.56}  &  \bf{-0.36}  &  0.27  &  0.73  &  2.11 \cr 
##  11   &  -0.09  &   0.03  &  \bf{ 0.80}  &   0.03  &  0.66  &  0.34  &  1.03 \cr 
##  12   &   0.02  &  -0.05  &  \bf{-0.77}  &   0.01  &  0.58  &  0.42  &  1.01 \cr 
##  13   &   0.00  &  -0.15  &  \bf{ 0.54}  &   0.22  &  0.48  &  0.52  &  1.49 \cr 
##  14   &   0.25  &   0.05  &  \bf{-0.64}  &  -0.29  &  0.64  &  0.36  &  1.73 \cr 
##  15   &   0.30  &   0.06  &   0.04  &  \bf{ 0.57}  &  0.60  &  0.40  &  1.54 \cr 
##  16   &   0.08  &   0.09  &   0.17  &  \bf{ 0.65}  &  0.61  &  0.39  &  1.21 \cr 
##  17   &   0.30  &   0.00  &  -0.01  &  \bf{ 0.61}  &  0.62  &  0.38  &  1.46 \cr 
##  18   &  -0.02  &   0.02  &   0.04  &  \bf{ 0.83}  &  0.71  &  0.29  &  1.01 \cr 
##  19   &   0.01  &  \bf{ 0.80}  &  -0.02  &  -0.06  &  0.65  &  0.35  &  1.01 \cr 
##  20   &   0.09  &  \bf{ 0.73}  &  -0.02  &   0.04  &  0.57  &  0.43  &  1.04 \cr 
##  21   &  -0.07  &  \bf{ 0.71}  &  -0.03  &   0.15  &  0.53  &  0.47  &  1.11 \cr 
##  22   &   0.07  &  \bf{ 0.74}  &   0.06  &   0.01  &  0.55  &  0.45  &  1.03 \cr 
##  23   &  -0.13  &  \bf{ 0.82}  &  -0.04  &  -0.01  &  0.67  &  0.33  &  1.06 \cr 
## \hline \cr SS loadings & 4.57 &  2.98 &  2.68 &  2.57 &  \cr  
## \cr 
##             \hline \cr 
## MR1   &  1.00 &  0.11 &  0.03 &  0.47 \cr 
##  MR4   &  0.11 &  1.00 & -0.18 &  0.04 \cr 
##  MR2   &  0.03 & -0.18 &  1.00 &  0.37 \cr 
##  MR3   &  0.47 &  0.04 &  0.37 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on EFA of individual intruments

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Plans:
PWB_1, PWB_3, PWB_5, PWB_6, 
#Factor 2 Understanding Self and Life, Making Plans:
APSI_1,  APSI_2,  APSI_4, APSI_5, APSI_7,  APSI_8,
#Factor 3 Meaningful activities:
LET_1,  LET_3,  LET_5,  
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, 
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_5  <-  7- purposescales$PWB_5
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 23]
## 
##    PWB_1 PWB_3 PWB_5 PWB_6 APSI_1 APSI_2 APSI_4 APSI_5 APSI_7 APSI_8 LET_1
## 1      4     5     3     5      2      4      4      4      4      4     4
## 2      4     5     5     5      4      3      5      4      4      4     3
## 3      5     5     6     4      3      4      3      3      4      3     3
## 4      2     4     4     4      4      4      4      5      4      3     1
## 5      2     3     3     3      3      3      3      4      2      3     3
## 6      5     6     4     4      3      4      4      4      5      3     5
## 7      2     5     6     4      2      2      3      4      2      2     3
## 8      6     5     5     4      3      3      3      5      3      1     3
## 9      5     5     6     5      4      5      4      4      4      5     5
## 10     6     3     5     6      2      2      3      5      3      4     3
## ..   ...   ...   ...   ...    ...    ...    ...    ...    ...    ...   ...
## Variables not shown: LET_3 (dbl), LET_5 (dbl), MLQ_4 (dbl), MLQ_5 (dbl),
##   MLQ_6 (dbl), MLQ_9 (dbl), MLQ_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7
##   (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  23 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_5 : num  3 5 6 4 3 4 6 5 6 5 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(23,list(f1=1:4,f2=5:10, f3=11:13, f4=14:18,f5=19:23))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR5    MR4    MR1    MR3   
## 1                        0.615       
## 2                        0.407  0.509
## 3                        0.568  0.259
## 4          0.111  0.184  0.563       
## 5   0.735         0.160 -0.162       
## 6   0.709               -0.180  0.181
## 7   0.787                0.134 -0.145
## 8   0.765        -0.165 -0.118  0.181
## 9   0.826                0.298 -0.218
## 10  0.806                0.129 -0.128
## 11        -0.159  0.251  0.167  0.447
## 12                       0.327  0.582
## 13 -0.175         0.103  0.402  0.436
## 14  0.160         0.690 -0.152       
## 15                0.742  0.114       
## 16  0.181         0.701              
## 17        -0.147  0.266  0.191  0.354
## 18 -0.124         0.913              
## 19         0.812                     
## 20         0.742                     
## 21         0.706  0.162  0.107 -0.121
## 22         0.739                     
## 23         0.823                     
## 
##                  MR2   MR5   MR4   MR1   MR3
## SS loadings    3.733 3.026 2.654 1.774 1.376
## Proportion Var 0.162 0.132 0.115 0.077 0.060
## Cumulative Var 0.162 0.294 0.409 0.486 0.546
## 
## $score.cor
##             [,1]       [,2]      [,3]        [,4]       [,5]
## [1,]  1.00000000  0.1187769 0.5791661 -0.00269043 -0.0296822
## [2,]  0.11877694  1.0000000 0.1083203 -0.04870210 -0.1858455
## [3,]  0.57916609  0.1083203 1.0000000  0.28115501  0.3595210
## [4,] -0.00269043 -0.0487021 0.2811550  1.00000000  0.6771676
## [5,] -0.02968220 -0.1858455 0.3595210  0.67716764  1.0000000
## 
## $TLI
## [1] 0.9700588
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.03871062 0.03389355 0.04292026 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR5   MR4   MR1   MR3   h2   u2 com
## 1  -0.03 -0.08 -0.10  0.61  0.07 0.42 0.58 1.1
## 2   0.00  0.00  0.05  0.41  0.51 0.66 0.34 1.9
## 3   0.06 -0.02  0.04  0.57  0.26 0.55 0.45 1.4
## 4   0.09  0.11  0.18  0.56  0.03 0.45 0.55 1.4
## 5   0.74 -0.03  0.16 -0.16  0.08 0.73 0.27 1.2
## 6   0.71 -0.04  0.10 -0.18  0.18 0.63 0.37 1.3
## 7   0.79 -0.06  0.08  0.13 -0.14 0.69 0.31 1.2
## 8   0.77  0.10 -0.17 -0.12  0.18 0.51 0.49 1.3
## 9   0.83  0.06 -0.06  0.30 -0.22 0.68 0.32 1.4
## 10  0.81 -0.02  0.02  0.13 -0.13 0.67 0.33 1.1
## 11  0.02 -0.16  0.25  0.17  0.45 0.52 0.48 2.2
## 12 -0.08 -0.03  0.05  0.33  0.58 0.68 0.32 1.6
## 13 -0.18  0.01  0.10  0.40  0.44 0.62 0.38 2.4
## 14  0.16  0.06  0.69 -0.15  0.08 0.63 0.37 1.2
## 15  0.00  0.06  0.74  0.11 -0.01 0.62 0.38 1.1
## 16  0.18  0.00  0.70 -0.08 -0.03 0.64 0.36 1.2
## 17  0.03 -0.15  0.27  0.19  0.35 0.44 0.56 2.9
## 18 -0.12  0.01  0.91  0.01 -0.07 0.69 0.31 1.1
## 19  0.01  0.81 -0.07 -0.03  0.03 0.65 0.35 1.0
## 20  0.08  0.74  0.04 -0.07  0.06 0.57 0.43 1.1
## 21 -0.08  0.71  0.16  0.11 -0.12 0.55 0.45 1.2
## 22  0.08  0.74  0.01  0.04  0.06 0.55 0.45 1.0
## 23 -0.09  0.82 -0.05  0.01  0.00 0.67 0.33 1.0
## 
##                        MR2  MR5  MR4  MR1  MR3
## SS loadings           3.86 3.05 2.91 2.17 1.84
## Proportion Var        0.17 0.13 0.13 0.09 0.08
## Cumulative Var        0.17 0.30 0.43 0.52 0.60
## Proportion Explained  0.28 0.22 0.21 0.16 0.13
## Cumulative Proportion 0.28 0.50 0.71 0.87 1.00
## 
##  With factor correlations of 
##       MR2   MR5  MR4   MR1   MR3
## MR2  1.00  0.12 0.57 -0.13 -0.08
## MR5  0.12  1.00 0.04 -0.08 -0.20
## MR4  0.57  0.04 1.00  0.30  0.31
## MR1 -0.13 -0.08 0.30  1.00  0.49
## MR3 -0.08 -0.20 0.31  0.49  1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  253  and the objective function was  12.81 with Chi Square of  14735.17
## The degrees of freedom for the model are 148  and the objective function was  0.35 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  1160 with the empirical chi square  135.96  with prob <  0.75 
## The total number of observations was  1160  with MLE Chi Square =  400.91  with prob <  3.4e-25 
## 
## Tucker Lewis Index of factoring reliability =  0.97
## RMSEA index =  0.039  and the 90 % confidence intervals are  0.034 0.043
## BIC =  -643.41
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR2  MR5  MR4  MR1  MR3
## Correlation of scores with factors             0.96 0.94 0.95 0.90 0.89
## Multiple R square of scores with factors       0.92 0.89 0.89 0.81 0.79
## Minimum correlation of possible factor scores  0.84 0.77 0.79 0.61 0.58
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR5  &  MR4  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.03  &  -0.08  &  -0.10  &  \bf{ 0.61}  &   0.07  &  0.42  &  0.58  &  1.12 \cr 
##  2   &   0.00  &   0.00  &   0.05  &  \bf{ 0.41}  &  \bf{ 0.51}  &  0.66  &  0.34  &  1.93 \cr 
##  3   &   0.06  &  -0.02  &   0.04  &  \bf{ 0.57}  &   0.26  &  0.55  &  0.45  &  1.44 \cr 
##  4   &   0.09  &   0.11  &   0.18  &  \bf{ 0.56}  &   0.03  &  0.45  &  0.55  &  1.36 \cr 
##  5   &  \bf{ 0.74}  &  -0.03  &   0.16  &  -0.16  &   0.08  &  0.73  &  0.27  &  1.22 \cr 
##  6   &  \bf{ 0.71}  &  -0.04  &   0.10  &  -0.18  &   0.18  &  0.63  &  0.37  &  1.31 \cr 
##  7   &  \bf{ 0.79}  &  -0.06  &   0.08  &   0.13  &  -0.14  &  0.69  &  0.31  &  1.16 \cr 
##  8   &  \bf{ 0.77}  &   0.10  &  -0.17  &  -0.12  &   0.18  &  0.51  &  0.49  &  1.30 \cr 
##  9   &  \bf{ 0.83}  &   0.06  &  -0.06  &   0.30  &  -0.22  &  0.68  &  0.32  &  1.43 \cr 
##  10   &  \bf{ 0.81}  &  -0.02  &   0.02  &   0.13  &  -0.13  &  0.67  &  0.33  &  1.10 \cr 
##  11   &   0.02  &  -0.16  &   0.25  &   0.17  &  \bf{ 0.45}  &  0.52  &  0.48  &  2.21 \cr 
##  12   &  -0.08  &  -0.03  &   0.05  &  \bf{ 0.33}  &  \bf{ 0.58}  &  0.68  &  0.32  &  1.64 \cr 
##  13   &  -0.18  &   0.01  &   0.10  &  \bf{ 0.40}  &  \bf{ 0.44}  &  0.62  &  0.38  &  2.44 \cr 
##  14   &   0.16  &   0.06  &  \bf{ 0.69}  &  -0.15  &   0.08  &  0.63  &  0.37  &  1.25 \cr 
##  15   &   0.00  &   0.06  &  \bf{ 0.74}  &   0.11  &  -0.01  &  0.62  &  0.38  &  1.06 \cr 
##  16   &   0.18  &   0.00  &  \bf{ 0.70}  &  -0.08  &  -0.03  &  0.64  &  0.36  &  1.17 \cr 
##  17   &   0.03  &  -0.15  &   0.27  &   0.19  &  \bf{ 0.35}  &  0.44  &  0.56  &  2.90 \cr 
##  18   &  -0.12  &   0.01  &  \bf{ 0.91}  &   0.01  &  -0.07  &  0.69  &  0.31  &  1.05 \cr 
##  19   &   0.01  &  \bf{ 0.81}  &  -0.07  &  -0.03  &   0.03  &  0.65  &  0.35  &  1.02 \cr 
##  20   &   0.08  &  \bf{ 0.74}  &   0.04  &  -0.07  &   0.06  &  0.57  &  0.43  &  1.06 \cr 
##  21   &  -0.08  &  \bf{ 0.71}  &   0.16  &   0.11  &  -0.12  &  0.55  &  0.45  &  1.24 \cr 
##  22   &   0.08  &  \bf{ 0.74}  &   0.01  &   0.04  &   0.06  &  0.55  &  0.45  &  1.05 \cr 
##  23   &  -0.09  &  \bf{ 0.82}  &  -0.05  &   0.01  &   0.00  &  0.67  &  0.33  &  1.03 \cr 
## \hline \cr SS loadings & 3.86 &  3.05 &  2.91 &  2.17 &  1.84 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.12 &  0.57 & -0.13 & -0.08 \cr 
##  MR5   &  0.12 &  1.00 &  0.04 & -0.08 & -0.20 \cr 
##  MR4   &  0.57 &  0.04 &  1.00 &  0.30 &  0.31 \cr 
##  MR1   & -0.13 & -0.08 &  0.30 &  1.00 &  0.49 \cr 
##  MR3   & -0.08 & -0.20 &  0.31 &  0.49 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

``` # Target rotation based on EFA of words using LDA

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Plans:
PWB_9, APSI_1,  APSI_2,  APSI_4,APSI_8, LET_1, LET_4, LET_6,
#Factor 2 Understanding Self and Life, Making Plans:
PWB_1, PWB_3, PWB_4, PWB_5,  APSI_7, LET_3,   
#Factor 3 Meaningful activities:
PWB_2, PWB_6, LET_2, LET_5, PWB_7, 
#Factor 4 Meaningful activities:
PWB_8, APSI_3, APSI_5, APSI_6, 
#Factor 5 Have Purpose:
MLQ_4, MLQ_5, MLQ_6, MLQ_9, MLQ_1, 
#Factor 6 Searching for meaning
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_5  <-  7- purposescales$PWB_5
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 33]
## 
##    PWB_9 APSI_1 APSI_2 APSI_4 APSI_8 LET_1 LET_4 LET_6 PWB_1 PWB_3 PWB_4
## 1      6      2      4      4      4     4     5     5     4     5     5
## 2      5      4      3      5      4     3     4     5     4     5     5
## 3      6      3      4      3      3     3     4     5     5     5     1
## 4      4      4      4      4      3     1     4     4     2     4     3
## 5      4      3      3      3      3     3     4     4     2     3     4
## 6      6      3      4      4      3     5     5     4     5     6     2
## 7      3      2      2      3      2     3     3     5     2     5     5
## 8      6      3      3      3      1     3     4     5     6     5     6
## 9      6      4      5      4      5     5     5     5     5     5     2
## 10     6      2      2      3      4     3     5     5     6     3     4
## ..   ...    ...    ...    ...    ...   ...   ...   ...   ...   ...   ...
## Variables not shown: PWB_5 (dbl), APSI_7 (dbl), LET_3 (dbl), PWB_2 (dbl),
##   PWB_6 (dbl), LET_2 (dbl), LET_5 (dbl), PWB_7 (dbl), PWB_8 (dbl), APSI_3
##   (dbl), APSI_5 (dbl), APSI_6 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6
##   (dbl), MLQ_9 (dbl), MLQ_1 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl),
##   MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  33 variables:
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ APSI_1: num  2 4 3 4 3 3 2 3 4 2 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ LET_6 : num  5 5 5 4 4 4 5 5 5 5 ...
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_4 : num  5 5 1 3 4 2 5 6 2 4 ...
##  $ PWB_5 : num  3 5 6 4 3 4 6 5 6 5 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_3: num  4 4 4 5 4 4 4 4 5 2 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(33,list(f1=1:8,f2=9:14, f3=15:18, f4=19:22,f5=23:27, f6=28:33))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR6    MR5    MR1    MR4    MR3   
## 1   0.612        -0.162  0.137         0.139
## 2                 0.232  0.507  0.179  0.258
## 3                 0.157  0.393  0.275  0.285
## 4                 0.149  0.636  0.237       
## 5                        0.699  0.166       
## 6   0.432 -0.172  0.384                     
## 7                               0.364  0.379
## 8   0.219         0.163 -0.110  0.484  0.114
## 9   0.564                             -0.331
## 10  0.661         0.166 -0.237  0.163       
## 11 -0.537        -0.284 -0.337  0.148       
## 12  0.605         0.113         0.168 -0.157
## 13         0.108         0.667  0.271       
## 14  0.595         0.202 -0.250              
## 15 -0.587               -0.230  0.168       
## 16  0.271         0.172         0.409 -0.350
## 17                0.148         0.242  0.547
## 18  0.535         0.186 -0.275  0.140 -0.155
## 19                0.184  0.297  0.293  0.221
## 20                0.108  0.334  0.307       
## 21                              0.574 -0.282
## 22               -0.146  0.372  0.425  0.214
## 23 -0.456  0.102 -0.389  0.179         0.208
## 24         0.103  0.658  0.149         0.207
## 25                0.658         0.168       
## 26                0.670  0.290              
## 27  0.378 -0.153  0.375                     
## 28 -0.116         0.802         0.104       
## 29         0.829                            
## 30         0.754                            
## 31         0.738  0.134               -0.126
## 32         0.746                            
## 33         0.813        -0.155              
## 
##                  MR2   MR6   MR5   MR1   MR4   MR3
## SS loadings    3.488 3.164 2.913 2.676 1.748 1.239
## Proportion Var 0.106 0.096 0.088 0.081 0.053 0.038
## Cumulative Var 0.106 0.202 0.290 0.371 0.424 0.461
## 
## $score.cor
##             [,1]        [,2]      [,3]       [,4]      [,5]       [,6]
## [1,]  1.00000000 -0.17978209 0.3591163 0.01322533 0.3977301 0.07642717
## [2,] -0.17978209  1.00000000 0.1083251 0.11661379 0.1015749 0.06331723
## [3,]  0.35911633  0.10832509 1.0000000 0.57767498 0.6302797 0.43439628
## [4,]  0.01322533  0.11661379 0.5776750 1.00000000 0.6142907 0.55081320
## [5,]  0.39773014  0.10157487 0.6302797 0.61429072 1.0000000 0.49585825
## [6,]  0.07642717  0.06331723 0.4343963 0.55081320 0.4958582 1.00000000
## 
## $TLI
## [1] 0.9227126
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05111220 0.04782935 0.05344921 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 6, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR6   MR5   MR1   MR4   MR3   h2   u2 com
## 1   0.61  0.03 -0.16  0.14 -0.09  0.14 0.31 0.69 1.4
## 2  -0.07 -0.01  0.23  0.51  0.18  0.26 0.71 0.29 2.3
## 3  -0.04 -0.04  0.16  0.39  0.27  0.28 0.61 0.39 3.1
## 4  -0.06 -0.02  0.15  0.64  0.24  0.02 0.67 0.33 1.4
## 5   0.00  0.03  0.10  0.70  0.17  0.03 0.69 0.31 1.2
## 6   0.43 -0.17  0.38 -0.09  0.01  0.07 0.51 0.49 2.5
## 7   0.04  0.03  0.02  0.08  0.36  0.38 0.41 0.59 2.1
## 8   0.22  0.01  0.16 -0.11  0.48  0.11 0.45 0.55 1.9
## 9   0.56 -0.06 -0.06  0.07  0.04 -0.33 0.47 0.53 1.7
## 10  0.66 -0.03  0.17 -0.24  0.16  0.02 0.69 0.31 1.5
## 11 -0.54  0.05 -0.28 -0.34  0.15 -0.06 0.52 0.48 2.5
## 12  0.61 -0.02  0.11 -0.05  0.17 -0.16 0.57 0.43 1.4
## 13  0.02  0.11  0.02  0.67  0.27 -0.06 0.65 0.35 1.4
## 14  0.59 -0.08  0.20 -0.25  0.09 -0.05 0.62 0.38 1.7
## 15 -0.59  0.04 -0.01 -0.23  0.17 -0.04 0.34 0.66 1.5
## 16  0.27  0.10  0.17  0.01  0.41 -0.35 0.50 0.50 3.3
## 17  0.06  0.03  0.15  0.07  0.24  0.55 0.56 0.44 1.6
## 18  0.54 -0.03  0.19 -0.28  0.14 -0.15 0.60 0.40 2.2
## 19  0.03  0.07  0.18  0.30  0.29  0.22 0.51 0.49 3.7
## 20  0.07 -0.03  0.11  0.33  0.31  0.09 0.39 0.61 2.5
## 21  0.07  0.03  0.03 -0.01  0.57 -0.28 0.39 0.61 1.5
## 22 -0.01  0.07 -0.15  0.37  0.42  0.21 0.53 0.47 2.8
## 23 -0.46  0.10 -0.39  0.18 -0.08  0.21 0.65 0.35 2.9
## 24 -0.04  0.10  0.66  0.15  0.04  0.21 0.64 0.36 1.4
## 25  0.03  0.10  0.66  0.07  0.17 -0.07 0.61 0.39 1.2
## 26 -0.06  0.06  0.67  0.29 -0.01  0.08 0.64 0.36 1.4
## 27  0.38 -0.15  0.37  0.00  0.02 -0.04 0.44 0.56 2.3
## 28 -0.12  0.05  0.80  0.04  0.10 -0.09 0.69 0.31 1.1
## 29  0.08  0.83 -0.05 -0.04 -0.08  0.05 0.66 0.34 1.1
## 30  0.03  0.75  0.06  0.00 -0.02  0.08 0.57 0.43 1.0
## 31  0.01  0.74  0.13  0.01 -0.05 -0.13 0.55 0.45 1.1
## 32  0.09  0.75  0.02  0.00  0.03 -0.01 0.55 0.45 1.0
## 33 -0.01  0.81 -0.07 -0.15  0.04 -0.07 0.68 0.32 1.1
## 
##                        MR2  MR6  MR5  MR1  MR4  MR3
## SS loadings           3.98 3.21 3.68 3.37 2.49 1.62
## Proportion Var        0.12 0.10 0.11 0.10 0.08 0.05
## Cumulative Var        0.12 0.22 0.33 0.43 0.51 0.56
## Proportion Explained  0.22 0.17 0.20 0.18 0.14 0.09
## Cumulative Proportion 0.22 0.39 0.59 0.78 0.91 1.00
## 
##  With factor correlations of 
##       MR2   MR6   MR5   MR1  MR4   MR3
## MR2  1.00 -0.18  0.33 -0.11 0.22 -0.15
## MR6 -0.18  1.00 -0.02  0.14 0.13  0.08
## MR5  0.33 -0.02  1.00  0.24 0.49  0.10
## MR1 -0.11  0.14  0.24  1.00 0.33  0.42
## MR4  0.22  0.13  0.49  0.33 1.00  0.22
## MR3 -0.15  0.08  0.10  0.42 0.22  1.00
## 
## Mean item complexity =  1.9
## Test of the hypothesis that 6 factors are sufficient.
## 
## The degrees of freedom for the null model are  528  and the objective function was  18.23 with Chi Square of  20910.11
## The degrees of freedom for the model are 345  and the objective function was  1.2 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  649.93  with prob <  5.8e-21 
## The total number of observations was  1160  with MLE Chi Square =  1370.62  with prob <  4.4e-122 
## 
## Tucker Lewis Index of factoring reliability =  0.923
## RMSEA index =  0.051  and the 90 % confidence intervals are  0.048 0.053
## BIC =  -1063.76
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR2  MR6  MR5  MR1  MR4
## Correlation of scores with factors             0.94 0.94 0.94 0.93 0.88
## Multiple R square of scores with factors       0.88 0.89 0.88 0.87 0.78
## Minimum correlation of possible factor scores  0.76 0.78 0.77 0.73 0.56
##                                                 MR3
## Correlation of scores with factors             0.86
## Multiple R square of scores with factors       0.73
## Minimum correlation of possible factor scores  0.47
fa2latex(fa(purposescales_cor,6,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 6, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r r }
##  \multicolumn{ 9 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR6  &  MR5  &  MR1  &  MR4  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  \bf{ 0.61}  &   0.03  &  -0.16  &   0.14  &  -0.09  &   0.14  &  0.31  &  0.69  &  1.42 \cr 
##  2   &  -0.07  &  -0.01  &   0.23  &  \bf{ 0.51}  &   0.18  &   0.26  &  0.71  &  0.29  &  2.30 \cr 
##  3   &  -0.04  &  -0.04  &   0.16  &  \bf{ 0.39}  &   0.27  &   0.28  &  0.61  &  0.39  &  3.13 \cr 
##  4   &  -0.06  &  -0.02  &   0.15  &  \bf{ 0.64}  &   0.24  &   0.02  &  0.67  &  0.33  &  1.42 \cr 
##  5   &   0.00  &   0.03  &   0.10  &  \bf{ 0.70}  &   0.17  &   0.03  &  0.69  &  0.31  &  1.16 \cr 
##  6   &  \bf{ 0.43}  &  -0.17  &  \bf{ 0.38}  &  -0.09  &   0.01  &   0.07  &  0.51  &  0.49  &  2.47 \cr 
##  7   &   0.04  &   0.03  &   0.02  &   0.08  &  \bf{ 0.36}  &  \bf{ 0.38}  &  0.41  &  0.59  &  2.14 \cr 
##  8   &   0.22  &   0.01  &   0.16  &  -0.11  &  \bf{ 0.48}  &   0.11  &  0.45  &  0.55  &  1.92 \cr 
##  9   &  \bf{ 0.56}  &  -0.06  &  -0.06  &   0.07  &   0.04  &  \bf{-0.33}  &  0.47  &  0.53  &  1.72 \cr 
##  10   &  \bf{ 0.66}  &  -0.03  &   0.17  &  -0.24  &   0.16  &   0.02  &  0.69  &  0.31  &  1.54 \cr 
##  11   &  \bf{-0.54}  &   0.05  &  -0.28  &  \bf{-0.34}  &   0.15  &  -0.06  &  0.52  &  0.48  &  2.53 \cr 
##  12   &  \bf{ 0.61}  &  -0.02  &   0.11  &  -0.05  &   0.17  &  -0.16  &  0.57  &  0.43  &  1.39 \cr 
##  13   &   0.02  &   0.11  &   0.02  &  \bf{ 0.67}  &   0.27  &  -0.06  &  0.65  &  0.35  &  1.40 \cr 
##  14   &  \bf{ 0.59}  &  -0.08  &   0.20  &  -0.25  &   0.09  &  -0.05  &  0.62  &  0.38  &  1.72 \cr 
##  15   &  \bf{-0.59}  &   0.04  &  -0.01  &  -0.23  &   0.17  &  -0.04  &  0.34  &  0.66  &  1.50 \cr 
##  16   &   0.27  &   0.10  &   0.17  &   0.01  &  \bf{ 0.41}  &  \bf{-0.35}  &  0.50  &  0.50  &  3.28 \cr 
##  17   &   0.06  &   0.03  &   0.15  &   0.07  &   0.24  &  \bf{ 0.55}  &  0.56  &  0.44  &  1.62 \cr 
##  18   &  \bf{ 0.54}  &  -0.03  &   0.19  &  -0.28  &   0.14  &  -0.15  &  0.60  &  0.40  &  2.17 \cr 
##  19   &   0.03  &   0.07  &   0.18  &   0.30  &   0.29  &   0.22  &  0.51  &  0.49  &  3.70 \cr 
##  20   &   0.07  &  -0.03  &   0.11  &  \bf{ 0.33}  &  \bf{ 0.31}  &   0.09  &  0.39  &  0.61  &  2.48 \cr 
##  21   &   0.07  &   0.03  &   0.03  &  -0.01  &  \bf{ 0.57}  &  -0.28  &  0.39  &  0.61  &  1.51 \cr 
##  22   &  -0.01  &   0.07  &  -0.15  &  \bf{ 0.37}  &  \bf{ 0.42}  &   0.21  &  0.53  &  0.47  &  2.82 \cr 
##  23   &  \bf{-0.46}  &   0.10  &  \bf{-0.39}  &   0.18  &  -0.08  &   0.21  &  0.65  &  0.35  &  2.94 \cr 
##  24   &  -0.04  &   0.10  &  \bf{ 0.66}  &   0.15  &   0.04  &   0.21  &  0.64  &  0.36  &  1.38 \cr 
##  25   &   0.03  &   0.10  &  \bf{ 0.66}  &   0.07  &   0.17  &  -0.07  &  0.61  &  0.39  &  1.23 \cr 
##  26   &  -0.06  &   0.06  &  \bf{ 0.67}  &   0.29  &  -0.01  &   0.08  &  0.64  &  0.36  &  1.43 \cr 
##  27   &  \bf{ 0.38}  &  -0.15  &  \bf{ 0.37}  &   0.00  &   0.02  &  -0.04  &  0.44  &  0.56  &  2.35 \cr 
##  28   &  -0.12  &   0.05  &  \bf{ 0.80}  &   0.04  &   0.10  &  -0.09  &  0.69  &  0.31  &  1.11 \cr 
##  29   &   0.08  &  \bf{ 0.83}  &  -0.05  &  -0.04  &  -0.08  &   0.05  &  0.66  &  0.34  &  1.06 \cr 
##  30   &   0.03  &  \bf{ 0.75}  &   0.06  &   0.00  &  -0.02  &   0.08  &  0.57  &  0.43  &  1.04 \cr 
##  31   &   0.01  &  \bf{ 0.74}  &   0.13  &   0.01  &  -0.05  &  -0.13  &  0.55  &  0.45  &  1.14 \cr 
##  32   &   0.09  &  \bf{ 0.75}  &   0.02  &   0.00  &   0.03  &  -0.01  &  0.55  &  0.45  &  1.03 \cr 
##  33   &  -0.01  &  \bf{ 0.81}  &  -0.07  &  -0.15  &   0.04  &  -0.07  &  0.68  &  0.32  &  1.11 \cr 
## \hline \cr SS loadings & 3.98 &  3.21 &  3.68 &  3.37 &  2.49 &  1.62 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 & -0.18 &  0.33 & -0.11 &  0.22 & -0.15 \cr 
##  MR6   & -0.18 &  1.00 & -0.02 &  0.14 &  0.13 &  0.08 \cr 
##  MR5   &  0.33 & -0.02 &  1.00 &  0.24 &  0.49 &  0.10 \cr 
##  MR1   & -0.11 &  0.14 &  0.24 &  1.00 &  0.33 &  0.42 \cr 
##  MR4   &  0.22 &  0.13 &  0.49 &  0.33 &  1.00 &  0.22 \cr 
##  MR3   & -0.15 &  0.08 &  0.10 &  0.42 &  0.22 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

``` # Target rotation based on 5 factors 1. Understanding Self, 2. Making Plans, 3. Daily Activities, 4, Sense of Purpose, 5. Serching for Purpose

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
APSI_2, APSI_4,  APSI_5, APSI_6,
#Factor 2: (making plans)
PWB_8, APSI_7, APSI_8,  PWB_5, PWB_7, PWB_6,
#Factor 3: (Daily Activities)
LET_2, PWB_2, PWB_3, PWB_9,  LET_4,
#Factor 4
MLQ_4, MLQ_5, MLQ_6, MLQ_1, MLQ_9,
#Factor 5
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_5  <-  7- purposescales$PWB_5
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 25]
## 
##    APSI_2 APSI_4 APSI_5 APSI_6 PWB_8 APSI_7 APSI_8 PWB_5 PWB_7 PWB_6 LET_2
## 1       4      4      4      4     3      4      4     3     4     5     4
## 2       3      5      4      3     2      4      4     5     3     5     3
## 3       4      3      3      3     3      4      3     6     6     4     4
## 4       4      4      5      4     4      4      3     4     5     4     4
## 5       3      3      4      3     3      2      3     3     2     3     2
## 6       4      4      4      2     4      5      3     4     3     4     5
## 7       2      3      4      4     3      2      2     6     3     4     4
## 8       3      3      5      3     4      3      1     5     4     4     4
## 9       5      4      4      2     5      4      5     6     5     5     4
## 10      2      3      5      3     3      3      4     5     6     6     3
## ..    ...    ...    ...    ...   ...    ...    ...   ...   ...   ...   ...
## Variables not shown: PWB_2 (dbl), PWB_3 (dbl), PWB_9 (dbl), LET_4 (dbl),
##   MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_1 (dbl), MLQ_9 (dbl), MLQ_2
##   (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  25 variables:
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ PWB_5 : num  3 5 6 4 3 4 6 5 6 5 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24", "25")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(25,list(f1=1:4,f2=5:10, f3=11:15, f4=16:20,f5=21:25))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR5    MR4    MR1    MR2    MR3   
## 1          0.245  0.410  0.344  0.126
## 2          0.188  0.194  0.653       
## 3                 0.413  0.404  0.179
## 4   0.117 -0.330  0.555        -0.307
## 5          0.162  0.185  0.376  0.161
## 6                 0.128  0.745       
## 7          0.118  0.235  0.665       
## 8                -0.452  0.146  0.504
## 9          0.270  0.336  0.269  0.206
## 10  0.109  0.219 -0.413  0.257  0.178
## 11         0.221  0.580         0.434
## 12                0.120 -0.133 -0.405
## 13         0.105 -0.344         0.632
## 14        -0.277         0.148  0.506
## 15         0.120  0.457         0.397
## 16         0.695  0.149              
## 17         0.731 -0.135              
## 18         0.706         0.140       
## 19         0.907 -0.135              
## 20 -0.180  0.310 -0.325         0.241
## 21  0.815                            
## 22  0.739                            
## 23  0.720  0.119 -0.139              
## 24  0.737                            
## 25  0.818                            
## 
##                  MR5   MR4   MR1   MR2   MR3
## SS loadings    3.044 2.987 2.163 2.106 1.766
## Proportion Var 0.122 0.119 0.087 0.084 0.071
## Cumulative Var 0.122 0.241 0.328 0.412 0.483
## 
## $score.cor
##            [,1]       [,2]        [,3]      [,4]       [,5]
## [1,]  1.0000000 0.10837734  0.15700546 0.1182883 -0.1048692
## [2,]  0.1083773 1.00000000  0.06481165 0.6013136  0.3651705
## [3,]  0.1570055 0.06481165  1.00000000 0.4479663 -0.3863090
## [4,]  0.1182883 0.60131359  0.44796633 1.0000000  0.1469474
## [5,] -0.1048692 0.36517047 -0.38630896 0.1469474  1.0000000
## 
## $TLI
## [1] 0.9404295
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04941118 0.04520159 0.05291182 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR5   MR4   MR1   MR2   MR3   h2   u2 com
## 1  -0.05  0.24  0.41  0.34  0.13 0.59 0.41 2.9
## 2  -0.04  0.19  0.19  0.65 -0.08 0.68 0.32 1.4
## 3   0.09 -0.03  0.41  0.40  0.18 0.48 0.52 2.5
## 4   0.12 -0.33  0.55  0.02 -0.31 0.67 0.33 2.4
## 5  -0.03  0.16  0.18  0.38  0.16 0.39 0.61 2.3
## 6   0.09  0.04  0.13  0.75 -0.05 0.67 0.33 1.1
## 7   0.00  0.12  0.23  0.67 -0.04 0.68 0.32 1.3
## 8  -0.02  0.03 -0.45  0.15  0.50 0.61 0.39 2.2
## 9   0.06  0.27  0.34  0.27  0.21 0.52 0.48 3.7
## 10  0.11  0.22 -0.41  0.26  0.18 0.39 0.61 2.9
## 11  0.03  0.22  0.58 -0.02  0.43 0.57 0.43 2.2
## 12  0.08  0.08  0.12 -0.13 -0.40 0.22 0.78 1.6
## 13 -0.03  0.11 -0.34 -0.07  0.63 0.67 0.33 1.6
## 14  0.01 -0.28 -0.07  0.15  0.51 0.25 0.75 1.8
## 15  0.05  0.12  0.46  0.08  0.40 0.42 0.58 2.2
## 16  0.05  0.70  0.15  0.04  0.06 0.62 0.38 1.1
## 17  0.07  0.73 -0.14  0.06  0.04 0.61 0.39 1.1
## 18  0.00  0.71  0.09  0.14 -0.06 0.62 0.38 1.1
## 19  0.01  0.91 -0.14 -0.04 -0.10 0.71 0.29 1.1
## 20 -0.18  0.31 -0.32  0.08  0.24 0.42 0.58 3.6
## 21  0.81 -0.08  0.03 -0.02  0.05 0.66 0.34 1.0
## 22  0.74  0.05  0.08  0.00  0.06 0.57 0.43 1.0
## 23  0.72  0.12 -0.14  0.05 -0.09 0.55 0.45 1.2
## 24  0.74  0.01 -0.04  0.09  0.05 0.55 0.45 1.0
## 25  0.82 -0.06 -0.06 -0.06 -0.02 0.66 0.34 1.0
## 
##                        MR5  MR4  MR1  MR2  MR3
## SS loadings           3.07 3.45 2.43 2.77 2.05
## Proportion Var        0.12 0.14 0.10 0.11 0.08
## Cumulative Var        0.12 0.26 0.36 0.47 0.55
## Proportion Explained  0.22 0.25 0.18 0.20 0.15
## Cumulative Proportion 0.22 0.47 0.65 0.85 1.00
## 
##  With factor correlations of 
##       MR5  MR4   MR1  MR2   MR3
## MR5  1.00 0.06  0.12 0.09 -0.11
## MR4  0.06 1.00  0.10 0.55  0.44
## MR1  0.12 0.10  1.00 0.31 -0.22
## MR2  0.09 0.55  0.31 1.00  0.31
## MR3 -0.11 0.44 -0.22 0.31  1.00
## 
## Mean item complexity =  1.8
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  300  and the objective function was  12.51 with Chi Square of  14383.98
## The degrees of freedom for the model are 185  and the objective function was  0.61 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  383.48  with prob <  5.8e-16 
## The total number of observations was  1160  with MLE Chi Square =  700.85  with prob <  4.6e-61 
## 
## Tucker Lewis Index of factoring reliability =  0.94
## RMSEA index =  0.049  and the 90 % confidence intervals are  0.045 0.053
## BIC =  -604.55
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR5  MR4  MR1  MR2  MR3
## Correlation of scores with factors             0.94 0.95 0.91 0.93 0.90
## Multiple R square of scores with factors       0.89 0.90 0.83 0.86 0.81
## Minimum correlation of possible factor scores  0.77 0.79 0.67 0.71 0.62
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR5  &  MR4  &  MR1  &  MR2  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.05  &   0.24  &  \bf{ 0.41}  &  \bf{ 0.34}  &   0.13  &  0.59  &  0.41  &  2.89 \cr 
##  2   &  -0.04  &   0.19  &   0.19  &  \bf{ 0.65}  &  -0.08  &  0.68  &  0.32  &  1.40 \cr 
##  3   &   0.09  &  -0.03  &  \bf{ 0.41}  &  \bf{ 0.40}  &   0.18  &  0.48  &  0.52  &  2.47 \cr 
##  4   &   0.12  &  \bf{-0.33}  &  \bf{ 0.55}  &   0.02  &  \bf{-0.31}  &  0.67  &  0.33  &  2.38 \cr 
##  5   &  -0.03  &   0.16  &   0.18  &  \bf{ 0.38}  &   0.16  &  0.39  &  0.61  &  2.32 \cr 
##  6   &   0.09  &   0.04  &   0.13  &  \bf{ 0.75}  &  -0.05  &  0.67  &  0.33  &  1.10 \cr 
##  7   &   0.00  &   0.12  &   0.23  &  \bf{ 0.67}  &  -0.04  &  0.68  &  0.32  &  1.32 \cr 
##  8   &  -0.02  &   0.03  &  \bf{-0.45}  &   0.15  &  \bf{ 0.50}  &  0.61  &  0.39  &  2.17 \cr 
##  9   &   0.06  &   0.27  &  \bf{ 0.34}  &   0.27  &   0.21  &  0.52  &  0.48  &  3.69 \cr 
##  10   &   0.11  &   0.22  &  \bf{-0.41}  &   0.26  &   0.18  &  0.39  &  0.61  &  2.92 \cr 
##  11   &   0.03  &   0.22  &  \bf{ 0.58}  &  -0.02  &  \bf{ 0.43}  &  0.57  &  0.43  &  2.19 \cr 
##  12   &   0.08  &   0.08  &   0.12  &  -0.13  &  \bf{-0.40}  &  0.22  &  0.78  &  1.60 \cr 
##  13   &  -0.03  &   0.11  &  \bf{-0.34}  &  -0.07  &  \bf{ 0.63}  &  0.67  &  0.33  &  1.65 \cr 
##  14   &   0.01  &  -0.28  &  -0.07  &   0.15  &  \bf{ 0.51}  &  0.25  &  0.75  &  1.79 \cr 
##  15   &   0.05  &   0.12  &  \bf{ 0.46}  &   0.08  &  \bf{ 0.40}  &  0.42  &  0.58  &  2.21 \cr 
##  16   &   0.05  &  \bf{ 0.70}  &   0.15  &   0.04  &   0.06  &  0.62  &  0.38  &  1.13 \cr 
##  17   &   0.07  &  \bf{ 0.73}  &  -0.14  &   0.06  &   0.04  &  0.61  &  0.39  &  1.10 \cr 
##  18   &   0.00  &  \bf{ 0.71}  &   0.09  &   0.14  &  -0.06  &  0.62  &  0.38  &  1.12 \cr 
##  19   &   0.01  &  \bf{ 0.91}  &  -0.14  &  -0.04  &  -0.10  &  0.71  &  0.29  &  1.07 \cr 
##  20   &  -0.18  &  \bf{ 0.31}  &  \bf{-0.32}  &   0.08  &   0.24  &  0.42  &  0.58  &  3.60 \cr 
##  21   &  \bf{ 0.81}  &  -0.08  &   0.03  &  -0.02  &   0.05  &  0.66  &  0.34  &  1.03 \cr 
##  22   &  \bf{ 0.74}  &   0.05  &   0.08  &   0.00  &   0.06  &  0.57  &  0.43  &  1.05 \cr 
##  23   &  \bf{ 0.72}  &   0.12  &  -0.14  &   0.05  &  -0.09  &  0.55  &  0.45  &  1.18 \cr 
##  24   &  \bf{ 0.74}  &   0.01  &  -0.04  &   0.09  &   0.05  &  0.55  &  0.45  &  1.04 \cr 
##  25   &  \bf{ 0.82}  &  -0.06  &  -0.06  &  -0.06  &  -0.02  &  0.66  &  0.34  &  1.03 \cr 
## \hline \cr SS loadings & 3.07 &  3.45 &  2.43 &  2.77 &  2.05 &  \cr  
## \cr 
##             \hline \cr 
## MR5   &  1.00 &  0.06 &  0.12 &  0.09 & -0.11 \cr 
##  MR4   &  0.06 &  1.00 &  0.10 &  0.55 &  0.44 \cr 
##  MR1   &  0.12 &  0.10 &  1.00 &  0.31 & -0.22 \cr 
##  MR2   &  0.09 &  0.55 &  0.31 &  1.00 &  0.31 \cr 
##  MR3   & -0.11 &  0.44 & -0.22 &  0.31 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on 5 (moving some around based on previos results) factors – take 2. 1. Understanding Self, 2. Making Plans, 3. Daily Activities, 4, Sense of Purpose, 5. Serching for Purpose

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
APSI_2, LET_2,   APSI_5, LET_4,
#Factor 2: (making plans)
PWB_8, APSI_7, APSI_8,  APSI_4,
#Factor 3: (Daily Activities)
PWB_2, PWB_3, PWB_9, PWB_6,
#Factor 4
MLQ_4, MLQ_5, MLQ_6, MLQ_1, MLQ_9,
#Factor 5
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)


purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 22]
## 
##    APSI_2 LET_2 APSI_5 LET_4 PWB_8 APSI_7 APSI_8 APSI_4 PWB_2 PWB_3 PWB_9
## 1       4     4      4     5     3      4      4      4     4     5     6
## 2       3     3      4     4     2      4      4      5     2     5     5
## 3       4     4      3     4     3      4      3      3     1     5     6
## 4       4     4      5     4     4      4      3      4     5     4     4
## 5       3     2      4     4     3      2      3      3     5     3     4
## 6       4     5      4     5     4      5      3      4     3     6     6
## 7       2     4      4     3     3      2      2      3     5     5     3
## 8       3     4      5     4     4      3      1      3     1     5     6
## 9       5     4      4     5     5      4      5      4     2     5     6
## 10      2     3      5     5     3      3      4      3     1     3     6
## ..    ...   ...    ...   ...   ...    ...    ...    ...   ...   ...   ...
## Variables not shown: PWB_6 (dbl), MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl),
##   MLQ_1 (dbl), MLQ_9 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8
##   (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  22 variables:
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ PWB_6 : num  5 5 4 4 3 4 4 4 5 6 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(22,list(f1=1:4,f2=5:8, f3=9:12, f4=13:17,f5=18:22))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR5    MR4    MR2    MR1    MR3   
## 1          0.164  0.329  0.430       
## 2          0.149         0.722       
## 3                 0.375  0.423       
## 4                        0.607       
## 5          0.123  0.374  0.202  0.119
## 6                 0.764              
## 7                 0.700  0.145       
## 8          0.128  0.683  0.125       
## 9                              -0.489
## 10         0.195 -0.217         0.701
## 11        -0.259         0.146  0.571
## 12  0.122  0.284  0.214 -0.254  0.399
## 13         0.631         0.258       
## 14         0.713                0.101
## 15         0.639  0.167  0.128       
## 16         0.891                     
## 17 -0.164  0.346        -0.112  0.413
## 18  0.816                            
## 19  0.732                0.124       
## 20  0.720  0.130        -0.143       
## 21  0.740                            
## 22  0.817                            
## 
##                  MR5   MR4   MR2   MR1   MR3
## SS loadings    3.012 2.546 2.089 1.563 1.442
## Proportion Var 0.137 0.116 0.095 0.071 0.066
## Cumulative Var 0.137 0.253 0.348 0.419 0.484
## 
## $score.cor
##             [,1]      [,2]      [,3]       [,4]       [,5]
## [1,]  1.00000000 0.1083962 0.1067275 0.09807489 -0.1033237
## [2,]  0.10839622 1.0000000 0.5751622 0.52302379  0.3672876
## [3,]  0.10672748 0.5751622 1.0000000 0.71533250  0.1580159
## [4,]  0.09807489 0.5230238 0.7153325 1.00000000  0.1268710
## [5,] -0.10332371 0.3672876 0.1580159 0.12687098  1.0000000
## 
## $TLI
## [1] 0.9421466
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05008507 0.04519804 0.05434029 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR5   MR4   MR2   MR1   MR3   h2   u2 com
## 1  -0.06  0.16  0.33  0.43 -0.06 0.59 0.41 2.3
## 2   0.01  0.15 -0.09  0.72  0.04 0.55 0.45 1.1
## 3   0.08 -0.10  0.37  0.42  0.01 0.49 0.51 2.2
## 4   0.03  0.08 -0.01  0.61  0.08 0.42 0.58 1.1
## 5  -0.04  0.12  0.37  0.20  0.12 0.38 0.62 2.1
## 6   0.09  0.01  0.76  0.04  0.02 0.66 0.34 1.0
## 7   0.00  0.06  0.70  0.15 -0.03 0.68 0.32 1.1
## 8  -0.05  0.13  0.68  0.12 -0.05 0.69 0.31 1.2
## 9   0.06  0.06 -0.08 -0.06 -0.49 0.25 0.75 1.1
## 10 -0.02  0.19 -0.22  0.06  0.70 0.63 0.37 1.4
## 11  0.03 -0.26  0.06  0.15  0.57 0.29 0.71 1.6
## 12  0.12  0.28  0.21 -0.25  0.40 0.36 0.64 3.5
## 13  0.04  0.63  0.03  0.26 -0.03 0.61 0.39 1.3
## 14  0.06  0.71  0.04  0.01  0.10 0.61 0.39 1.1
## 15 -0.01  0.64  0.17  0.13 -0.07 0.61 0.39 1.2
## 16  0.01  0.89 -0.04 -0.02 -0.05 0.72 0.28 1.0
## 17 -0.16  0.35  0.03 -0.11  0.41 0.41 0.59 2.5
## 18  0.82 -0.10 -0.03  0.06  0.03 0.66 0.34 1.0
## 19  0.73  0.04 -0.02  0.12 -0.01 0.57 0.43 1.1
## 20  0.72  0.13  0.05 -0.14 -0.01 0.55 0.45 1.2
## 21  0.74  0.00  0.07  0.01  0.08 0.56 0.44 1.0
## 22  0.82 -0.05 -0.09 -0.03 -0.02 0.67 0.33 1.0
## 
##                        MR5  MR4  MR2  MR1  MR3
## SS loadings           3.02 2.87 2.56 1.99 1.50
## Proportion Var        0.14 0.13 0.12 0.09 0.07
## Cumulative Var        0.14 0.27 0.38 0.47 0.54
## Proportion Explained  0.25 0.24 0.21 0.17 0.13
## Cumulative Proportion 0.25 0.49 0.71 0.87 1.00
## 
##  With factor correlations of 
##       MR5  MR4  MR2  MR1   MR3
## MR5  1.00 0.07 0.13 0.08 -0.14
## MR4  0.07 1.00 0.47 0.37  0.34
## MR2  0.13 0.47 1.00 0.64  0.02
## MR1  0.08 0.37 0.64 1.00  0.03
## MR3 -0.14 0.34 0.02 0.03  1.00
## 
## Mean item complexity =  1.5
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  231  and the objective function was  10.18 with Chi Square of  11718.83
## The degrees of freedom for the model are 131  and the objective function was  0.44 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  277.11  with prob <  1.7e-12 
## The total number of observations was  1160  with MLE Chi Square =  506.79  with prob <  1.3e-45 
## 
## Tucker Lewis Index of factoring reliability =  0.942
## RMSEA index =  0.05  and the 90 % confidence intervals are  0.045 0.054
## BIC =  -417.57
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR5  MR4  MR2  MR1  MR3
## Correlation of scores with factors             0.94 0.94 0.93 0.89 0.86
## Multiple R square of scores with factors       0.89 0.88 0.87 0.80 0.75
## Minimum correlation of possible factor scores  0.77 0.76 0.74 0.59 0.49
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR5  &  MR4  &  MR2  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.06  &   0.16  &  \bf{ 0.33}  &  \bf{ 0.43}  &  -0.06  &  0.59  &  0.41  &  2.29 \cr 
##  2   &   0.01  &   0.15  &  -0.09  &  \bf{ 0.72}  &   0.04  &  0.55  &  0.45  &  1.12 \cr 
##  3   &   0.08  &  -0.10  &  \bf{ 0.37}  &  \bf{ 0.42}  &   0.01  &  0.49  &  0.51  &  2.17 \cr 
##  4   &   0.03  &   0.08  &  -0.01  &  \bf{ 0.61}  &   0.08  &  0.42  &  0.58  &  1.07 \cr 
##  5   &  -0.04  &   0.12  &  \bf{ 0.37}  &   0.20  &   0.12  &  0.38  &  0.62  &  2.06 \cr 
##  6   &   0.09  &   0.01  &  \bf{ 0.76}  &   0.04  &   0.02  &  0.66  &  0.34  &  1.04 \cr 
##  7   &   0.00  &   0.06  &  \bf{ 0.70}  &   0.15  &  -0.03  &  0.68  &  0.32  &  1.10 \cr 
##  8   &  -0.05  &   0.13  &  \bf{ 0.68}  &   0.12  &  -0.05  &  0.69  &  0.31  &  1.16 \cr 
##  9   &   0.06  &   0.06  &  -0.08  &  -0.06  &  \bf{-0.49}  &  0.25  &  0.75  &  1.14 \cr 
##  10   &  -0.02  &   0.19  &  -0.22  &   0.06  &  \bf{ 0.70}  &  0.63  &  0.37  &  1.37 \cr 
##  11   &   0.03  &  -0.26  &   0.06  &   0.15  &  \bf{ 0.57}  &  0.29  &  0.71  &  1.58 \cr 
##  12   &   0.12  &   0.28  &   0.21  &  -0.25  &  \bf{ 0.40}  &  0.36  &  0.64  &  3.48 \cr 
##  13   &   0.04  &  \bf{ 0.63}  &   0.03  &   0.26  &  -0.03  &  0.61  &  0.39  &  1.35 \cr 
##  14   &   0.06  &  \bf{ 0.71}  &   0.04  &   0.01  &   0.10  &  0.61  &  0.39  &  1.07 \cr 
##  15   &  -0.01  &  \bf{ 0.64}  &   0.17  &   0.13  &  -0.07  &  0.61  &  0.39  &  1.25 \cr 
##  16   &   0.01  &  \bf{ 0.89}  &  -0.04  &  -0.02  &  -0.05  &  0.72  &  0.28  &  1.01 \cr 
##  17   &  -0.16  &  \bf{ 0.35}  &   0.03  &  -0.11  &  \bf{ 0.41}  &  0.41  &  0.59  &  2.47 \cr 
##  18   &  \bf{ 0.82}  &  -0.10  &  -0.03  &   0.06  &   0.03  &  0.66  &  0.34  &  1.04 \cr 
##  19   &  \bf{ 0.73}  &   0.04  &  -0.02  &   0.12  &  -0.01  &  0.57  &  0.43  &  1.07 \cr 
##  20   &  \bf{ 0.72}  &   0.13  &   0.05  &  -0.14  &  -0.01  &  0.55  &  0.45  &  1.16 \cr 
##  21   &  \bf{ 0.74}  &   0.00  &   0.07  &   0.01  &   0.08  &  0.56  &  0.44  &  1.04 \cr 
##  22   &  \bf{ 0.82}  &  -0.05  &  -0.09  &  -0.03  &  -0.02  &  0.67  &  0.33  &  1.03 \cr 
## \hline \cr SS loadings & 3.02 &  2.87 &  2.56 &  1.99 &  1.5 &  \cr  
## \cr 
##             \hline \cr 
## MR5   &  1.00 &  0.07 &  0.13 &  0.08 & -0.14 \cr 
##  MR4   &  0.07 &  1.00 &  0.47 &  0.37 &  0.34 \cr 
##  MR2   &  0.13 &  0.47 &  1.00 &  0.64 &  0.02 \cr 
##  MR1   &  0.08 &  0.37 &  0.64 &  1.00 &  0.03 \cr 
##  MR3   & -0.14 &  0.34 &  0.02 &  0.03 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on 5 (moving some around based on previos results) factors – take 3. Removing factor 3. 1. Understanding Self, 2. Making Plans, 4, Sense of Purpose, 5. Serching for Purpose. Results: not a good fit.

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
APSI_2, LET_2,   APSI_5, LET_4,
#Factor 2: (making plans)
PWB_8, APSI_7, APSI_8,  APSI_4,
#Factor 4
MLQ_4, MLQ_5, MLQ_6, MLQ_1, MLQ_9,
#Factor 5
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)

purposescales$MLQ_9  <-  8- purposescales$MLQ_9

purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 18]
## 
##    APSI_2 LET_2 APSI_5 LET_4 PWB_8 APSI_7 APSI_8 APSI_4 MLQ_4 MLQ_5 MLQ_6
## 1       4     4      4     5     3      4      4      4     5     6     4
## 2       3     3      4     4     2      4      4      5     5     4     3
## 3       4     4      3     4     3      4      3      3     4     4     4
## 4       4     4      5     4     4      4      3      4     3     5     5
## 5       3     2      4     4     3      2      3      3     4     4     4
## 6       4     5      4     5     4      5      3      4     4     5     5
## 7       2     4      4     3     3      2      2      3     3     6     3
## 8       3     4      5     4     4      3      1      3     5     5     4
## 9       5     4      4     5     5      4      5      4     7     6     6
## 10      2     3      5     5     3      3      4      3     3     5     1
## ..    ...   ...    ...   ...   ...    ...    ...    ...   ...   ...   ...
## Variables not shown: MLQ_1 (dbl), MLQ_9 (dbl), MLQ_2 (dbl), MLQ_3 (dbl),
##   MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  18 variables:
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(18,list(f1=1:4,f2=5:8, f3=9:13, f4=14:18))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR4    MR3    MR2    MR1   
## 1          0.106  0.378  0.383
## 2                -0.179  0.864
## 3         -0.116  0.405  0.385
## 4                        0.703
## 5          0.167  0.321  0.218
## 6                 0.739       
## 7                 0.718  0.111
## 8          0.113  0.705       
## 9          0.631         0.211
## 10         0.792              
## 11         0.642  0.178       
## 12         0.874              
## 13 -0.202  0.548        -0.135
## 14  0.809                     
## 15  0.734                     
## 16  0.728  0.148        -0.130
## 17  0.728                     
## 18  0.819                     
## 
##                  MR4   MR3   MR2   MR1
## SS loadings    2.995 2.611 2.051 1.710
## Proportion Var 0.166 0.145 0.114 0.095
## Cumulative Var 0.166 0.311 0.425 0.520
## 
## $score.cor
##            [,1]       [,2]      [,3]      [,4]
## [1,] 1.00000000 0.04810883 0.1252037 0.0655529
## [2,] 0.04810883 1.00000000 0.5199448 0.4936196
## [3,] 0.12520366 0.51994479 1.0000000 0.7007947
## [4,] 0.06555290 0.49361955 0.7007947 1.0000000
## 
## $TLI
## [1] 0.966681
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04388573 0.03792893 0.04939438 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR4   MR3   MR2   MR1   h2   u2 com
## 1  -0.06  0.11  0.38  0.38 0.58 0.42 2.2
## 2  -0.01  0.06 -0.18  0.86 0.61 0.39 1.1
## 3   0.07 -0.12  0.40  0.38 0.47 0.53 2.2
## 4   0.00  0.01 -0.07  0.70 0.44 0.56 1.0
## 5  -0.05  0.17  0.32  0.22 0.36 0.64 2.4
## 6   0.09  0.03  0.74  0.04 0.65 0.35 1.0
## 7   0.00  0.05  0.72  0.11 0.69 0.31 1.1
## 8  -0.04  0.11  0.71  0.09 0.69 0.31 1.1
## 9   0.06  0.63  0.03  0.21 0.62 0.38 1.2
## 10  0.07  0.79 -0.01 -0.02 0.61 0.39 1.0
## 11  0.02  0.64  0.18  0.06 0.62 0.38 1.2
## 12  0.04  0.87 -0.04 -0.07 0.68 0.32 1.0
## 13 -0.20  0.55 -0.06 -0.13 0.26 0.74 1.4
## 14  0.81 -0.09 -0.04  0.06 0.66 0.34 1.0
## 15  0.73  0.02  0.01  0.10 0.57 0.43 1.0
## 16  0.73  0.15  0.03 -0.13 0.54 0.46 1.2
## 17  0.73  0.05  0.04  0.01 0.55 0.45 1.0
## 18  0.82 -0.06 -0.05 -0.05 0.67 0.33 1.0
## 
##                        MR4  MR3  MR2  MR1
## SS loadings           3.00 2.80 2.44 2.03
## Proportion Var        0.17 0.16 0.14 0.11
## Cumulative Var        0.17 0.32 0.46 0.57
## Proportion Explained  0.29 0.27 0.24 0.20
## Cumulative Proportion 0.29 0.56 0.80 1.00
## 
##  With factor correlations of 
##      MR4  MR3  MR2  MR1
## MR4 1.00 0.04 0.12 0.11
## MR3 0.04 1.00 0.49 0.52
## MR2 0.12 0.49 1.00 0.70
## MR1 0.11 0.52 0.70 1.00
## 
## Mean item complexity =  1.3
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  153  and the objective function was  8.94 with Chi Square of  10305.31
## The degrees of freedom for the model are 87  and the objective function was  0.24 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  1160 with the empirical chi square  108.8  with prob <  0.057 
## The total number of observations was  1160  with MLE Chi Square =  278.9  with prob <  5.9e-22 
## 
## Tucker Lewis Index of factoring reliability =  0.967
## RMSEA index =  0.044  and the 90 % confidence intervals are  0.038 0.049
## BIC =  -334.99
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR4  MR3  MR2  MR1
## Correlation of scores with factors             0.94 0.94 0.93 0.91
## Multiple R square of scores with factors       0.88 0.88 0.87 0.83
## Minimum correlation of possible factor scores  0.77 0.76 0.74 0.66
fa2latex(fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 4, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR4  &  MR3  &  MR2  &  MR1  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.06  &   0.11  &  \bf{ 0.38}  &  \bf{ 0.38}  &  0.58  &  0.42  &  2.20 \cr 
##  2   &  -0.01  &   0.06  &  -0.18  &  \bf{ 0.86}  &  0.61  &  0.39  &  1.10 \cr 
##  3   &   0.07  &  -0.12  &  \bf{ 0.40}  &  \bf{ 0.38}  &  0.47  &  0.53  &  2.22 \cr 
##  4   &   0.00  &   0.01  &  -0.07  &  \bf{ 0.70}  &  0.44  &  0.56  &  1.02 \cr 
##  5   &  -0.05  &   0.17  &  \bf{ 0.32}  &   0.22  &  0.36  &  0.64  &  2.41 \cr 
##  6   &   0.09  &   0.03  &  \bf{ 0.74}  &   0.04  &  0.65  &  0.35  &  1.04 \cr 
##  7   &   0.00  &   0.05  &  \bf{ 0.72}  &   0.11  &  0.69  &  0.31  &  1.06 \cr 
##  8   &  -0.04  &   0.11  &  \bf{ 0.71}  &   0.09  &  0.69  &  0.31  &  1.09 \cr 
##  9   &   0.06  &  \bf{ 0.63}  &   0.03  &   0.21  &  0.62  &  0.38  &  1.25 \cr 
##  10   &   0.07  &  \bf{ 0.79}  &  -0.01  &  -0.02  &  0.61  &  0.39  &  1.02 \cr 
##  11   &   0.02  &  \bf{ 0.64}  &   0.18  &   0.06  &  0.62  &  0.38  &  1.17 \cr 
##  12   &   0.04  &  \bf{ 0.87}  &  -0.04  &  -0.07  &  0.68  &  0.32  &  1.02 \cr 
##  13   &  -0.20  &  \bf{ 0.55}  &  -0.06  &  -0.13  &  0.26  &  0.74  &  1.43 \cr 
##  14   &  \bf{ 0.81}  &  -0.09  &  -0.04  &   0.06  &  0.66  &  0.34  &  1.04 \cr 
##  15   &  \bf{ 0.73}  &   0.02  &   0.01  &   0.10  &  0.57  &  0.43  &  1.04 \cr 
##  16   &  \bf{ 0.73}  &   0.15  &   0.03  &  -0.13  &  0.54  &  0.46  &  1.15 \cr 
##  17   &  \bf{ 0.73}  &   0.05  &   0.04  &   0.01  &  0.55  &  0.45  &  1.02 \cr 
##  18   &  \bf{ 0.82}  &  -0.06  &  -0.05  &  -0.05  &  0.67  &  0.33  &  1.03 \cr 
## \hline \cr SS loadings & 3 &  2.8 &  2.44 &  2.03 &  \cr  
## \cr 
##             \hline \cr 
## MR4   & 1.00 & 0.04 & 0.12 & 0.11 \cr 
##  MR3   & 0.04 & 1.00 & 0.49 & 0.52 \cr 
##  MR2   & 0.12 & 0.49 & 1.00 & 0.70 \cr 
##  MR1   & 0.11 & 0.52 & 0.70 & 1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

``` # Target rotation based on 5 (moving some around based on previos results) factors – take 4. 1. Understanding Self, 2. Making Plans, 3. Daily Activities, 4, Sense of Purpose, 5. Serching for Purpose. Removing question 4 (PWB_6) from factor 3.

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
APSI_2, LET_2,   APSI_5, LET_4,
#Factor 2: (making plans)
PWB_8, APSI_7, APSI_8,  APSI_4,
#Factor 3: (Daily Activities)
PWB_2, PWB_3, PWB_9,
#Factor 4
MLQ_4, MLQ_5, MLQ_6, MLQ_1, MLQ_9,
#Factor 5
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)



purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$PWB_9  <-  7- purposescales$PWB_9
purposescales$MLQ_9  <-  8- purposescales$MLQ_9

purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 21]
## 
##    APSI_2 LET_2 APSI_5 LET_4 PWB_8 APSI_7 APSI_8 APSI_4 PWB_2 PWB_3 PWB_9
## 1       4     4      4     5     3      4      4      4     4     5     6
## 2       3     3      4     4     2      4      4      5     2     5     5
## 3       4     4      3     4     3      4      3      3     1     5     6
## 4       4     4      5     4     4      4      3      4     5     4     4
## 5       3     2      4     4     3      2      3      3     5     3     4
## 6       4     5      4     5     4      5      3      4     3     6     6
## 7       2     4      4     3     3      2      2      3     5     5     3
## 8       3     4      5     4     4      3      1      3     1     5     6
## 9       5     4      4     5     5      4      5      4     2     5     6
## 10      2     3      5     5     3      3      4      3     1     3     6
## ..    ...   ...    ...   ...   ...    ...    ...    ...   ...   ...   ...
## Variables not shown: MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_1 (dbl),
##   MLQ_9 (dbl), MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10
##   (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  21 variables:
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ LET_2 : num  4 3 4 4 2 5 4 4 4 3 ...
##  $ APSI_5: num  4 4 3 5 4 4 4 5 4 5 ...
##  $ LET_4 : num  5 4 4 4 4 5 3 4 5 5 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_9 : num  6 5 6 4 4 6 3 6 6 6 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(21,list(f1=1:4,f2=5:8, f3=9:11, f4=12:16,f5=17:21))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR5    MR4    MR2    MR1    MR3   
## 1          0.133  0.364  0.398       
## 2                -0.143  0.842       
## 3         -0.112  0.406  0.387       
## 4                        0.723       
## 5          0.146  0.341  0.224       
## 6                 0.695              
## 7                 0.679  0.141       
## 8          0.169  0.653  0.131       
## 9                -0.114        -0.539
## 10         0.306 -0.267         0.561
## 11        -0.189  0.117         0.656
## 12         0.601         0.208       
## 13         0.747                     
## 14         0.633  0.210              
## 15         0.896               -0.100
## 16 -0.140  0.454        -0.163  0.372
## 17  0.816                            
## 18  0.730                            
## 19  0.724  0.155        -0.131       
## 20  0.745                            
## 21  0.812                            
## 
##                  MR5   MR4   MR2   MR1   MR3
## SS loadings    2.996 2.594 1.978 1.748 1.221
## Proportion Var 0.143 0.124 0.094 0.083 0.058
## Cumulative Var 0.143 0.266 0.360 0.444 0.502
## 
## $score.cor
##             [,1]      [,2]       [,3]       [,4]        [,5]
## [1,]  1.00000000 0.1083901 0.12524624 0.06562208 -0.15440403
## [2,]  0.10839011 1.0000000 0.55983739 0.53480086  0.30152322
## [3,]  0.12524624 0.5598374 1.00000000 0.70099330  0.09285421
## [4,]  0.06562208 0.5348009 0.70099330 1.00000000  0.12609983
## [5,] -0.15440403 0.3015232 0.09285421 0.12609983  1.00000000
## 
## $TLI
## [1] 0.9515973
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04715062 0.04193413 0.05178404 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 5, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR5   MR4   MR2   MR1   MR3   h2   u2 com
## 1  -0.07  0.13  0.36  0.40 -0.04 0.58 0.42 2.3
## 2  -0.02  0.03 -0.14  0.84  0.03 0.60 0.40 1.1
## 3   0.08 -0.11  0.41  0.39  0.04 0.48 0.52 2.3
## 4   0.00  0.00 -0.08  0.72  0.04 0.46 0.54 1.0
## 5  -0.04  0.15  0.34  0.22  0.09 0.37 0.63 2.4
## 6   0.10  0.08  0.69  0.08  0.00 0.64 0.36 1.1
## 7   0.01  0.10  0.68  0.14 -0.02 0.69 0.31 1.1
## 8  -0.04  0.17  0.65  0.13 -0.06 0.69 0.31 1.2
## 9   0.04 -0.02 -0.11  0.03 -0.54 0.31 0.69 1.1
## 10 -0.02  0.31 -0.27  0.07  0.56 0.52 0.48 2.1
## 11  0.06 -0.19  0.12  0.05  0.66 0.39 0.61 1.3
## 12  0.05  0.60  0.09  0.21 -0.02 0.60 0.40 1.3
## 13  0.08  0.75  0.04 -0.01  0.06 0.61 0.39 1.0
## 14  0.01  0.63  0.21  0.08 -0.06 0.61 0.39 1.3
## 15  0.02  0.90 -0.03 -0.04 -0.10 0.72 0.28 1.0
## 16 -0.14  0.45  0.03 -0.16  0.37 0.42 0.58 2.4
## 17  0.82 -0.10 -0.02  0.04  0.04 0.66 0.34 1.0
## 18  0.73  0.03  0.00  0.10 -0.01 0.57 0.43 1.0
## 19  0.72  0.16  0.03 -0.13 -0.03 0.54 0.46 1.2
## 20  0.75  0.03  0.07  0.00  0.08 0.56 0.44 1.0
## 21  0.81 -0.04 -0.09 -0.04 -0.04 0.67 0.33 1.0
## 
##                        MR5  MR4  MR2  MR1  MR3
## SS loadings           3.00 2.86 2.43 2.13 1.25
## Proportion Var        0.14 0.14 0.12 0.10 0.06
## Cumulative Var        0.14 0.28 0.39 0.50 0.56
## Proportion Explained  0.26 0.24 0.21 0.18 0.11
## Cumulative Proportion 0.26 0.50 0.71 0.89 1.00
## 
##  With factor correlations of 
##       MR5  MR4   MR2  MR1   MR3
## MR5  1.00 0.04  0.11 0.12 -0.18
## MR4  0.04 1.00  0.39 0.49  0.25
## MR2  0.11 0.39  1.00 0.66 -0.03
## MR1  0.12 0.49  0.66 1.00  0.04
## MR3 -0.18 0.25 -0.03 0.04  1.00
## 
## Mean item complexity =  1.4
## Test of the hypothesis that 5 factors are sufficient.
## 
## The degrees of freedom for the null model are  210  and the objective function was  9.79 with Chi Square of  11272.25
## The degrees of freedom for the model are 115  and the objective function was  0.35 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  178.03  with prob <  0.00015 
## The total number of observations was  1160  with MLE Chi Square =  407.35  with prob <  2.6e-34 
## 
## Tucker Lewis Index of factoring reliability =  0.952
## RMSEA index =  0.047  and the 90 % confidence intervals are  0.042 0.052
## BIC =  -404.11
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR5  MR4  MR2  MR1  MR3
## Correlation of scores with factors             0.94 0.94 0.93 0.91 0.83
## Multiple R square of scores with factors       0.89 0.88 0.86 0.83 0.69
## Minimum correlation of possible factor scores  0.77 0.76 0.72 0.66 0.38
fa2latex(fa(purposescales_cor,5,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 5, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r r }
##  \multicolumn{ 8 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR5  &  MR4  &  MR2  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  -0.07  &   0.13  &  \bf{ 0.36}  &  \bf{ 0.40}  &  -0.04  &  0.58  &  0.42  &  2.30 \cr 
##  2   &  -0.02  &   0.03  &  -0.14  &  \bf{ 0.84}  &   0.03  &  0.60  &  0.40  &  1.06 \cr 
##  3   &   0.08  &  -0.11  &  \bf{ 0.41}  &  \bf{ 0.39}  &   0.04  &  0.48  &  0.52  &  2.26 \cr 
##  4   &   0.00  &   0.00  &  -0.08  &  \bf{ 0.72}  &   0.04  &  0.46  &  0.54  &  1.03 \cr 
##  5   &  -0.04  &   0.15  &  \bf{ 0.34}  &   0.22  &   0.09  &  0.37  &  0.63  &  2.37 \cr 
##  6   &   0.10  &   0.08  &  \bf{ 0.69}  &   0.08  &   0.00  &  0.64  &  0.36  &  1.09 \cr 
##  7   &   0.01  &   0.10  &  \bf{ 0.68}  &   0.14  &  -0.02  &  0.69  &  0.31  &  1.13 \cr 
##  8   &  -0.04  &   0.17  &  \bf{ 0.65}  &   0.13  &  -0.06  &  0.69  &  0.31  &  1.25 \cr 
##  9   &   0.04  &  -0.02  &  -0.11  &   0.03  &  \bf{-0.54}  &  0.31  &  0.69  &  1.11 \cr 
##  10   &  -0.02  &  \bf{ 0.31}  &  -0.27  &   0.07  &  \bf{ 0.56}  &  0.52  &  0.48  &  2.08 \cr 
##  11   &   0.06  &  -0.19  &   0.12  &   0.05  &  \bf{ 0.66}  &  0.39  &  0.61  &  1.27 \cr 
##  12   &   0.05  &  \bf{ 0.60}  &   0.09  &   0.21  &  -0.02  &  0.60  &  0.40  &  1.30 \cr 
##  13   &   0.08  &  \bf{ 0.75}  &   0.04  &  -0.01  &   0.06  &  0.61  &  0.39  &  1.04 \cr 
##  14   &   0.01  &  \bf{ 0.63}  &   0.21  &   0.08  &  -0.06  &  0.61  &  0.39  &  1.27 \cr 
##  15   &   0.02  &  \bf{ 0.90}  &  -0.03  &  -0.04  &  -0.10  &  0.72  &  0.28  &  1.03 \cr 
##  16   &  -0.14  &  \bf{ 0.45}  &   0.03  &  -0.16  &  \bf{ 0.37}  &  0.42  &  0.58  &  2.44 \cr 
##  17   &  \bf{ 0.82}  &  -0.10  &  -0.02  &   0.04  &   0.04  &  0.66  &  0.34  &  1.04 \cr 
##  18   &  \bf{ 0.73}  &   0.03  &   0.00  &   0.10  &  -0.01  &  0.57  &  0.43  &  1.04 \cr 
##  19   &  \bf{ 0.72}  &   0.16  &   0.03  &  -0.13  &  -0.03  &  0.54  &  0.46  &  1.17 \cr 
##  20   &  \bf{ 0.75}  &   0.03  &   0.07  &   0.00  &   0.08  &  0.56  &  0.44  &  1.04 \cr 
##  21   &  \bf{ 0.81}  &  -0.04  &  -0.09  &  -0.04  &  -0.04  &  0.67  &  0.33  &  1.04 \cr 
## \hline \cr SS loadings & 3 &  2.86 &  2.43 &  2.13 &  1.25 &  \cr  
## \cr 
##             \hline \cr 
## MR5   &  1.00 &  0.04 &  0.11 &  0.12 & -0.18 \cr 
##  MR4   &  0.04 &  1.00 &  0.39 &  0.49 &  0.25 \cr 
##  MR2   &  0.11 &  0.39 &  1.00 &  0.66 & -0.03 \cr 
##  MR1   &  0.12 &  0.49 &  0.66 &  1.00 &  0.04 \cr 
##  MR3   & -0.18 &  0.25 & -0.03 &  0.04 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on 4 factors – based on new EFA

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
PWB_1, PWB_3, PWB_5, APSI_6, LET_1, LET_3, LET_5,
#Factor 2: (making plans)
PWB_2, PWB_7, PWB_8,  APSI_2, APSI_4, APSI_7, APSI_8,
#Factor 3
MLQ_4, MLQ_5, MLQ_6, MLQ_1, MLQ_9,
#Factor 4
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)



purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_5  <-  7- purposescales$PWB_5
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$MLQ_9  <-  8- purposescales$MLQ_9
purposescales$LET_1  <-  6- purposescales$LET_1
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5
purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 24]
## 
##    PWB_1 PWB_3 PWB_5 APSI_6 LET_1 LET_3 LET_5 PWB_2 PWB_7 PWB_8 APSI_2
## 1      4     5     3      4     4     4     5     4     4     3      4
## 2      4     5     5      3     3     4     4     2     3     2      3
## 3      5     5     6      3     3     3     4     1     6     3      4
## 4      2     4     4      4     1     4     4     5     5     4      4
## 5      2     3     3      3     3     3     2     5     2     3      3
## 6      5     6     4      2     5     5     5     3     3     4      4
## 7      2     5     6      4     3     2     3     5     3     3      2
## 8      6     5     5      3     3     3     4     1     4     4      3
## 9      5     5     6      2     5     5     5     2     5     5      5
## 10     6     3     5      3     3     5     5     1     6     3      2
## ..   ...   ...   ...    ...   ...   ...   ...   ...   ...   ...    ...
## Variables not shown: APSI_4 (dbl), APSI_7 (dbl), APSI_8 (dbl), MLQ_4
##   (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_1 (dbl), MLQ_9 (dbl), MLQ_2 (dbl),
##   MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  24 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ PWB_5 : num  3 5 6 4 3 4 6 5 6 5 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_1 : num  4 3 3 1 3 5 3 3 5 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ PWB_2 : num  4 2 1 5 5 3 5 1 2 1 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_9 : num  3 3 4 3 5 7 5 4 7 6 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22", "23", "24")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(24,list(f1=1:7,f2=8:14, f3=15:19, f4=20:24))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR1    MR2    MR4    MR3   
## 1   0.670               -0.230
## 2   0.815                     
## 3   0.762  0.131              
## 4  -0.661  0.144        -0.277
## 5   0.536        -0.154  0.251
## 6   0.768                     
## 7   0.745 -0.124              
## 8  -0.478 -0.269         0.167
## 9          0.561         0.178
## 10         0.565              
## 11 -0.103  0.624         0.170
## 12         0.766              
## 13         0.836  0.100       
## 14         0.834              
## 15         0.175         0.676
## 16  0.160                0.677
## 17         0.221         0.657
## 18                       0.830
## 19  0.487        -0.132  0.264
## 20                0.803       
## 21                0.731       
## 22                0.722  0.122
## 23                0.738       
## 24        -0.105  0.820       
## 
##                  MR1   MR2   MR4   MR3
## SS loadings    4.095 3.255 2.999 2.440
## Proportion Var 0.171 0.136 0.125 0.102
## Cumulative Var 0.171 0.306 0.431 0.533
## 
## $score.cor
##             [,1]       [,2]       [,3]      [,4]
## [1,]  1.00000000 0.02984821 -0.1872742 0.3435562
## [2,]  0.02984821 1.00000000  0.1064184 0.6158025
## [3,] -0.18727417 0.10641836  1.0000000 0.1082920
## [4,]  0.34355623 0.61580245  0.1082920 1.0000000
## 
## $TLI
## [1] 0.9413912
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.05198605 0.04783528 0.05546721 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR1   MR2   MR4   MR3   h2   u2 com
## 1   0.67  0.09 -0.01 -0.23 0.39 0.61 1.3
## 2   0.82  0.04  0.03  0.03 0.67 0.33 1.0
## 3   0.76  0.13  0.04 -0.04 0.56 0.44 1.1
## 4  -0.66  0.14  0.05 -0.28 0.63 0.37 1.5
## 5   0.54  0.03 -0.15  0.25 0.50 0.50 1.6
## 6   0.77 -0.06 -0.02  0.06 0.63 0.37 1.0
## 7   0.75 -0.12  0.04  0.08 0.60 0.40 1.1
## 8  -0.48 -0.27  0.05  0.17 0.22 0.78 1.9
## 9   0.00  0.56  0.05  0.18 0.47 0.53 1.2
## 10  0.08  0.56 -0.04  0.08 0.38 0.62 1.1
## 11 -0.10  0.62 -0.07  0.17 0.54 0.46 1.2
## 12 -0.09  0.77 -0.04  0.07 0.66 0.34 1.0
## 13  0.00  0.84  0.10 -0.09 0.64 0.36 1.1
## 14 -0.07  0.83  0.00 -0.02 0.69 0.31 1.0
## 15 -0.04  0.18  0.05  0.68 0.62 0.38 1.2
## 16  0.16  0.06  0.09  0.68 0.61 0.39 1.2
## 17 -0.06  0.22  0.00  0.66 0.63 0.37 1.2
## 18  0.04 -0.06  0.03  0.83 0.66 0.34 1.0
## 19  0.49  0.04 -0.13  0.26 0.44 0.56 1.7
## 20  0.00  0.00  0.80 -0.06 0.65 0.35 1.0
## 21 -0.02  0.08  0.73  0.05 0.57 0.43 1.0
## 22  0.01 -0.05  0.72  0.12 0.53 0.47 1.1
## 23  0.07  0.08  0.74  0.02 0.55 0.45 1.0
## 24  0.01 -0.10  0.82 -0.04 0.67 0.33 1.0
## 
##                        MR1  MR2  MR4  MR3
## SS loadings           4.22 3.48 3.02 2.78
## Proportion Var        0.18 0.15 0.13 0.12
## Cumulative Var        0.18 0.32 0.45 0.56
## Proportion Explained  0.31 0.26 0.22 0.21
## Cumulative Proportion 0.31 0.57 0.79 1.00
## 
##  With factor correlations of 
##       MR1   MR2   MR4  MR3
## MR1  1.00 -0.05 -0.21 0.31
## MR2 -0.05  1.00  0.10 0.60
## MR4 -0.21  0.10  1.00 0.04
## MR3  0.31  0.60  0.04 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  276  and the objective function was  12.93 with Chi Square of  14867.78
## The degrees of freedom for the model are 186  and the objective function was  0.66 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  1160 with the empirical chi square  373.02  with prob <  1.3e-14 
## The total number of observations was  1160  with MLE Chi Square =  760.97  with prob <  1.5e-70 
## 
## Tucker Lewis Index of factoring reliability =  0.941
## RMSEA index =  0.052  and the 90 % confidence intervals are  0.048 0.055
## BIC =  -551.48
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                 MR1  MR2  MR4  MR3
## Correlation of scores with factors             0.95 0.95 0.94 0.94
## Multiple R square of scores with factors       0.91 0.90 0.88 0.88
## Minimum correlation of possible factor scores  0.82 0.80 0.76 0.76
fa2latex(fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 4, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR1  &  MR2  &  MR4  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &  \bf{ 0.67}  &   0.09  &  -0.01  &  -0.23  &  0.39  &  0.61  &  1.27 \cr 
##  2   &  \bf{ 0.82}  &   0.04  &   0.03  &   0.03  &  0.67  &  0.33  &  1.01 \cr 
##  3   &  \bf{ 0.76}  &   0.13  &   0.04  &  -0.04  &  0.56  &  0.44  &  1.07 \cr 
##  4   &  \bf{-0.66}  &   0.14  &   0.05  &  -0.28  &  0.63  &  0.37  &  1.46 \cr 
##  5   &  \bf{ 0.54}  &   0.03  &  -0.15  &   0.25  &  0.50  &  0.50  &  1.62 \cr 
##  6   &  \bf{ 0.77}  &  -0.06  &  -0.02  &   0.06  &  0.63  &  0.37  &  1.03 \cr 
##  7   &  \bf{ 0.75}  &  -0.12  &   0.04  &   0.08  &  0.60  &  0.40  &  1.08 \cr 
##  8   &  \bf{-0.48}  &  -0.27  &   0.05  &   0.17  &  0.22  &  0.78  &  1.88 \cr 
##  9   &   0.00  &  \bf{ 0.56}  &   0.05  &   0.18  &  0.47  &  0.53  &  1.22 \cr 
##  10   &   0.08  &  \bf{ 0.56}  &  -0.04  &   0.08  &  0.38  &  0.62  &  1.09 \cr 
##  11   &  -0.10  &  \bf{ 0.62}  &  -0.07  &   0.17  &  0.54  &  0.46  &  1.23 \cr 
##  12   &  -0.09  &  \bf{ 0.77}  &  -0.04  &   0.07  &  0.66  &  0.34  &  1.05 \cr 
##  13   &   0.00  &  \bf{ 0.84}  &   0.10  &  -0.09  &  0.64  &  0.36  &  1.05 \cr 
##  14   &  -0.07  &  \bf{ 0.83}  &   0.00  &  -0.02  &  0.69  &  0.31  &  1.01 \cr 
##  15   &  -0.04  &   0.18  &   0.05  &  \bf{ 0.68}  &  0.62  &  0.38  &  1.15 \cr 
##  16   &   0.16  &   0.06  &   0.09  &  \bf{ 0.68}  &  0.61  &  0.39  &  1.16 \cr 
##  17   &  -0.06  &   0.22  &   0.00  &  \bf{ 0.66}  &  0.63  &  0.37  &  1.24 \cr 
##  18   &   0.04  &  -0.06  &   0.03  &  \bf{ 0.83}  &  0.66  &  0.34  &  1.02 \cr 
##  19   &  \bf{ 0.49}  &   0.04  &  -0.13  &   0.26  &  0.44  &  0.56  &  1.73 \cr 
##  20   &   0.00  &   0.00  &  \bf{ 0.80}  &  -0.06  &  0.65  &  0.35  &  1.01 \cr 
##  21   &  -0.02  &   0.08  &  \bf{ 0.73}  &   0.05  &  0.57  &  0.43  &  1.03 \cr 
##  22   &   0.01  &  -0.05  &  \bf{ 0.72}  &   0.12  &  0.53  &  0.47  &  1.07 \cr 
##  23   &   0.07  &   0.08  &  \bf{ 0.74}  &   0.02  &  0.55  &  0.45  &  1.04 \cr 
##  24   &   0.01  &  -0.10  &  \bf{ 0.82}  &  -0.04  &  0.67  &  0.33  &  1.04 \cr 
## \hline \cr SS loadings & 4.22 &  3.48 &  3.02 &  2.78 &  \cr  
## \cr 
##             \hline \cr 
## MR1   &  1.00 & -0.05 & -0.21 &  0.31 \cr 
##  MR2   & -0.05 &  1.00 &  0.10 &  0.60 \cr 
##  MR4   & -0.21 &  0.10 &  1.00 &  0.04 \cr 
##  MR3   &  0.31 &  0.60 &  0.04 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Target rotation based on 4 factors – based on new EFA – quick tweek based on previous results also droped MLQ_9 and PWB_2 because they were loading on two factors.

all_surveys<-read.csv("allsurveysYT1.csv")
purposescales<-select(all_surveys,
#Factor 1 Understanding Self:
PWB_1, PWB_3, APSI_6, LET_3, LET_5, 
#Factor 2: (making plans)
PWB_7, PWB_8,  APSI_2, APSI_4, APSI_7, APSI_8,
#Factor 3
MLQ_4, MLQ_5, MLQ_6, MLQ_1, 
#Factor 4
MLQ_2, MLQ_3, MLQ_7, MLQ_8, MLQ_10)



purposescales$PWB_1  <-  7- purposescales$PWB_1
purposescales$PWB_3  <-  7- purposescales$PWB_3
purposescales$LET_3  <-  6- purposescales$LET_3
purposescales$LET_5  <-  6- purposescales$LET_5

purposescales<- data.frame(apply(purposescales,2, as.numeric))

library(GPArotation)
library(psych)
library(dplyr)

purposescales<-tbl_df(purposescales)
purposescales
## Source: local data frame [1,160 x 20]
## 
##    PWB_1 PWB_3 APSI_6 LET_3 LET_5 PWB_7 PWB_8 APSI_2 APSI_4 APSI_7 APSI_8
## 1      4     5      4     4     5     4     3      4      4      4      4
## 2      4     5      3     4     4     3     2      3      5      4      4
## 3      5     5      3     3     4     6     3      4      3      4      3
## 4      2     4      4     4     4     5     4      4      4      4      3
## 5      2     3      3     3     2     2     3      3      3      2      3
## 6      5     6      2     5     5     3     4      4      4      5      3
## 7      2     5      4     2     3     3     3      2      3      2      2
## 8      6     5      3     3     4     4     4      3      3      3      1
## 9      5     5      2     5     5     5     5      5      4      4      5
## 10     6     3      3     5     5     6     3      2      3      3      4
## ..   ...   ...    ...   ...   ...   ...   ...    ...    ...    ...    ...
## Variables not shown: MLQ_4 (dbl), MLQ_5 (dbl), MLQ_6 (dbl), MLQ_1 (dbl),
##   MLQ_2 (dbl), MLQ_3 (dbl), MLQ_7 (dbl), MLQ_8 (dbl), MLQ_10 (dbl)
str(purposescales)
## Classes 'tbl_df', 'tbl' and 'data.frame':    1160 obs. of  20 variables:
##  $ PWB_1 : num  4 4 5 2 2 5 2 6 5 6 ...
##  $ PWB_3 : num  5 5 5 4 3 6 5 5 5 3 ...
##  $ APSI_6: num  4 3 3 4 3 2 4 3 2 3 ...
##  $ LET_3 : num  4 4 3 4 3 5 2 3 5 5 ...
##  $ LET_5 : num  5 4 4 4 2 5 3 4 5 5 ...
##  $ PWB_7 : num  4 3 6 5 2 3 3 4 5 6 ...
##  $ PWB_8 : num  3 2 3 4 3 4 3 4 5 3 ...
##  $ APSI_2: num  4 3 4 4 3 4 2 3 5 2 ...
##  $ APSI_4: num  4 5 3 4 3 4 3 3 4 3 ...
##  $ APSI_7: num  4 4 4 4 2 5 2 3 4 3 ...
##  $ APSI_8: num  4 4 3 3 3 3 2 1 5 4 ...
##  $ MLQ_4 : num  5 5 4 3 4 4 3 5 7 3 ...
##  $ MLQ_5 : num  6 4 4 5 4 5 6 5 6 5 ...
##  $ MLQ_6 : num  4 3 4 5 4 5 3 4 6 1 ...
##  $ MLQ_1 : num  4 3 4 5 4 5 6 3 6 1 ...
##  $ MLQ_2 : num  7 5 7 6 6 5 2 7 5 7 ...
##  $ MLQ_3 : num  7 5 5 7 5 3 2 7 2 1 ...
##  $ MLQ_7 : num  5 5 4 5 5 3 5 5 5 5 ...
##  $ MLQ_8 : num  7 4 5 5 5 4 4 7 7 5 ...
##  $ MLQ_10: num  7 5 4 6 5 3 4 5 2 1 ...
colnames(purposescales) <- c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20")
#Target rotation: choose "simple structure" a priori and can be applied to oblique and orthogonal rotation based on 
#what paper says facotrs should be purposescales
Targ_key <- make.keys(20,list(f1=1:5,f2=6:11, f3=12:15, f4=16:20))
Targ_key <- scrub(Targ_key,isvalue=1)  #fix the 0s, allow the NAs to be estimated
Targ_key <- list(Targ_key)
purposescales_cor <- corFiml(purposescales)
out_targetQ <- fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key) #TargetT for orthogonal rotation
out_targetQ[c("loadings", "score.cor", "TLI", "RMSEA")]
## $loadings
## 
## Loadings:
##    MR2    MR4    MR1    MR3   
## 1                 0.607 -0.167
## 2                 0.821       
## 3   0.121        -0.655 -0.258
## 4                 0.819       
## 5                 0.802       
## 6   0.572                0.158
## 7   0.589         0.110       
## 8   0.646                0.136
## 9   0.779                     
## 10  0.837                     
## 11  0.867                     
## 12  0.147                0.690
## 13                0.163  0.693
## 14  0.192                0.675
## 15 -0.112                0.883
## 16         0.808              
## 17         0.726              
## 18         0.714         0.137
## 19         0.738              
## 20         0.818              
## 
##                  MR2   MR4   MR1   MR3
## SS loadings    3.277 2.935 2.844 2.377
## Proportion Var 0.164 0.147 0.142 0.119
## Cumulative Var 0.164 0.311 0.453 0.572
## 
## $score.cor
##             [,1]       [,2]        [,3]      [,4]
## [1,]  1.00000000  0.1068177 -0.06783523 0.6159032
## [2,]  0.10681771  1.0000000 -0.16311633 0.1083810
## [3,] -0.06783523 -0.1631163  1.00000000 0.2634312
## [4,]  0.61590321  0.1083810  0.26343125 1.0000000
## 
## $TLI
## [1] 0.9611547
## 
## $RMSEA
##      RMSEA      lower      upper confidence 
## 0.04636942 0.04119086 0.05102479 0.10000000
out_targetQ
## Factor Analysis using method =  minres
## Call: fa(r = purposescales_cor, nfactors = 4, n.obs = 1160, rotate = "TargetQ", 
##     Target = Targ_key)
## Standardized loadings (pattern matrix) based upon correlation matrix
##      MR2   MR4   MR1   MR3   h2   u2 com
## 1   0.05 -0.02  0.61 -0.17 0.33 0.67 1.2
## 2   0.08  0.02  0.82 -0.01 0.65 0.35 1.0
## 3   0.12  0.07 -0.65 -0.26 0.61 0.39 1.4
## 4   0.03 -0.02  0.82 -0.04 0.65 0.35 1.0
## 5  -0.04  0.04  0.80 -0.01 0.64 0.36 1.0
## 6   0.57  0.05  0.03  0.16 0.47 0.53 1.2
## 7   0.59 -0.04  0.11  0.05 0.38 0.62 1.1
## 8   0.65 -0.07 -0.06  0.14 0.54 0.46 1.1
## 9   0.78 -0.05 -0.05  0.05 0.66 0.34 1.0
## 10  0.84  0.10  0.01 -0.09 0.63 0.37 1.1
## 11  0.87  0.00 -0.02 -0.06 0.70 0.30 1.0
## 12  0.15  0.03 -0.05  0.69 0.61 0.39 1.1
## 13  0.04  0.06  0.16  0.69 0.62 0.38 1.1
## 14  0.19 -0.02 -0.06  0.68 0.63 0.37 1.2
## 15 -0.11  0.00  0.02  0.88 0.68 0.32 1.0
## 16  0.00  0.81 -0.02 -0.06 0.66 0.34 1.0
## 17  0.07  0.73 -0.04  0.04 0.57 0.43 1.0
## 18 -0.07  0.71 -0.02  0.14 0.53 0.47 1.1
## 19  0.09  0.74  0.05  0.00 0.55 0.45 1.0
## 20 -0.09  0.82  0.00 -0.05 0.66 0.34 1.0
## 
##                        MR2  MR4  MR1  MR3
## SS loadings           3.43 2.95 2.87 2.55
## Proportion Var        0.17 0.15 0.14 0.13
## Cumulative Var        0.17 0.32 0.46 0.59
## Proportion Explained  0.29 0.25 0.24 0.22
## Cumulative Proportion 0.29 0.54 0.78 1.00
## 
##  With factor correlations of 
##       MR2   MR4   MR1  MR3
## MR2  1.00  0.11 -0.11 0.63
## MR4  0.11  1.00 -0.17 0.09
## MR1 -0.11 -0.17  1.00 0.31
## MR3  0.63  0.09  0.31 1.00
## 
## Mean item complexity =  1.1
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  190  and the objective function was  10.64 with Chi Square of  12257.4
## The degrees of freedom for the model are 116  and the objective function was  0.35 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  1160 with the empirical chi square  164.59  with prob <  0.002 
## The total number of observations was  1160  with MLE Chi Square =  401.52  with prob <  4e-33 
## 
## Tucker Lewis Index of factoring reliability =  0.961
## RMSEA index =  0.046  and the 90 % confidence intervals are  0.041 0.051
## BIC =  -417
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 MR2  MR4  MR1  MR3
## Correlation of scores with factors             0.95 0.94 0.94 0.94
## Multiple R square of scores with factors       0.90 0.88 0.89 0.88
## Minimum correlation of possible factor scores  0.81 0.77 0.77 0.77
fa2latex(fa(purposescales_cor,4,rotate="TargetQ", n.obs = 1160, Target=Targ_key),heading="Table 7 Factor Based on theory")
## % Called in the psych package  fa2latex % Called in the psych package  fa(purposescales_cor, 4, rotate = "TargetQ", n.obs = 1160, Target = Targ_key) % Called in the psych package  Table 7 Factor Based on theory 
## \begin{table}[htdp]\caption{fa2latex}
## \begin{center}
## \begin{scriptsize} 
## \begin{tabular} {l r r r r r r r }
##  \multicolumn{ 7 }{l}{ Table 7 Factor Based on theory } \cr 
##  \hline Variable  &   MR2  &  MR4  &  MR1  &  MR3  &  h2  &  u2  &  com \cr 
##   \hline 
## 1   &   0.05  &  -0.02  &  \bf{ 0.61}  &  -0.17  &  0.33  &  0.67  &  1.17 \cr 
##  2   &   0.08  &   0.02  &  \bf{ 0.82}  &  -0.01  &  0.65  &  0.35  &  1.02 \cr 
##  3   &   0.12  &   0.07  &  \bf{-0.65}  &  -0.26  &  0.61  &  0.39  &  1.40 \cr 
##  4   &   0.03  &  -0.02  &  \bf{ 0.82}  &  -0.04  &  0.65  &  0.35  &  1.01 \cr 
##  5   &  -0.04  &   0.04  &  \bf{ 0.80}  &  -0.01  &  0.64  &  0.36  &  1.01 \cr 
##  6   &  \bf{ 0.57}  &   0.05  &   0.03  &   0.16  &  0.47  &  0.53  &  1.17 \cr 
##  7   &  \bf{ 0.59}  &  -0.04  &   0.11  &   0.05  &  0.38  &  0.62  &  1.09 \cr 
##  8   &  \bf{ 0.65}  &  -0.07  &  -0.06  &   0.14  &  0.54  &  0.46  &  1.13 \cr 
##  9   &  \bf{ 0.78}  &  -0.05  &  -0.05  &   0.05  &  0.66  &  0.34  &  1.02 \cr 
##  10   &  \bf{ 0.84}  &   0.10  &   0.01  &  -0.09  &  0.63  &  0.37  &  1.05 \cr 
##  11   &  \bf{ 0.87}  &   0.00  &  -0.02  &  -0.06  &  0.70  &  0.30  &  1.01 \cr 
##  12   &   0.15  &   0.03  &  -0.05  &  \bf{ 0.69}  &  0.61  &  0.39  &  1.10 \cr 
##  13   &   0.04  &   0.06  &   0.16  &  \bf{ 0.69}  &  0.62  &  0.38  &  1.13 \cr 
##  14   &   0.19  &  -0.02  &  -0.06  &  \bf{ 0.68}  &  0.63  &  0.37  &  1.18 \cr 
##  15   &  -0.11  &   0.00  &   0.02  &  \bf{ 0.88}  &  0.68  &  0.32  &  1.03 \cr 
##  16   &   0.00  &  \bf{ 0.81}  &  -0.02  &  -0.06  &  0.66  &  0.34  &  1.01 \cr 
##  17   &   0.07  &  \bf{ 0.73}  &  -0.04  &   0.04  &  0.57  &  0.43  &  1.03 \cr 
##  18   &  -0.07  &  \bf{ 0.71}  &  -0.02  &   0.14  &  0.53  &  0.47  &  1.09 \cr 
##  19   &   0.09  &  \bf{ 0.74}  &   0.05  &   0.00  &  0.55  &  0.45  &  1.04 \cr 
##  20   &  -0.09  &  \bf{ 0.82}  &   0.00  &  -0.05  &  0.66  &  0.34  &  1.03 \cr 
## \hline \cr SS loadings & 3.43 &  2.95 &  2.87 &  2.55 &  \cr  
## \cr 
##             \hline \cr 
## MR2   &  1.00 &  0.11 & -0.11 &  0.63 \cr 
##  MR4   &  0.11 &  1.00 & -0.17 &  0.09 \cr 
##  MR1   & -0.11 & -0.17 &  1.00 &  0.31 \cr 
##  MR3   &  0.63 &  0.09 &  0.31 &  1.00 \cr 
##  \hline 
## \end{tabular}
## \end{scriptsize}
## \end{center}
## \label{default}
## \end{table}
#The best fit to the data seems to be three factors. F1: questions 1,3,5,6. f2: 8,7,4. f3: 2,9

CFI

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

Now let’s look at this as a bifactor model

bifactor.model = 'Definate =~ APSI_2 + APSI_4 +  PWB_8 + APSI_7 + APSI_8 +  APSI_5 +  APSI_1 + LET_2
                Tend   =~ PWB_2 + PWB_9 + PWB_3 + PWB_5 + LET_1 + APSI_6
              MLQP =~ MLQ_4 + MLQ_5 + MLQ_6 + MLQ_1
              MLQS =~ MLQ_2 + MLQ_3 + MLQ_7 + MLQ_8 + MLQ_10
                Definate ~~ 0*Tend
                Definate ~~ 0*MLQP
                Definate~~0*MLQS
                MLQP~~0*Tend
                MLQP~~0*MLQS
                MLQS~~0*Tend'
                
bifactor.fit=cfa(bifactor.model, data=all_surveys, missing = "fiml", std.lv = T)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be removed:
##   17 22 23 24 28 29 43 45 78 79 80 81 85 94 110 111 112 116 121 122 123 124 125 128 129 130 131 133 135 137 138 140 147 151 152 155 156 162 166 169 170 171 172 173 174 176 177 179 180 183 184 186 187 188 189 192 194 195 197 200 202 203 204 207 208 210 212 214 215 217 220 222 223 224 226 227 228 229 230 234 238 240 243 245 246 247 249 252 255 256 265 266 267 268 270 271 274 275 280 281 282 284 286 287 289 291 292 298 300 304 309 310 311 312 315 316 317 320 322 325 327 330 333 334 336 339 340 344 348 350 351 352 354 355 357 360 361 362 364 365 366 367 368 369 370 371 372 373 374 375 376 377 379 380 381 384 385 386 389 390 397 398 399 400 401 402 403 404 405 406 407 408 410 416 417 418 419 420 421 422 423 424 425 427 428 429 430 431 432 434 436 444 445 446 447 448 452 453 454 455 456 457 459 460 462 463 464 465 467 468 470 472 473 474 475 476 478 481 482 485 486 490 491 493 495 539 540 541 542 543 544 545 546 548 549 552 553 555 557 559 560 561 562 563 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 581 582 584 585 586 587 588 589 590 591 592 593 594 596 597 598 599 600 601 602 603 604 605 606 609 610 662 679 687 782 783 784 785 809 810 829 903 906 907 909 911 1110 1113 1114 1116 1117 1120 1125 1128 1129 1130 1139 1140 1146 1150 1151 1154 1159 1160
semPaths(bifactor.fit, whatLabels = "std", layout = "tree")

summary(bifactor.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after  62 iterations
## 
##                                                   Used       Total
##   Number of observations                           842        1160
## 
##   Number of missing patterns                         4
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic             1620.339
##   Degrees of freedom                               230
##   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:
##   Definate =~
##     APSI_2            0.852    0.034   25.372    0.000    0.852    0.771
##     APSI_4            0.975    0.035   27.507    0.000    0.975    0.814
##     PWB_8             0.816    0.046   17.692    0.000    0.816    0.586
##     APSI_7            0.863    0.035   25.000    0.000    0.863    0.764
##     APSI_8            0.975    0.036   27.206    0.000    0.975    0.808
##     APSI_5            0.700    0.033   20.914    0.000    0.700    0.670
##     APSI_1            1.013    0.035   28.590    0.000    1.013    0.835
##     LET_2             0.641    0.037   17.538    0.000    0.641    0.580
##   Tend =~
##     PWB_2             0.627    0.052   12.097    0.000    0.627    0.435
##     PWB_9             0.542    0.052   10.415    0.000    0.542    0.380
##     PWB_3             1.300    0.049   26.669    0.000    1.300    0.822
##     PWB_5             1.222    0.051   23.788    0.000    1.222    0.757
##     LET_1             0.889    0.045   19.633    0.000    0.889    0.653
##     APSI_6            1.087    0.046   23.889    0.000    1.087    0.760
##   MLQP =~
##     MLQ_4             1.217    0.049   24.724    0.000    1.217    0.768
##     MLQ_5             1.123    0.045   24.819    0.000    1.123    0.770
##     MLQ_6             1.314    0.052   25.349    0.000    1.314    0.782
##     MLQ_1             1.362    0.051   26.452    0.000    1.362    0.806
##   MLQS =~
##     MLQ_2             1.301    0.048   26.984    0.000    1.301    0.809
##     MLQ_3             1.163    0.049   23.887    0.000    1.163    0.743
##     MLQ_7             1.133    0.049   22.902    0.000    1.133    0.720
##     MLQ_8             1.161    0.049   23.663    0.000    1.161    0.737
##     MLQ_10            1.361    0.051   26.436    0.000    1.361    0.797
## 
## Covariances:
##   Definate ~~
##     Tend              0.000                               0.000    0.000
##     MLQP              0.000                               0.000    0.000
##     MLQS              0.000                               0.000    0.000
##   Tend ~~
##     MLQP              0.000                               0.000    0.000
##   MLQP ~~
##     MLQS              0.000                               0.000    0.000
##   Tend ~~
##     MLQS              0.000                               0.000    0.000
## 
## Intercepts:
##     APSI_2            3.938    0.039  101.591    0.000    3.938    3.565
##     APSI_4            3.868    0.042   92.024    0.000    3.868    3.228
##     PWB_8             4.360    0.049   89.437    0.000    4.360    3.128
##     APSI_7            3.921    0.040   98.855    0.000    3.921    3.469
##     APSI_8            3.871    0.042   91.430    0.000    3.871    3.207
##     APSI_5            4.189    0.037  114.115    0.000    4.189    4.007
##     APSI_1            3.752    0.043   88.120    0.000    3.752    3.090
##     LET_2             3.906    0.038  101.752    0.000    3.906    3.534
##     PWB_2             3.130    0.050   62.065    0.000    3.130    2.171
##     PWB_9             2.202    0.050   44.059    0.000    2.202    1.542
##     PWB_3             2.848    0.055   51.546    0.000    2.848    1.800
##     PWB_5             2.877    0.056   51.010    0.000    2.877    1.782
##     LET_1             2.479    0.047   52.385    0.000    2.479    1.819
##     APSI_6            2.893    0.050   57.730    0.000    2.893    2.023
##     MLQ_4             4.985    0.055   91.352    0.000    4.985    3.148
##     MLQ_5             5.242    0.050  104.254    0.000    5.242    3.593
##     MLQ_6             4.786    0.058   82.650    0.000    4.786    2.848
##     MLQ_1             4.700    0.058   80.722    0.000    4.700    2.782
##     MLQ_2             5.368    0.055   96.855    0.000    5.368    3.338
##     MLQ_3             5.249    0.054   97.252    0.000    5.249    3.352
##     MLQ_7             5.183    0.054   95.553    0.000    5.183    3.293
##     MLQ_8             5.316    0.054   97.955    0.000    5.316    3.376
##     MLQ_10            5.058    0.059   85.972    0.000    5.058    2.963
##     Definate          0.000                               0.000    0.000
##     Tend              0.000                               0.000    0.000
##     MLQP              0.000                               0.000    0.000
##     MLQS              0.000                               0.000    0.000
## 
## Variances:
##     APSI_2            0.494    0.029                      0.494    0.405
##     APSI_4            0.485    0.030                      0.485    0.338
##     PWB_8             1.276    0.067                      1.276    0.657
##     APSI_7            0.532    0.031                      0.532    0.417
##     APSI_8            0.505    0.031                      0.505    0.347
##     APSI_5            0.603    0.033                      0.603    0.552
##     APSI_1            0.447    0.029                      0.447    0.303
##     LET_2             0.810    0.042                      0.810    0.663
##     PWB_2             1.684    0.087                      1.684    0.811
##     PWB_9             1.746    0.089                      1.746    0.856
##     PWB_3             0.811    0.063                      0.811    0.324
##     PWB_5             1.113    0.072                      1.113    0.427
##     LET_1             1.066    0.060                      1.066    0.574
##     APSI_6            0.863    0.057                      0.863    0.422
##     MLQ_4             1.027    0.066                      1.027    0.410
##     MLQ_5             0.868    0.056                      0.868    0.408
##     MLQ_6             1.096    0.073                      1.096    0.388
##     MLQ_1             0.998    0.071                      0.998    0.350
##     MLQ_2             0.895    0.060                      0.895    0.346
##     MLQ_3             1.101    0.065                      1.101    0.449
##     MLQ_7             1.194    0.069                      1.194    0.482
##     MLQ_8             1.133    0.067                      1.133    0.457
##     MLQ_10            1.061    0.070                      1.061    0.364
##     Definate          1.000                               1.000    1.000
##     Tend              1.000                               1.000    1.000
##     MLQP              1.000                               1.000    1.000
##     MLQS              1.000                               1.000    1.000
## 
## R-Square:
## 
##     APSI_2            0.595
##     APSI_4            0.662
##     PWB_8             0.343
##     APSI_7            0.583
##     APSI_8            0.653
##     APSI_5            0.448
##     APSI_1            0.697
##     LET_2             0.337
##     PWB_2             0.189
##     PWB_9             0.144
##     PWB_3             0.676
##     PWB_5             0.573
##     LET_1             0.426
##     APSI_6            0.578
##     MLQ_4             0.590
##     MLQ_5             0.592
##     MLQ_6             0.612
##     MLQ_1             0.650
##     MLQ_2             0.654
##     MLQ_3             0.551
##     MLQ_7             0.518
##     MLQ_8             0.543
##     MLQ_10            0.636
modindices(bifactor.fit, sort. = TRUE, minimum.value = 3.84)
##          lhs op    rhs      mi    epc sepc.lv sepc.all sepc.nox
## 1   Definate ~~   MLQP 292.062  0.672   0.672    0.672    0.672
## 2       Tend ~~   MLQP 104.730 -0.415  -0.415   -0.415   -0.415
## 3   Definate =~  MLQ_6  65.995  0.351   0.351    0.209    0.209
## 4      PWB_2 ~~  PWB_9  60.164  0.483   0.483    0.235    0.235
## 5   Definate =~  MLQ_4  59.175  0.318   0.318    0.201    0.201
## 6       Tend =~  MLQ_5  45.026 -0.263  -0.263   -0.180   -0.180
## 7       MLQP =~  LET_1  42.220 -0.266  -0.266   -0.195   -0.195
## 8   Definate =~ MLQ_10  35.869 -0.255  -0.255   -0.149   -0.149
## 9     APSI_2 ~~ APSI_7  32.777 -0.124  -0.124   -0.099   -0.099
## 10     PWB_9 ~~  MLQ_1  31.013  0.302   0.302    0.125    0.125
## 11     LET_1 ~~ MLQ_10  28.892  0.238   0.238    0.102    0.102
## 12  Definate =~  MLQ_3  28.031  0.220   0.220    0.141    0.141
## 13    APSI_4 ~~ APSI_7  26.941  0.117   0.117    0.086    0.086
## 14      MLQP =~ MLQ_10  26.237 -0.221  -0.221   -0.129   -0.129
## 15      Tend =~  PWB_8  25.923 -0.223  -0.223   -0.160   -0.160
## 16      Tend ~~   MLQS  24.449  0.199   0.199    0.199    0.199
## 17      Tend =~  MLQ_1  23.999 -0.214  -0.214   -0.126   -0.126
## 18    APSI_5 ~~ APSI_6  23.327  0.142   0.142    0.095    0.095
## 19      MLQS =~  LET_1  22.911  0.194   0.194    0.143    0.143
## 20    APSI_7 ~~ APSI_8  21.557  0.106   0.106    0.077    0.077
## 21  Definate =~  LET_1  21.379 -0.185  -0.185   -0.136   -0.136
## 22      MLQP =~ APSI_6  20.554 -0.178  -0.178   -0.125   -0.125
## 23      MLQS =~ APSI_7  20.203  0.131   0.131    0.116    0.116
## 24    APSI_7 ~~  PWB_5  19.468 -0.142  -0.142   -0.078   -0.078
## 25    APSI_6 ~~  MLQ_1  19.067 -0.184  -0.184   -0.076   -0.076
## 26      MLQP =~ APSI_1  18.414  0.121   0.121    0.100    0.100
## 27      MLQP =~  MLQ_7  18.197  0.186   0.186    0.118    0.118
## 28     MLQ_4 ~~  MLQ_6  18.098  0.259   0.259    0.097    0.097
## 29     MLQ_5 ~~  MLQ_1  18.097  0.247   0.247    0.100    0.100
## 30      MLQP =~  MLQ_3  17.778  0.178   0.178    0.114    0.114
## 31    APSI_5 ~~  PWB_9  17.671 -0.159  -0.159   -0.107   -0.107
## 32     PWB_2 ~~ MLQ_10  16.456  0.218   0.218    0.089    0.089
## 33    APSI_2 ~~ APSI_5  16.071  0.088   0.088    0.076    0.076
## 34     LET_2 ~~  PWB_3  15.716 -0.138  -0.138   -0.079   -0.079
## 35  Definate =~  MLQ_8  15.330  0.165   0.165    0.105    0.105
## 36     LET_2 ~~  MLQ_4  14.860  0.140   0.140    0.080    0.080
## 37    APSI_2 ~~ APSI_1  14.855  0.083   0.083    0.062    0.062
## 38      MLQP =~  LET_2  13.708  0.128   0.128    0.116    0.116
## 39    APSI_5 ~~  MLQ_1  13.323 -0.120  -0.120   -0.068   -0.068
## 40      MLQP =~  MLQ_8  13.282  0.156   0.156    0.099    0.099
## 41     MLQ_6 ~~ MLQ_10  12.813 -0.169  -0.169   -0.059   -0.059
## 42      MLQP =~  PWB_8  12.752  0.156   0.156    0.112    0.112
## 43    APSI_2 ~~  LET_1  12.720 -0.103  -0.103   -0.068   -0.068
## 44     PWB_9 ~~ APSI_6  12.666 -0.181  -0.181   -0.089   -0.089
## 45     MLQ_6 ~~  MLQ_3  12.331  0.163   0.163    0.062    0.062
## 46     PWB_2 ~~  MLQ_2  11.591 -0.170  -0.170   -0.073   -0.073
## 47  Definate =~ APSI_6  11.477  0.129   0.129    0.090    0.090
## 48     PWB_2 ~~  MLQ_1  10.432  0.173   0.173    0.071    0.071
## 49      Tend =~  LET_2  10.406 -0.112  -0.112   -0.101   -0.101
## 50      MLQS =~ APSI_5  10.266  0.097   0.097    0.093    0.093
## 51     MLQ_3 ~~ MLQ_10  10.139  0.172   0.172    0.064    0.064
## 52    APSI_1 ~~  LET_2  10.132  0.080   0.080    0.059    0.059
## 53    APSI_7 ~~  MLQ_7  10.032  0.102   0.102    0.057    0.057
## 54      Tend =~ APSI_5   9.949  0.097   0.097    0.092    0.092
## 55     LET_1 ~~ APSI_6   9.701  0.142   0.142    0.073    0.073
## 56    APSI_2 ~~  PWB_5   9.652  0.096   0.096    0.054    0.054
## 57    APSI_2 ~~  LET_2   9.422  0.076   0.076    0.063    0.063
## 58    APSI_6 ~~  MLQ_5   9.338 -0.116  -0.116   -0.056   -0.056
## 59      MLQP =~  MLQ_2   9.281 -0.122  -0.122   -0.076   -0.076
## 60      Tend =~  MLQ_2   9.253  0.124   0.124    0.077    0.077
## 61     LET_2 ~~ APSI_6   8.913  0.100   0.100    0.063    0.063
## 62     MLQ_4 ~~  MLQ_1   8.787 -0.187  -0.187   -0.070   -0.070
## 63     MLQ_5 ~~  MLQ_6   8.787 -0.166  -0.166   -0.068   -0.068
## 64     MLQ_4 ~~  MLQ_3   8.770  0.131   0.131    0.053    0.053
## 65    APSI_2 ~~  MLQ_1   8.712  0.090   0.090    0.048    0.048
## 66    APSI_5 ~~  MLQ_7   8.660 -0.098  -0.098   -0.059   -0.059
## 67     PWB_2 ~~  MLQ_6   8.381 -0.158  -0.158   -0.065   -0.065
## 68     LET_2 ~~  LET_1   8.283 -0.101  -0.101   -0.067   -0.067
## 69      MLQP =~  PWB_9   8.066  0.143   0.143    0.100    0.100
## 70     PWB_5 ~~  MLQ_7   8.061 -0.137  -0.137   -0.054   -0.054
## 71    APSI_6 ~~  MLQ_3   7.847  0.116   0.116    0.052    0.052
## 72      Tend =~ MLQ_10   7.627  0.121   0.121    0.071    0.071
## 73     LET_2 ~~  MLQ_3   7.513  0.100   0.100    0.058    0.058
## 74     PWB_8 ~~  LET_1   7.496 -0.121  -0.121   -0.064   -0.064
## 75      MLQP =~ APSI_2   7.440  0.078   0.078    0.070    0.070
## 76    APSI_7 ~~  LET_1   7.404  0.081   0.081    0.053    0.053
## 77     LET_1 ~~  MLQ_6   7.380 -0.122  -0.122   -0.053   -0.053
## 78    APSI_1 ~~  LET_1   7.306 -0.077  -0.077   -0.047   -0.047
## 79     MLQ_2 ~~  MLQ_3   7.217 -0.137  -0.137   -0.054   -0.054
## 80     PWB_2 ~~ APSI_6   7.205 -0.136  -0.136   -0.066   -0.066
## 81    APSI_4 ~~ APSI_8   7.201  0.062   0.062    0.043    0.043
## 82    APSI_4 ~~  LET_2   7.110 -0.068  -0.068   -0.051   -0.051
## 83      MLQP =~ APSI_5   7.017 -0.081  -0.081   -0.077   -0.077
## 84    APSI_1 ~~  MLQ_6   6.994  0.082   0.082    0.040    0.040
## 85     MLQ_4 ~~ MLQ_10   6.979 -0.120  -0.120   -0.044   -0.044
## 86  Definate =~  PWB_2   6.936 -0.128  -0.128   -0.088   -0.088
## 87      MLQP =~ APSI_4   6.787  0.075   0.075    0.063    0.063
## 88      MLQP ~~   MLQS   6.734  0.103   0.103    0.103    0.103
## 89    APSI_8 ~~  MLQ_6   6.685  0.083   0.083    0.041    0.041
## 90    APSI_8 ~~  LET_2   6.670 -0.067  -0.067   -0.050   -0.050
## 91    APSI_1 ~~ MLQ_10   6.616 -0.078  -0.078   -0.038   -0.038
## 92     PWB_3 ~~  MLQ_7   6.536  0.113   0.113    0.045    0.045
## 93  Definate ~~   MLQS   6.416  0.099   0.099    0.099    0.099
## 94    APSI_8 ~~ APSI_5   6.323 -0.058  -0.058   -0.046   -0.046
## 95    APSI_5 ~~  MLQ_4   6.272  0.080   0.080    0.048    0.048
## 96     PWB_9 ~~  LET_1   6.106 -0.129  -0.129   -0.066   -0.066
## 97    APSI_1 ~~  MLQ_4   6.068  0.073   0.073    0.038    0.038
## 98    APSI_8 ~~ APSI_1   6.067 -0.056  -0.056   -0.039   -0.039
## 99      MLQS =~ APSI_6   5.996  0.095   0.095    0.067    0.067
## 100    PWB_5 ~~  MLQ_2   5.950  0.108   0.108    0.042    0.042
## 101   APSI_7 ~~ APSI_1   5.945 -0.054  -0.054   -0.040   -0.040
## 102     Tend =~  MLQ_6   5.943  0.109   0.109    0.065    0.065
## 103    PWB_3 ~~ MLQ_10   5.860 -0.106  -0.106   -0.039   -0.039
## 104    PWB_9 ~~  MLQ_2   5.566 -0.119  -0.119   -0.052   -0.052
## 105   APSI_2 ~~ APSI_4   5.480 -0.051  -0.051   -0.039   -0.039
## 106    LET_2 ~~ MLQ_10   5.450 -0.087  -0.087   -0.046   -0.046
## 107   APSI_7 ~~  MLQ_8   5.382  0.073   0.073    0.041    0.041
## 108   APSI_6 ~~  MLQ_6   4.914  0.096   0.096    0.040    0.040
## 109    MLQ_7 ~~ MLQ_10   4.873 -0.120  -0.120   -0.045   -0.045
## 110    PWB_5 ~~  LET_1   4.855 -0.113  -0.113   -0.051   -0.051
## 111   APSI_4 ~~ APSI_6   4.806 -0.061  -0.061   -0.036   -0.036
## 112     MLQS =~ APSI_2   4.577 -0.060  -0.060   -0.055   -0.055
## 113    PWB_5 ~~  MLQ_6   4.375  0.102   0.102    0.037    0.037
## 114    MLQ_1 ~~  MLQ_7   4.369  0.098   0.098    0.037    0.037
## 115    PWB_9 ~~  MLQ_8   4.298 -0.112  -0.112   -0.050   -0.050
## 116    PWB_5 ~~  MLQ_5   4.199 -0.088  -0.088   -0.037   -0.037
## 117    PWB_9 ~~  MLQ_4   4.144 -0.108  -0.108   -0.048   -0.048
## 118   APSI_4 ~~ APSI_5   4.075 -0.046  -0.046   -0.036   -0.036
## 119     MLQS =~  MLQ_4   3.997  0.083   0.083    0.053    0.053
## 120    PWB_8 ~~  MLQ_5   3.930  0.084   0.084    0.041    0.041
## 121    LET_1 ~~  MLQ_4   3.852 -0.084  -0.084   -0.039   -0.039
## 122    PWB_3 ~~  MLQ_3   3.846 -0.084  -0.084   -0.034   -0.034
fitmeasures(bifactor.fit)
##                npar                fmin               chisq 
##              69.000               0.962            1620.339 
##                  df              pvalue      baseline.chisq 
##             230.000               0.000            9855.572 
##         baseline.df     baseline.pvalue                 cfi 
##             253.000               0.000               0.855 
##                 tli                nnfi                 rfi 
##               0.841               0.841               0.819 
##                 nfi                pnfi                 ifi 
##               0.836               0.760               0.856 
##                 rni                logl   unrestricted.logl 
##               0.855          -29305.421          -28495.252 
##                 aic                 bic              ntotal 
##           58748.843           59075.612             842.000 
##                bic2               rmsea      rmsea.ci.lower 
##           58856.490               0.085               0.081 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.089               0.000               0.326 
##          rmr_nomean                srmr        srmr_bentler 
##               0.340               0.162               0.162 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.168               0.162               0.168 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.162               0.168             139.422 
##               cn_01                 gfi                agfi 
##             147.963               0.975               0.967 
##                pgfi                 mfi                ecvi 
##               0.750               0.438                  NA
bifactor1.model = 'Definate =~ APSI_2 + APSI_4 +  PWB_8 + APSI_7 + APSI_8 +  APSI_5 +  APSI_1 + LET_2
                Tend   =~ PWB_2 + PWB_9 + PWB_3 + PWB_5 + LET_1 + APSI_6
              MLQP =~ MLQ_4 + MLQ_5 + MLQ_6 + MLQ_1
              MLQS =~ MLQ_2 + MLQ_3 + MLQ_7 + MLQ_8 + MLQ_10
              Purpose =~ APSI_2 + APSI_4 +  PWB_8 + APSI_7 + APSI_8 +  APSI_5 +  APSI_1 + LET_2 + PWB_2 + PWB_9 + PWB_3 + PWB_5 + LET_1 + APSI_6 + MLQ_4 + MLQ_5 + MLQ_6 + MLQ_1 + MLQ_2 + MLQ_3 + MLQ_7 + MLQ_8 + MLQ_10'
              
              bifactor1.fit=cfa(bifactor1.model, data=all_surveys, missing = "fiml", std.lv = T)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be removed:
##   17 22 23 24 28 29 43 45 78 79 80 81 85 94 110 111 112 116 121 122 123 124 125 128 129 130 131 133 135 137 138 140 147 151 152 155 156 162 166 169 170 171 172 173 174 176 177 179 180 183 184 186 187 188 189 192 194 195 197 200 202 203 204 207 208 210 212 214 215 217 220 222 223 224 226 227 228 229 230 234 238 240 243 245 246 247 249 252 255 256 265 266 267 268 270 271 274 275 280 281 282 284 286 287 289 291 292 298 300 304 309 310 311 312 315 316 317 320 322 325 327 330 333 334 336 339 340 344 348 350 351 352 354 355 357 360 361 362 364 365 366 367 368 369 370 371 372 373 374 375 376 377 379 380 381 384 385 386 389 390 397 398 399 400 401 402 403 404 405 406 407 408 410 416 417 418 419 420 421 422 423 424 425 427 428 429 430 431 432 434 436 444 445 446 447 448 452 453 454 455 456 457 459 460 462 463 464 465 467 468 470 472 473 474 475 476 478 481 482 485 486 490 491 493 495 539 540 541 542 543 544 545 546 548 549 552 553 555 557 559 560 561 562 563 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 581 582 584 585 586 587 588 589 590 591 592 593 594 596 597 598 599 600 601 602 603 604 605 606 609 610 662 679 687 782 783 784 785 809 810 829 903 906 907 909 911 1110 1113 1114 1116 1117 1120 1125 1128 1129 1130 1139 1140 1146 1150 1151 1154 1159 1160
## Warning in lavaan::lavaan(model = bifactor1.model, data = all_surveys,
## std.lv = T, : lavaan WARNING: covariance matrix of latent variables is not
## positive definite; use inspect(fit,"cov.lv") to investigate.
semPaths(bifactor1.fit, whatLabels = "std", layout = "tree")
## Warning in lavaan(slotOptions = object@Options, slotParTable =
## object@ParTable, : lavaan WARNING: covariance matrix of latent variables is
## not positive definite; use inspect(fit,"cov.lv") to investigate.

summary(bifactor1.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after 123 iterations
## 
##                                                   Used       Total
##   Number of observations                           842        1160
## 
##   Number of missing patterns                         4
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic              711.323
##   Degrees of freedom                               197
##   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:
##   Definate =~
##     APSI_2            0.138    5.171    0.027    0.979    0.138    0.125
##     APSI_4            0.138    5.167    0.027    0.979    0.138    0.115
##     PWB_8             0.478   17.905    0.027    0.979    0.478    0.342
##     APSI_7           -0.314   11.752   -0.027    0.979   -0.314   -0.277
##     APSI_8           -0.195    7.318   -0.027    0.979   -0.195   -0.162
##     APSI_5           -0.637   23.877   -0.027    0.979   -0.637   -0.609
##     APSI_1            0.020    0.755    0.026    0.979    0.020    0.016
##     LET_2             0.100    3.743    0.027    0.979    0.100    0.090
##   Tend =~
##     PWB_2             0.762   18.786    0.041    0.968    0.762    0.528
##     PWB_9             0.625   15.407    0.041    0.968    0.625    0.437
##     PWB_3             1.605   39.589    0.041    0.968    1.605    1.015
##     PWB_5             1.505   37.124    0.041    0.968    1.505    0.933
##     LET_1             1.156   28.509    0.041    0.968    1.156    0.849
##     APSI_6            1.433   35.331    0.041    0.968    1.433    1.002
##   MLQP =~
##     MLQ_4             0.749    2.381    0.315    0.753    0.749    0.473
##     MLQ_5             0.948    3.011    0.315    0.753    0.948    0.649
##     MLQ_6             0.783    2.489    0.315    0.753    0.783    0.466
##     MLQ_1             1.170    3.717    0.315    0.753    1.170    0.693
##   MLQS =~
##     MLQ_2             1.449       NA                      1.449    0.901
##     MLQ_3             1.287       NA                      1.287    0.822
##     MLQ_7             1.254       NA                      1.254    0.797
##     MLQ_8             1.277       NA                      1.277    0.811
##     MLQ_10            1.561       NA                      1.561    0.914
##   Purpose =~
##     APSI_2            0.994    5.033    0.197    0.843    0.994    0.898
##     APSI_4            1.110    5.029    0.221    0.825    1.110    0.925
##     PWB_8             1.306   17.425    0.075    0.940    1.306    0.936
##     APSI_7            0.537   11.437    0.047    0.963    0.537    0.475
##     APSI_8            0.772    7.122    0.108    0.914    0.772    0.639
##     APSI_5            0.045   23.237    0.002    0.998    0.045    0.043
##     APSI_1            1.046    0.738    1.417    0.156    1.046    0.860
##     LET_2             0.756    3.643    0.207    0.836    0.756    0.683
##     PWB_2             0.330   30.811    0.011    0.991    0.330    0.229
##     PWB_9             0.315   25.269    0.012    0.990    0.315    0.221
##     PWB_3             1.010   64.929    0.016    0.988    1.010    0.638
##     PWB_5             0.889   60.886    0.015    0.988    0.889    0.551
##     LET_1             0.506   46.757    0.011    0.991    0.506    0.372
##     APSI_6            0.941   57.945    0.016    0.987    0.941    0.659
##     MLQ_4             1.079   18.591    0.058    0.954    1.079    0.681
##     MLQ_5             0.795   23.509    0.034    0.973    0.795    0.545
##     MLQ_6             1.173   19.429    0.060    0.952    1.173    0.698
##     MLQ_1             0.919   29.028    0.032    0.975    0.919    0.544
##     MLQ_2             0.717       NA                      0.717    0.446
##     MLQ_3             0.858       NA                      0.858    0.548
##     MLQ_7             0.708       NA                      0.708    0.450
##     MLQ_8             0.805       NA                      0.805    0.511
##     MLQ_10            0.597       NA                      0.597    0.350
## 
## Covariances:
##   Definate ~~
##     Tend              0.471   30.110    0.016    0.988    0.471    0.471
##     MLQP              0.382   26.603    0.014    0.989    0.382    0.382
##     MLQS              0.294       NA                      0.294    0.294
##     Purpose          -1.028    2.038   -0.504    0.614   -1.028   -1.028
##   Tend ~~
##     MLQP             -0.369       NA                     -0.369   -0.369
##     MLQS              0.421   12.119    0.035    0.972    0.421    0.421
##     Purpose          -0.610   25.408   -0.024    0.981   -0.610   -0.610
##   MLQP ~~
##     MLQS              0.107    7.475    0.014    0.989    0.107    0.107
##     Purpose          -0.128   24.402   -0.005    0.996   -0.128   -0.128
##   MLQS ~~
##     Purpose          -0.450       NA                     -0.450   -0.450
## 
## Intercepts:
##     APSI_2            3.937    0.039  101.864    0.000    3.937    3.558
##     APSI_4            3.867    0.042   92.285    0.000    3.867    3.221
##     PWB_8             4.359    0.049   89.563    0.000    4.359    3.124
##     APSI_7            3.919    0.040   99.081    0.000    3.919    3.464
##     APSI_8            3.869    0.042   91.669    0.000    3.869    3.202
##     APSI_5            4.187    0.037  114.345    0.000    4.187    4.004
##     APSI_1            3.750    0.042   88.403    0.000    3.750    3.084
##     LET_2             3.907    0.038  101.891    0.000    3.907    3.534
##     PWB_2             3.129    0.050   62.084    0.000    3.129    2.171
##     PWB_9             2.201    0.050   44.055    0.000    2.201    1.541
##     PWB_3             2.845    0.055   51.584    0.000    2.845    1.799
##     PWB_5             2.875    0.056   51.042    0.000    2.875    1.781
##     LET_1             2.478    0.047   52.422    0.000    2.478    1.819
##     APSI_6            2.891    0.050   57.818    0.000    2.891    2.022
##     MLQ_4             4.985    0.055   91.351    0.000    4.985    3.148
##     MLQ_5             5.242    0.050  104.254    0.000    5.242    3.593
##     MLQ_6             4.786    0.058   82.650    0.000    4.786    2.848
##     MLQ_1             4.700    0.058   80.722    0.000    4.700    2.782
##     MLQ_2             5.368    0.055   96.855    0.000    5.368    3.338
##     MLQ_3             5.249    0.054   97.252    0.000    5.249    3.352
##     MLQ_7             5.183    0.054   95.553    0.000    5.183    3.293
##     MLQ_8             5.316    0.054   97.955    0.000    5.316    3.376
##     MLQ_10            5.058    0.059   85.972    0.000    5.058    2.963
##     Definate          0.000                               0.000    0.000
##     Tend              0.000                               0.000    0.000
##     MLQP              0.000                               0.000    0.000
##     MLQS              0.000                               0.000    0.000
##     Purpose           0.000                               0.000    0.000
## 
## Variances:
##     APSI_2            0.499    0.029                      0.499    0.408
##     APSI_4            0.504    0.031                      0.504    0.349
##     PWB_8             1.296    0.071                      1.296    0.666
##     APSI_7            0.547    0.032                      0.547    0.428
##     APSI_8            0.516    0.031                      0.516    0.353
##     APSI_5            0.627    0.045                      0.627    0.573
##     APSI_1            0.426    0.027                      0.426    0.288
##     LET_2             0.797    0.041                      0.797    0.652
##     PWB_2             1.696    0.087                      1.696    0.816
##     PWB_9             1.791    0.091                      1.791    0.878
##     PWB_3             0.881    0.063                      0.881    0.352
##     PWB_5             1.181    0.073                      1.181    0.453
##     LET_1             0.977    0.056                      0.977    0.526
##     APSI_6            0.749    0.053                      0.749    0.367
##     MLQ_4             0.989    0.057                      0.989    0.394
##     MLQ_5             0.793    0.054                      0.793    0.372
##     MLQ_6             1.070    0.062                      1.070    0.379
##     MLQ_1             0.916    0.071                      0.916    0.321
##     MLQ_2             0.908    0.060                      0.908    0.351
##     MLQ_3             1.054    0.063                      1.054    0.429
##     MLQ_7             1.202    0.069                      1.202    0.485
##     MLQ_8             1.127    0.066                      1.127    0.454
##     MLQ_10            0.961    0.066                      0.961    0.330
##     Definate          1.000                               1.000    1.000
##     Tend              1.000                               1.000    1.000
##     MLQP              1.000                               1.000    1.000
##     MLQS              1.000                               1.000    1.000
##     Purpose           1.000                               1.000    1.000
## 
## R-Square:
## 
##     APSI_2            0.592
##     APSI_4            0.651
##     PWB_8             0.334
##     APSI_7            0.572
##     APSI_8            0.647
##     APSI_5            0.427
##     APSI_1            0.712
##     LET_2             0.348
##     PWB_2             0.184
##     PWB_9             0.122
##     PWB_3             0.648
##     PWB_5             0.547
##     LET_1             0.474
##     APSI_6            0.633
##     MLQ_4             0.606
##     MLQ_5             0.628
##     MLQ_6             0.621
##     MLQ_1             0.679
##     MLQ_2             0.649
##     MLQ_3             0.571
##     MLQ_7             0.515
##     MLQ_8             0.546
##     MLQ_10            0.670
###modindices(bifactor1.fit, sort. = TRUE, minimum.value = 3.84)
fitmeasures(bifactor1.fit)
##                npar                fmin               chisq 
##             102.000               0.422             711.323 
##                  df              pvalue      baseline.chisq 
##             197.000               0.000            9855.572 
##         baseline.df     baseline.pvalue                 cfi 
##             253.000               0.000               0.946 
##                 tli                nnfi                 rfi 
##               0.931               0.931               0.907 
##                 nfi                pnfi                 ifi 
##               0.928               0.722               0.947 
##                 rni                logl   unrestricted.logl 
##               0.946          -28850.914          -28495.252 
##                 aic                 bic              ntotal 
##           57905.827           58388.877             842.000 
##                bic2               rmsea      rmsea.ci.lower 
##           58064.957               0.056               0.051 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.060               0.017               0.084 
##          rmr_nomean                srmr        srmr_bentler 
##               0.087               0.039               0.039 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.041               0.039               0.041 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.039               0.041             274.137 
##               cn_01                 gfi                agfi 
##             292.305               0.986               0.978 
##                pgfi                 mfi                ecvi 
##               0.649               0.737                  NA

see whether purpose scales corrolate with ADSQII

Corrolation = 'Definate =~ APSI_2 + APSI_4 +  PWB_8 + APSI_7 + APSI_8 +  APSI_5 +  APSI_1 + LET_2
                Tend   =~ PWB_2 + PWB_9 + PWB_3 + PWB_5 + LET_1 + APSI_6
              MLQP =~ MLQ_4 + MLQ_5 + MLQ_6 + MLQ_1
              MLQS =~ MLQ_2 + MLQ_3 + MLQ_7 + MLQ_8 + MLQ_10
              English =~ ASDQII_1 + ASDQII_2 + ASDQII_3 + ASDQII_4 + ASDQII_5 
              Math =~ ASDQII_6 + ASDQII_7 + ASDQII_8 + ASDQII_9 + ASDQII_10              
              Science =~ ASDQII_11 + ASDQII_12 + ASDQII_13 + ASDQII_14 + ASDQII_15
              General =~ ASDQII_16 + ASDQII_17 + ASDQII_18 + ASDQII_19 + ASDQII_20'
                  corrolation.fit=cfa(Corrolation, data=all_surveys, missing = "fiml", std.lv = T)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be removed:
##   17 22 23 24 28 29 43 45 78 79 85 94 110 111 112 116 123 128 129 152 170 183 184 220 226 234 240 243 247 271 275 292 304 311 312 327 360 361 364 365 368 445 457 459 460 463 470 478 539 540 541 545 546 548 549 553 555 557 560 563 573 575 577 584 585 587 588 589 591 592 596 598 599 600 602 603 606 610 662 679 687 782 783 784 785 809 810 829 903 1110 1113 1114 1117 1120 1125 1130 1146 1150 1159 1160
semPaths(corrolation.fit, whatLabels = "std", layout = "tree")

summary(corrolation.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after 125 iterations
## 
##                                                   Used       Total
##   Number of observations                          1060        1160
## 
##   Number of missing patterns                         5
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic             2494.296
##   Degrees of freedom                               832
##   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:
##   Definate =~
##     APSI_2            0.856    0.033   25.568    0.000    0.856    0.774
##     APSI_4            0.977    0.035   27.578    0.000    0.977    0.814
##     PWB_8             0.822    0.046   17.832    0.000    0.822    0.589
##     APSI_7            0.857    0.035   24.780    0.000    0.857    0.758
##     APSI_8            0.972    0.036   27.086    0.000    0.972    0.804
##     APSI_5            0.693    0.034   20.670    0.000    0.693    0.663
##     APSI_1            1.023    0.035   29.053    0.000    1.023    0.842
##     LET_2             0.650    0.036   17.870    0.000    0.650    0.588
##   Tend =~
##     PWB_2             0.623    0.052   11.998    0.000    0.623    0.432
##     PWB_9             0.513    0.052    9.785    0.000    0.513    0.359
##     PWB_3             1.270    0.049   25.866    0.000    1.270    0.801
##     PWB_5             1.207    0.052   23.406    0.000    1.207    0.747
##     LET_1             0.919    0.045   20.481    0.000    0.919    0.674
##     APSI_6            1.127    0.045   25.074    0.000    1.127    0.787
##   MLQP =~
##     MLQ_4             1.251    0.048   26.079    0.000    1.251    0.789
##     MLQ_5             1.121    0.045   24.963    0.000    1.121    0.767
##     MLQ_6             1.333    0.051   26.229    0.000    1.333    0.792
##     MLQ_1             1.320    0.052   25.613    0.000    1.320    0.780
##   MLQS =~
##     MLQ_2             1.298    0.048   26.913    0.000    1.298    0.807
##     MLQ_3             1.167    0.049   24.003    0.000    1.167    0.745
##     MLQ_7             1.136    0.049   22.999    0.000    1.136    0.722
##     MLQ_8             1.161    0.049   23.669    0.000    1.161    0.737
##     MLQ_10            1.358    0.052   26.343    0.000    1.358    0.795
##   English =~
##     ASDQII_1          1.030    0.029   35.977    0.000    1.030    0.881
##     ASDQII_2          1.027    0.030   34.343    0.000    1.027    0.856
##     ASDQII_3          1.038    0.029   35.676    0.000    1.038    0.876
##     ASDQII_4          1.019    0.030   33.446    0.000    1.019    0.841
##     ASDQII_5          1.033    0.031   33.833    0.000    1.033    0.848
##   Math =~
##     ASDQII_6          1.315    0.035   37.413    0.000    1.315    0.897
##     ASDQII_7          1.363    0.036   38.119    0.000    1.363    0.906
##     ASDQII_8          1.380    0.035   39.496    0.000    1.380    0.925
##     ASDQII_9          1.332    0.035   38.092    0.000    1.332    0.906
##     ASDQII_10         1.313    0.034   38.369    0.000    1.313    0.910
##   Science =~
##     ASDQII_11         1.183    0.031   38.360    0.000    1.183    0.911
##     ASDQII_12         1.180    0.032   37.345    0.000    1.180    0.897
##     ASDQII_13         1.236    0.033   37.495    0.000    1.236    0.899
##     ASDQII_14         1.190    0.032   37.231    0.000    1.190    0.895
##     ASDQII_15         1.196    0.032   36.841    0.000    1.196    0.889
##   General =~
##     ASDQII_16         0.977    0.030   33.065    0.000    0.977    0.835
##     ASDQII_17         0.976    0.029   34.099    0.000    0.976    0.852
##     ASDQII_18         0.962    0.028   34.114    0.000    0.962    0.852
##     ASDQII_19         0.906    0.028   32.134    0.000    0.906    0.820
##     ASDQII_20         0.976    0.029   33.434    0.000    0.976    0.841
## 
## Covariances:
##   Definate ~~
##     Tend             -0.017    0.040   -0.425    0.670   -0.017   -0.017
##     MLQP              0.687    0.024   29.053    0.000    0.687    0.687
##     MLQS              0.102    0.039    2.632    0.008    0.102    0.102
##     English           0.201    0.037    5.431    0.000    0.201    0.201
##     Math              0.163    0.037    4.456    0.000    0.163    0.163
##     Science           0.151    0.037    4.080    0.000    0.151    0.151
##     General           0.169    0.038    4.432    0.000    0.169    0.169
##   Tend ~~
##     MLQP             -0.420    0.035  -11.945    0.000   -0.420   -0.420
##     MLQS              0.203    0.039    5.178    0.000    0.203    0.203
##     English          -0.179    0.039   -4.621    0.000   -0.179   -0.179
##     Math             -0.203    0.038   -5.414    0.000   -0.203   -0.203
##     Science          -0.132    0.038   -3.445    0.001   -0.132   -0.132
##     General          -0.252    0.038   -6.561    0.000   -0.252   -0.252
##   MLQP ~~
##     MLQS              0.106    0.040    2.685    0.007    0.106    0.106
##     English           0.294    0.036    8.162    0.000    0.294    0.294
##     Math              0.176    0.037    4.723    0.000    0.176    0.176
##     Science           0.177    0.037    4.751    0.000    0.177    0.177
##     General           0.251    0.038    6.650    0.000    0.251    0.251
##   MLQS ~~
##     English           0.063    0.039    1.624    0.104    0.063    0.063
##     Math             -0.012    0.038   -0.309    0.757   -0.012   -0.012
##     Science           0.068    0.038    1.776    0.076    0.068    0.068
##     General           0.007    0.040    0.175    0.861    0.007    0.007
##   English ~~
##     Math              0.251    0.031    8.214    0.000    0.251    0.251
##     Science           0.403    0.028   14.648    0.000    0.403    0.403
##     General           0.696    0.018   38.029    0.000    0.696    0.696
##   Math ~~
##     Science           0.524    0.024   22.118    0.000    0.524    0.524
##     General           0.693    0.018   38.692    0.000    0.693    0.693
##   Science ~~
##     General           0.698    0.018   39.055    0.000    0.698    0.698
## 
## Intercepts:
##     APSI_2            3.938    0.039  102.155    0.000    3.938    3.561
##     APSI_4            3.869    0.042   92.587    0.000    3.869    3.224
##     PWB_8             4.360    0.049   89.693    0.000    4.360    3.126
##     APSI_7            3.921    0.039   99.370    0.000    3.921    3.466
##     APSI_8            3.871    0.042   91.971    0.000    3.871    3.204
##     APSI_5            4.189    0.037  114.566    0.000    4.189    4.004
##     APSI_1            3.752    0.042   88.706    0.000    3.752    3.087
##     LET_2             3.907    0.038  102.020    0.000    3.907    3.533
##     PWB_2             3.131    0.050   62.162    0.000    3.131    2.171
##     PWB_9             2.203    0.050   44.114    0.000    2.203    1.542
##     PWB_3             2.851    0.055   51.792    0.000    2.851    1.799
##     PWB_5             2.880    0.056   51.228    0.000    2.880    1.781
##     LET_1             2.482    0.047   52.568    0.000    2.482    1.820
##     APSI_6            2.896    0.050   58.022    0.000    2.896    2.022
##     MLQ_4             4.986    0.054   91.747    0.000    4.986    3.145
##     MLQ_5             5.244    0.050  104.677    0.000    5.244    3.589
##     MLQ_6             4.788    0.058   83.014    0.000    4.788    2.845
##     MLQ_1             4.701    0.058   81.068    0.000    4.701    2.779
##     MLQ_2             5.371    0.055   96.934    0.000    5.371    3.340
##     MLQ_3             5.252    0.054   97.322    0.000    5.252    3.353
##     MLQ_7             5.186    0.054   95.621    0.000    5.186    3.295
##     MLQ_8             5.319    0.054   98.026    0.000    5.319    3.377
##     MLQ_10            5.062    0.059   86.047    0.000    5.062    2.965
##     ASDQII_1          4.518    0.036  125.824    0.000    4.518    3.865
##     ASDQII_2          4.371    0.037  118.628    0.000    4.371    3.644
##     ASDQII_3          4.479    0.036  123.146    0.000    4.479    3.782
##     ASDQII_4          4.417    0.037  118.705    0.000    4.417    3.646
##     ASDQII_5          4.392    0.037  117.387    0.000    4.392    3.606
##     ASDQII_6          4.180    0.045   92.785    0.000    4.180    2.850
##     ASDQII_7          4.123    0.046   89.276    0.000    4.123    2.742
##     ASDQII_8          4.148    0.046   90.516    0.000    4.148    2.780
##     ASDQII_9          4.047    0.045   89.655    0.000    4.047    2.754
##     ASDQII_10         4.245    0.044   95.805    0.000    4.245    2.943
##     ASDQII_11         4.267    0.040  106.922    0.000    4.267    3.284
##     ASDQII_12         4.129    0.040  102.170    0.000    4.129    3.138
##     ASDQII_13         4.191    0.042   99.239    0.000    4.191    3.048
##     ASDQII_14         4.176    0.041  102.264    0.000    4.176    3.141
##     ASDQII_15         4.143    0.041  100.333    0.000    4.143    3.082
##     ASDQII_16         4.419    0.036  123.007    0.000    4.419    3.778
##     ASDQII_17         4.458    0.035  126.708    0.000    4.458    3.892
##     ASDQII_18         4.538    0.035  130.840    0.000    4.538    4.019
##     ASDQII_19         4.362    0.034  128.599    0.000    4.362    3.950
##     ASDQII_20         4.441    0.036  124.593    0.000    4.441    3.827
##     Definate          0.000                               0.000    0.000
##     Tend              0.000                               0.000    0.000
##     MLQP              0.000                               0.000    0.000
##     MLQS              0.000                               0.000    0.000
##     English           0.000                               0.000    0.000
##     Math              0.000                               0.000    0.000
##     Science           0.000                               0.000    0.000
##     General           0.000                               0.000    0.000
## 
## Variances:
##     APSI_2            0.490    0.028                      0.490    0.401
##     APSI_4            0.486    0.029                      0.486    0.337
##     PWB_8             1.270    0.066                      1.270    0.653
##     APSI_7            0.545    0.031                      0.545    0.426
##     APSI_8            0.515    0.031                      0.515    0.353
##     APSI_5            0.614    0.033                      0.614    0.561
##     APSI_1            0.431    0.027                      0.431    0.291
##     LET_2             0.801    0.041                      0.801    0.655
##     PWB_2             1.692    0.087                      1.692    0.814
##     PWB_9             1.779    0.090                      1.779    0.871
##     PWB_3             0.898    0.063                      0.898    0.358
##     PWB_5             1.157    0.073                      1.157    0.443
##     LET_1             1.016    0.058                      1.016    0.546
##     APSI_6            0.782    0.054                      0.782    0.381
##     MLQ_4             0.950    0.060                      0.950    0.378
##     MLQ_5             0.879    0.054                      0.879    0.412
##     MLQ_6             1.054    0.067                      1.054    0.372
##     MLQ_1             1.119    0.070                      1.119    0.391
##     MLQ_2             0.903    0.060                      0.903    0.349
##     MLQ_3             1.091    0.065                      1.091    0.445
##     MLQ_7             1.187    0.069                      1.187    0.479
##     MLQ_8             1.133    0.067                      1.133    0.457
##     MLQ_10            1.071    0.070                      1.071    0.367
##     ASDQII_1          0.306    0.017                      0.306    0.224
##     ASDQII_2          0.385    0.020                      0.385    0.267
##     ASDQII_3          0.326    0.018                      0.326    0.232
##     ASDQII_4          0.429    0.022                      0.429    0.292
##     ASDQII_5          0.417    0.022                      0.417    0.281
##     ASDQII_6          0.422    0.022                      0.422    0.196
##     ASDQII_7          0.403    0.022                      0.403    0.178
##     ASDQII_8          0.322    0.018                      0.322    0.144
##     ASDQII_9          0.387    0.021                      0.387    0.179
##     ASDQII_10         0.358    0.019                      0.358    0.172
##     ASDQII_11         0.288    0.016                      0.288    0.170
##     ASDQII_12         0.339    0.018                      0.339    0.196
##     ASDQII_13         0.363    0.020                      0.363    0.192
##     ASDQII_14         0.352    0.019                      0.352    0.199
##     ASDQII_15         0.378    0.020                      0.378    0.209
##     ASDQII_16         0.414    0.021                      0.414    0.302
##     ASDQII_17         0.360    0.019                      0.360    0.275
##     ASDQII_18         0.349    0.018                      0.349    0.274
##     ASDQII_19         0.400    0.020                      0.400    0.328
##     ASDQII_20         0.394    0.020                      0.394    0.292
##     Definate          1.000                               1.000    1.000
##     Tend              1.000                               1.000    1.000
##     MLQP              1.000                               1.000    1.000
##     MLQS              1.000                               1.000    1.000
##     English           1.000                               1.000    1.000
##     Math              1.000                               1.000    1.000
##     Science           1.000                               1.000    1.000
##     General           1.000                               1.000    1.000
## 
## R-Square:
## 
##     APSI_2            0.599
##     APSI_4            0.663
##     PWB_8             0.347
##     APSI_7            0.574
##     APSI_8            0.647
##     APSI_5            0.439
##     APSI_1            0.709
##     LET_2             0.345
##     PWB_2             0.186
##     PWB_9             0.129
##     PWB_3             0.642
##     PWB_5             0.557
##     LET_1             0.454
##     APSI_6            0.619
##     MLQ_4             0.622
##     MLQ_5             0.588
##     MLQ_6             0.628
##     MLQ_1             0.609
##     MLQ_2             0.651
##     MLQ_3             0.555
##     MLQ_7             0.521
##     MLQ_8             0.543
##     MLQ_10            0.633
##     ASDQII_1          0.776
##     ASDQII_2          0.733
##     ASDQII_3          0.768
##     ASDQII_4          0.708
##     ASDQII_5          0.719
##     ASDQII_6          0.804
##     ASDQII_7          0.822
##     ASDQII_8          0.856
##     ASDQII_9          0.821
##     ASDQII_10         0.828
##     ASDQII_11         0.830
##     ASDQII_12         0.804
##     ASDQII_13         0.808
##     ASDQII_14         0.801
##     ASDQII_15         0.791
##     ASDQII_16         0.698
##     ASDQII_17         0.725
##     ASDQII_18         0.726
##     ASDQII_19         0.672
##     ASDQII_20         0.708
modindices(corrolation.fit, sort. = TRUE, minimum.value = 3.84)
##           lhs op       rhs     mi    epc sepc.lv sepc.all sepc.nox
## 1       PWB_2 ~~     PWB_9 64.262  0.503   0.503    0.244    0.244
## 2    ASDQII_1 ~~ ASDQII_18 49.941  0.087   0.087    0.066    0.066
## 3    Definate =~    MLQ_10 47.546 -0.299  -0.299   -0.175   -0.175
## 4       PWB_9 ~~     MLQ_1 43.952  0.365   0.365    0.151    0.151
## 5    Definate =~     MLQ_1 43.140 -0.450  -0.450   -0.266   -0.266
## 6        MLQP =~    MLQ_10 40.369 -0.279  -0.279   -0.163   -0.163
## 7    Definate =~     MLQ_6 37.491  0.414   0.414    0.246    0.246
## 8   ASDQII_14 ~~ ASDQII_17 35.963  0.079   0.079    0.052    0.052
## 9   ASDQII_10 ~~ ASDQII_11 33.993  0.072   0.072    0.038    0.038
## 10    General =~  ASDQII_1 33.741  0.174   0.174    0.149    0.149
## 11  ASDQII_12 ~~ ASDQII_13 33.738  0.086   0.086    0.048    0.048
## 12  ASDQII_11 ~~ ASDQII_18 33.469  0.069   0.069    0.047    0.047
## 13   ASDQII_2 ~~ ASDQII_12 32.794  0.077   0.077    0.049    0.049
## 14       Tend =~     MLQ_5 31.552 -0.254  -0.254   -0.174   -0.174
## 15  ASDQII_12 ~~ ASDQII_19 30.371  0.073   0.073    0.051    0.051
## 16  ASDQII_10 ~~ ASDQII_18 29.923  0.072   0.072    0.044    0.044
## 17     APSI_4 ~~    APSI_7 29.911  0.121   0.121    0.089    0.089
## 18       Tend =~     MLQ_6 29.681  0.277   0.277    0.165    0.165
## 19      MLQ_5 ~~     MLQ_1 28.797  0.254   0.254    0.103    0.103
## 20  ASDQII_10 ~~ ASDQII_19 28.623 -0.074  -0.074   -0.046   -0.046
## 21   ASDQII_2 ~~  ASDQII_3 28.383  0.080   0.080    0.056    0.056
## 22     APSI_2 ~~    APSI_7 28.037 -0.113  -0.113   -0.090   -0.090
## 23       Tend =~     PWB_8 27.649 -0.229  -0.229   -0.164   -0.164
## 24      LET_1 ~~    MLQ_10 27.505  0.228   0.228    0.098    0.098
## 25  ASDQII_13 ~~ ASDQII_18 27.105 -0.069  -0.069   -0.044   -0.044
## 26       MLQP =~     LET_1 26.920 -0.237  -0.237   -0.173   -0.173
## 27   ASDQII_1 ~~ ASDQII_10 26.736  0.066   0.066    0.039    0.039
## 28   Definate =~     MLQ_4 26.365  0.328   0.328    0.207    0.207
## 29     APSI_7 ~~    APSI_8 26.301  0.115   0.115    0.084    0.084
## 30   Definate =~     MLQ_3 25.927  0.214   0.214    0.136    0.136
## 31   Definate =~     LET_1 25.860 -0.202  -0.202   -0.148   -0.148
## 32   ASDQII_1 ~~ ASDQII_11 25.511  0.058   0.058    0.038    0.038
## 33   Definate =~     MLQ_5 25.497 -0.301  -0.301   -0.206   -0.206
## 34     APSI_7 ~~     PWB_5 23.854 -0.159  -0.159   -0.087   -0.087
## 35  ASDQII_17 ~~ ASDQII_18 23.675  0.068   0.068    0.053    0.053
## 36       MLQP =~    APSI_5 23.164 -0.219  -0.219   -0.210   -0.210
## 37     APSI_5 ~~    APSI_6 22.515  0.135   0.135    0.090    0.090
## 38     APSI_6 ~~     MLQ_1 22.181 -0.195  -0.195   -0.081   -0.081
## 39     APSI_5 ~~     MLQ_1 21.980 -0.156  -0.156   -0.088   -0.088
## 40    General =~     MLQ_8 21.908  0.194   0.194    0.123    0.123
## 41     APSI_5 ~~     PWB_9 21.136 -0.176  -0.176   -0.118   -0.118
## 42   ASDQII_1 ~~  ASDQII_3 20.748 -0.065  -0.065   -0.047   -0.047
## 43   ASDQII_5 ~~ ASDQII_16 19.973  0.067   0.067    0.047    0.047
## 44   ASDQII_1 ~~  ASDQII_5 18.109  0.064   0.064    0.045    0.045
## 45       MLQP =~     MLQ_3 17.943  0.180   0.180    0.115    0.115
## 46     APSI_2 ~~    APSI_5 17.839  0.092   0.092    0.079    0.079
## 47       MLQS =~    APSI_7 17.720  0.126   0.126    0.111    0.111
## 48  ASDQII_11 ~~ ASDQII_15 17.702  0.060   0.060    0.034    0.034
## 49   ASDQII_4 ~~ ASDQII_17 17.392  0.059   0.059    0.043    0.043
## 50  ASDQII_12 ~~ ASDQII_18 17.268 -0.053  -0.053   -0.036   -0.036
## 51   ASDQII_2 ~~ ASDQII_18 16.809 -0.055  -0.055   -0.041   -0.041
## 52      PWB_2 ~~     MLQ_1 16.742  0.221   0.221    0.091    0.091
## 53    Science =~     MLQ_8 16.123  0.165   0.165    0.105    0.105
## 54       Math =~  ASDQII_2 16.038 -0.090  -0.090   -0.075   -0.075
## 55    General =~     PWB_2 15.872 -0.199  -0.199   -0.138   -0.138
## 56       Tend =~     MLQ_1 15.808 -0.206  -0.206   -0.121   -0.121
## 57   ASDQII_3 ~~ ASDQII_13 15.730  0.052   0.052    0.032    0.032
## 58   Definate =~ ASDQII_20 15.659  0.102   0.102    0.088    0.088
## 59     APSI_6 ~~     MLQ_5 15.253 -0.142  -0.142   -0.068   -0.068
## 60       MLQS =~ ASDQII_15 15.118  0.097   0.097    0.072    0.072
## 61       MLQS =~     LET_1 15.058  0.161   0.161    0.118    0.118
## 62      LET_2 ~~     PWB_3 15.007 -0.135  -0.135   -0.077   -0.077
## 63  ASDQII_11 ~~ ASDQII_13 14.819 -0.055  -0.055   -0.031   -0.031
## 64      PWB_2 ~~    MLQ_10 14.765  0.207   0.207    0.084    0.084
## 65    General =~ ASDQII_11 14.656  0.110   0.110    0.085    0.085
## 66  ASDQII_17 ~~ ASDQII_20 14.310 -0.055  -0.055   -0.042   -0.042
## 67       MLQP =~     MLQ_8 14.307  0.163   0.163    0.103    0.103
## 68       Tend =~     MLQ_4 14.233  0.181   0.181    0.114    0.114
## 69       Math =~  ASDQII_1 14.179  0.078   0.078    0.067    0.067
## 70       MLQP =~     PWB_8 13.813  0.240   0.240    0.172    0.172
## 71   Definate =~     MLQ_8 13.770  0.158   0.158    0.100    0.100
## 72    Science =~    APSI_5 13.697  0.110   0.110    0.105    0.105
## 73   ASDQII_8 ~~ ASDQII_14 13.620  0.048   0.048    0.024    0.024
## 74  ASDQII_12 ~~ ASDQII_17 13.561 -0.048  -0.048   -0.032   -0.032
## 75      LET_2 ~~    APSI_6 13.453  0.118   0.118    0.075    0.075
## 76      LET_2 ~~     MLQ_4 13.410  0.126   0.126    0.072    0.072
## 77   ASDQII_3 ~~ ASDQII_16 13.269 -0.050  -0.050   -0.036   -0.036
## 78   ASDQII_2 ~~ ASDQII_19 13.265  0.051   0.051    0.039    0.039
## 79       Tend =~    APSI_5 13.155  0.112   0.112    0.107    0.107
## 80       MLQP =~     MLQ_2 13.141 -0.148  -0.148   -0.092   -0.092
## 81   ASDQII_1 ~~  ASDQII_6 13.111 -0.049  -0.049   -0.029   -0.029
## 82    General =~    APSI_5 13.087  0.109   0.109    0.104    0.104
## 83       MLQP =~     MLQ_7 12.901  0.157   0.157    0.100    0.100
## 84    English =~    APSI_5 12.683  0.108   0.108    0.103    0.103
## 85   ASDQII_6 ~~  ASDQII_9 12.665  0.058   0.058    0.027    0.027
## 86   ASDQII_6 ~~ ASDQII_11 12.589 -0.047  -0.047   -0.024   -0.024
## 87      PWB_2 ~~     MLQ_2 12.510 -0.177  -0.177   -0.076   -0.076
## 88   ASDQII_2 ~~ ASDQII_20 12.475  0.050   0.050    0.036    0.036
## 89    General =~  ASDQII_2 12.445 -0.114  -0.114   -0.095   -0.095
## 90   ASDQII_5 ~~ ASDQII_20 12.445 -0.052  -0.052   -0.037   -0.037
## 91       MLQP =~ ASDQII_16 12.388 -0.096  -0.096   -0.082   -0.082
## 92      MLQ_2 ~~  ASDQII_4 12.071 -0.092  -0.092   -0.047   -0.047
## 93    General =~    APSI_1 11.914 -0.095  -0.095   -0.078   -0.078
## 94       MLQP =~ ASDQII_20 11.896  0.092   0.092    0.079    0.079
## 95       MLQP =~ ASDQII_19 11.656  0.090   0.090    0.081    0.081
## 96  ASDQII_19 ~~ ASDQII_20 11.507  0.050   0.050    0.039    0.039
## 97    Science =~ ASDQII_18 11.409 -0.105  -0.105   -0.093   -0.093
## 98   ASDQII_4 ~~ ASDQII_14 11.406  0.048   0.048    0.030    0.030
## 99  ASDQII_13 ~~ ASDQII_19 11.304  0.046   0.046    0.031    0.031
## 100    APSI_5 ~~ ASDQII_11 11.300  0.058   0.058    0.043    0.043
## 101  Definate =~    APSI_6 11.228  0.128   0.128    0.089    0.089
## 102      MLQP =~     LET_2 11.094  0.170   0.170    0.153    0.153
## 103     PWB_2 ~~    APSI_6 11.040 -0.163  -0.163   -0.079   -0.079
## 104     PWB_9 ~~    APSI_6 11.027 -0.164  -0.164   -0.080   -0.080
## 105   General =~     MLQ_6 10.902 -0.147  -0.147   -0.087   -0.087
## 106      Math =~     MLQ_8 10.891  0.135   0.135    0.086    0.086
## 107   English =~    APSI_1 10.844 -0.091  -0.091   -0.075   -0.075
## 108  ASDQII_9 ~~ ASDQII_19 10.767  0.047   0.047    0.029    0.029
## 109  ASDQII_4 ~~ ASDQII_19 10.653 -0.048  -0.048   -0.036   -0.036
## 110    APSI_5 ~~     MLQ_7 10.575 -0.108  -0.108   -0.066   -0.066
## 111    APSI_2 ~~  ASDQII_7 10.547  0.060   0.060    0.036    0.036
## 112      Tend =~     LET_2 10.350 -0.111  -0.111   -0.100   -0.100
## 113      MLQS =~  ASDQII_4 10.217 -0.084  -0.084   -0.070   -0.070
## 114  ASDQII_5 ~~  ASDQII_7 10.199  0.048   0.048    0.026    0.026
## 115   General =~     PWB_3 10.154  0.137   0.137    0.086    0.086
## 116  ASDQII_9 ~~ ASDQII_12 10.064  0.043   0.043    0.022    0.022
## 117  ASDQII_6 ~~ ASDQII_20  9.993  0.047   0.047    0.027    0.027
## 118   English =~     MLQ_8  9.851  0.130   0.130    0.083    0.083
## 119    APSI_2 ~~    APSI_1  9.763  0.065   0.065    0.048    0.048
## 120    APSI_2 ~~     LET_1  9.761 -0.088  -0.088   -0.058   -0.058
## 121     MLQ_3 ~~    MLQ_10  9.622  0.167   0.167    0.062    0.062
## 122 ASDQII_18 ~~ ASDQII_20  9.583 -0.045  -0.045   -0.034   -0.034
## 123      MLQS =~    APSI_5  9.478  0.095   0.095    0.090    0.090
## 124  ASDQII_9 ~~ ASDQII_18  9.300 -0.041  -0.041   -0.025   -0.025
## 125    APSI_1 ~~ ASDQII_10  9.257 -0.052  -0.052   -0.030   -0.030
## 126      Tend =~     MLQ_8  9.209 -0.136  -0.136   -0.086   -0.086
## 127      Math =~     PWB_9  9.187 -0.150  -0.150   -0.105   -0.105
## 128     MLQ_5 ~~     MLQ_6  9.170 -0.142  -0.142   -0.058   -0.058
## 129     PWB_3 ~~     PWB_5  9.157  0.175   0.175    0.068    0.068
## 130  Definate =~ ASDQII_16  9.080 -0.079  -0.079   -0.068   -0.068
## 131    APSI_2 ~~     PWB_5  8.911  0.093   0.093    0.052    0.052
## 132     MLQ_6 ~~    MLQ_10  8.856 -0.137  -0.137   -0.048   -0.048
## 133   English =~     MLQ_2  8.831 -0.117  -0.117   -0.073   -0.073
## 134     MLQ_7 ~~ ASDQII_16  8.787 -0.083  -0.083   -0.045   -0.045
## 135  ASDQII_8 ~~ ASDQII_10  8.742  0.045   0.045    0.021    0.021
## 136  ASDQII_6 ~~  ASDQII_8  8.727 -0.047  -0.047   -0.021   -0.021
## 137    APSI_4 ~~     LET_2  8.700 -0.074  -0.074   -0.056   -0.056
## 138   English =~     MLQ_6  8.693 -0.133  -0.133   -0.079   -0.079
## 139      Tend =~ ASDQII_19  8.677 -0.080  -0.080   -0.072   -0.072
## 140      Math =~     PWB_8  8.630  0.123   0.123    0.088    0.088
## 141    APSI_4 ~~    APSI_8  8.623  0.066   0.066    0.045    0.045
## 142     PWB_5 ~~     MLQ_6  8.539  0.139   0.139    0.051    0.051
## 143  ASDQII_1 ~~ ASDQII_13  8.420 -0.037  -0.037   -0.023   -0.023
## 144   English =~ ASDQII_11  8.383  0.062   0.062    0.048    0.048
## 145      MLQP =~     PWB_3  8.382  0.139   0.139    0.088    0.088
## 146     PWB_9 ~~     PWB_5  8.379  0.166   0.166    0.072    0.072
## 147 ASDQII_14 ~~ ASDQII_19  8.343 -0.039  -0.039   -0.027   -0.027
## 148     PWB_9 ~~  ASDQII_1  8.316 -0.085  -0.085   -0.051   -0.051
## 149    APSI_1 ~~     MLQ_6  8.313  0.085   0.085    0.042    0.042
## 150  ASDQII_3 ~~ ASDQII_11  8.301 -0.034  -0.034   -0.022   -0.022
## 151     LET_2 ~~ ASDQII_20  8.205  0.062   0.062    0.048    0.048
## 152     LET_1 ~~ ASDQII_19  8.172 -0.072  -0.072   -0.048   -0.048
## 153 ASDQII_16 ~~ ASDQII_18  8.153  0.042   0.042    0.032    0.032
## 154     PWB_3 ~~    MLQ_10  8.137 -0.127  -0.127   -0.047   -0.047
## 155    APSI_6 ~~     MLQ_3  8.110  0.114   0.114    0.051    0.051
## 156 ASDQII_13 ~~ ASDQII_15  8.095 -0.044  -0.044   -0.024   -0.024
## 157      Math =~  ASDQII_5  8.057  0.066   0.066    0.054    0.054
## 158    APSI_8 ~~  ASDQII_7  7.909 -0.054  -0.054   -0.030   -0.030
## 159  ASDQII_7 ~~ ASDQII_20  7.876 -0.041  -0.041   -0.023   -0.023
## 160      MLQS =~ ASDQII_17  7.869 -0.070  -0.070   -0.061   -0.061
## 161  ASDQII_1 ~~  ASDQII_2  7.761 -0.041  -0.041   -0.029   -0.029
## 162 ASDQII_13 ~~ ASDQII_20  7.714  0.039   0.039    0.024    0.024
## 163   General =~     MLQ_5  7.690  0.109   0.109    0.075    0.075
## 164    APSI_7 ~~     MLQ_7  7.671  0.089   0.089    0.050    0.050
## 165      Tend =~  ASDQII_7  7.613  0.075   0.075    0.050    0.050
## 166  ASDQII_1 ~~ ASDQII_14  7.583 -0.034  -0.034   -0.022   -0.022
## 167     LET_1 ~~ ASDQII_18  7.553  0.066   0.066    0.043    0.043
## 168     MLQ_2 ~~     MLQ_3  7.525 -0.139  -0.139   -0.055   -0.055
## 169   English =~     PWB_3  7.523  0.115   0.115    0.073    0.073
## 170   General =~     PWB_8  7.495  0.116   0.116    0.083    0.083
## 171    APSI_2 ~~     LET_2  7.442  0.067   0.067    0.054    0.054
## 172    APSI_1 ~~     MLQ_4  7.266  0.075   0.075    0.039    0.039
## 173   Science =~     PWB_9  7.213 -0.131  -0.131   -0.092   -0.092
## 174     PWB_5 ~~     LET_1  7.201 -0.132  -0.132   -0.060   -0.060
## 175  ASDQII_9 ~~ ASDQII_11  7.192 -0.034  -0.034   -0.018   -0.018
## 176    APSI_8 ~~     LET_2  7.167 -0.068  -0.068   -0.051   -0.051
## 177  ASDQII_6 ~~ ASDQII_13  7.149  0.039   0.039    0.019    0.019
## 178 ASDQII_12 ~~ ASDQII_16  7.127 -0.037  -0.037   -0.024   -0.024
## 179  ASDQII_3 ~~ ASDQII_20  7.096  0.035   0.035    0.026    0.026
## 180  ASDQII_2 ~~  ASDQII_5  7.024 -0.043  -0.043   -0.029   -0.029
## 181    APSI_8 ~~    APSI_1  6.959 -0.058  -0.058   -0.039   -0.039
## 182  ASDQII_3 ~~ ASDQII_19  6.911  0.035   0.035    0.027    0.027
## 183    APSI_1 ~~ ASDQII_13  6.905  0.045   0.045    0.027    0.027
## 184     LET_2 ~~     MLQ_3  6.869  0.095   0.095    0.055    0.055
## 185     MLQ_6 ~~     MLQ_3  6.853  0.117   0.117    0.044    0.044
## 186   Science =~     PWB_2  6.828 -0.125  -0.125   -0.087   -0.087
## 187    APSI_7 ~~     LET_1  6.809  0.077   0.077    0.050    0.050
## 188  ASDQII_2 ~~ ASDQII_17  6.757 -0.036  -0.036   -0.026   -0.026
## 189     MLQ_4 ~~ ASDQII_16  6.754 -0.067  -0.067   -0.036   -0.036
## 190  ASDQII_3 ~~  ASDQII_6  6.750  0.036   0.036    0.021    0.021
## 191    APSI_1 ~~     LET_2  6.637  0.062   0.062    0.046    0.046
## 192   English =~  ASDQII_6  6.634 -0.060  -0.060   -0.041   -0.041
## 193      MLQP =~ ASDQII_11  6.625 -0.058  -0.058   -0.045   -0.045
## 194      MLQP =~ ASDQII_12  6.622  0.062   0.062    0.047    0.047
## 195  ASDQII_1 ~~  ASDQII_9  6.587 -0.034  -0.034   -0.020   -0.020
## 196     PWB_3 ~~     MLQ_7  6.585  0.115   0.115    0.046    0.046
## 197   General =~     PWB_9  6.540 -0.130  -0.130   -0.091   -0.091
## 198     PWB_9 ~~     MLQ_2  6.536 -0.130  -0.130   -0.057   -0.057
## 199     LET_1 ~~     MLQ_6  6.520 -0.109  -0.109   -0.048   -0.048
## 200   English =~     PWB_2  6.494 -0.125  -0.125   -0.086   -0.086
## 201     LET_2 ~~     LET_1  6.494 -0.087  -0.087   -0.058   -0.058
## 202     PWB_5 ~~     MLQ_7  6.475 -0.123  -0.123   -0.048   -0.048
## 203    MLQ_10 ~~ ASDQII_19  6.445 -0.069  -0.069   -0.036   -0.036
## 204 ASDQII_10 ~~ ASDQII_13  6.415 -0.034  -0.034   -0.017   -0.017
## 205    APSI_1 ~~    MLQ_10  6.366 -0.075  -0.075   -0.036   -0.036
## 206  ASDQII_1 ~~ ASDQII_19  6.327 -0.033  -0.033   -0.025   -0.025
## 207  ASDQII_3 ~~  ASDQII_7  6.233 -0.034  -0.034   -0.019   -0.019
## 208 ASDQII_11 ~~ ASDQII_12  6.173 -0.034  -0.034   -0.020   -0.020
## 209  ASDQII_2 ~~ ASDQII_11  6.145 -0.031  -0.031   -0.020   -0.020
## 210    APSI_7 ~~     MLQ_4  6.129 -0.074  -0.074   -0.041   -0.041
## 211   General =~    MLQ_10  6.106 -0.104  -0.104   -0.061   -0.061
## 212      Tend =~     MLQ_2  6.101  0.105   0.105    0.065    0.065
## 213     MLQ_4 ~~     MLQ_5  6.091 -0.109  -0.109   -0.047   -0.047
## 214      MLQS =~    APSI_2  6.073 -0.070  -0.070   -0.064   -0.064
## 215      MLQP =~     PWB_9  6.039  0.139   0.139    0.097    0.097
## 216     PWB_9 ~~  ASDQII_2  6.030  0.079   0.079    0.046    0.046
## 217   English =~ ASDQII_10  6.007  0.054   0.054    0.037    0.037
## 218     MLQ_1 ~~ ASDQII_12  5.959  0.063   0.063    0.028    0.028
## 219 ASDQII_11 ~~ ASDQII_19  5.937 -0.031  -0.031   -0.021   -0.021
## 220    APSI_2 ~~    APSI_4  5.927 -0.052  -0.052   -0.039   -0.039
## 221   General =~  ASDQII_6  5.920 -0.080  -0.080   -0.055   -0.055
## 222   General =~ ASDQII_12  5.895 -0.074  -0.074   -0.056   -0.056
## 223  Definate =~     PWB_2  5.866 -0.117  -0.117   -0.081   -0.081
## 224  ASDQII_4 ~~  ASDQII_8  5.825  0.034   0.034    0.019    0.019
## 225     MLQ_1 ~~     MLQ_7  5.788  0.113   0.113    0.043    0.043
## 226   Science =~ ASDQII_20  5.777  0.079   0.079    0.068    0.068
## 227  ASDQII_5 ~~ ASDQII_12  5.768 -0.033  -0.033   -0.021   -0.021
## 228    MLQ_10 ~~  ASDQII_2  5.715  0.065   0.065    0.032    0.032
## 229  ASDQII_4 ~~ ASDQII_10  5.674 -0.034  -0.034   -0.020   -0.020
## 230    APSI_7 ~~    APSI_1  5.631 -0.051  -0.051   -0.037   -0.037
## 231    APSI_5 ~~  ASDQII_3  5.579 -0.043  -0.043   -0.035   -0.035
## 232      MLQS =~ ASDQII_13  5.503 -0.058  -0.058   -0.042   -0.042
## 233    APSI_6 ~~  ASDQII_1  5.484  0.051   0.051    0.031    0.031
## 234   Science =~     PWB_8  5.479  0.098   0.098    0.070    0.070
## 235   Science =~  ASDQII_1  5.413  0.051   0.051    0.044    0.044
## 236    APSI_7 ~~     MLQ_8  5.393  0.073   0.073    0.041    0.041
## 237   General =~ ASDQII_10  5.333  0.072   0.072    0.050    0.050
## 238      Math =~     MLQ_6  5.318 -0.099  -0.099   -0.059   -0.059
## 239      Math =~     PWB_2  5.301 -0.112  -0.112   -0.078   -0.078
## 240      Tend =~     MLQ_7  5.299 -0.105  -0.105   -0.067   -0.067
## 241   English =~     PWB_8  5.268  0.098   0.098    0.070    0.070
## 242      MLQS =~     PWB_5  5.251 -0.107  -0.107   -0.066   -0.066
## 243     PWB_2 ~~ ASDQII_12  5.211  0.068   0.068    0.036    0.036
## 244    APSI_2 ~~     MLQ_7  5.169 -0.070  -0.070   -0.040   -0.040
## 245     PWB_8 ~~     LET_1  5.137 -0.098  -0.098   -0.051   -0.051
## 246      Math =~    APSI_1  5.080 -0.061  -0.061   -0.050   -0.050
## 247     PWB_9 ~~ ASDQII_20  5.067 -0.072  -0.072   -0.043   -0.043
## 248    APSI_7 ~~ ASDQII_18  5.050  0.040   0.040    0.031    0.031
## 249      Tend =~    MLQ_10  5.044  0.103   0.103    0.060    0.060
## 250   English =~     MLQ_5  5.042  0.090   0.090    0.062    0.062
## 251    APSI_8 ~~     MLQ_6  4.934  0.070   0.070    0.034    0.034
## 252     PWB_9 ~~     MLQ_8  4.892 -0.120  -0.120   -0.053   -0.053
## 253     PWB_3 ~~     MLQ_6  4.885  0.097   0.097    0.036    0.036
## 254     MLQ_7 ~~    MLQ_10  4.884 -0.120  -0.120   -0.045   -0.045
## 255     MLQ_1 ~~ ASDQII_11  4.812 -0.053  -0.053   -0.024   -0.024
## 256  ASDQII_8 ~~ ASDQII_15  4.804 -0.029  -0.029   -0.015   -0.015
## 257     MLQ_4 ~~     MLQ_3  4.802  0.093   0.093    0.037    0.037
## 258      MLQP =~  ASDQII_6  4.794  0.058   0.058    0.039    0.039
## 259     PWB_9 ~~ ASDQII_19  4.761  0.069   0.069    0.044    0.044
## 260   Science =~     MLQ_4  4.750 -0.089  -0.089   -0.056   -0.056
## 261     PWB_9 ~~     LET_1  4.732 -0.112  -0.112   -0.057   -0.057
## 262      Math =~ ASDQII_20  4.727  0.070   0.070    0.060    0.060
## 263  ASDQII_7 ~~  ASDQII_9  4.695 -0.035  -0.035   -0.016   -0.016
## 264  Definate =~ ASDQII_11  4.682 -0.048  -0.048   -0.037   -0.037
## 265   General =~  ASDQII_4  4.680 -0.073  -0.073   -0.060   -0.060
## 266    MLQ_10 ~~ ASDQII_16  4.666  0.060   0.060    0.030    0.030
## 267     LET_2 ~~    MLQ_10  4.662 -0.080  -0.080   -0.042   -0.042
## 268 ASDQII_17 ~~ ASDQII_19  4.657 -0.031  -0.031   -0.025   -0.025
## 269   General =~     MLQ_1  4.627  0.097   0.097    0.057    0.057
## 270  ASDQII_5 ~~  ASDQII_9  4.589  0.032   0.032    0.018    0.018
## 271     MLQ_8 ~~ ASDQII_13  4.572 -0.057  -0.057   -0.026   -0.026
## 272    APSI_1 ~~     LET_1  4.568 -0.059  -0.059   -0.035   -0.035
## 273  ASDQII_6 ~~  ASDQII_7  4.561  0.036   0.036    0.016    0.016
## 274     PWB_3 ~~     MLQ_3  4.545 -0.093  -0.093   -0.037   -0.037
## 275    APSI_2 ~~     MLQ_1  4.542  0.065   0.065    0.035    0.035
## 276  ASDQII_7 ~~ ASDQII_15  4.540  0.031   0.031    0.015    0.015
## 277 ASDQII_18 ~~ ASDQII_19  4.509 -0.030  -0.030   -0.024   -0.024
## 278   General =~     PWB_5  4.477 -0.097  -0.097   -0.060   -0.060
## 279 ASDQII_16 ~~ ASDQII_17  4.471  0.032   0.032    0.024    0.024
## 280  ASDQII_6 ~~ ASDQII_12  4.433  0.029   0.029    0.015    0.015
## 281 ASDQII_12 ~~ ASDQII_14  4.423 -0.030  -0.030   -0.017   -0.017
## 282    APSI_5 ~~     MLQ_5  4.419 -0.061  -0.061   -0.040   -0.040
## 283     MLQ_3 ~~ ASDQII_14  4.417 -0.054  -0.054   -0.026   -0.026
## 284      MLQS =~     PWB_3  4.369 -0.091  -0.091   -0.058   -0.058
## 285   Science =~ ASDQII_19  4.337  0.067   0.067    0.061    0.061
## 286    APSI_7 ~~ ASDQII_15  4.332  0.038   0.038    0.025    0.025
## 287 ASDQII_10 ~~ ASDQII_12  4.313 -0.027  -0.027   -0.014   -0.014
## 288 ASDQII_13 ~~ ASDQII_14  4.278  0.031   0.031    0.017    0.017
## 289     MLQ_1 ~~     MLQ_3  4.215 -0.094  -0.094   -0.035   -0.035
## 290     LET_1 ~~ ASDQII_15  4.186  0.051   0.051    0.028    0.028
## 291    APSI_5 ~~  ASDQII_1  4.182  0.036   0.036    0.030    0.030
## 292     MLQ_1 ~~  ASDQII_9  4.169  0.056   0.056    0.023    0.023
## 293     MLQ_8 ~~  ASDQII_7  4.142 -0.057  -0.057   -0.024   -0.024
## 294      Math =~     PWB_3  4.126  0.085   0.085    0.054    0.054
## 295     MLQ_1 ~~ ASDQII_13  4.124  0.055   0.055    0.023    0.023
## 296      Math =~    APSI_5  4.103  0.060   0.060    0.057    0.057
## 297  ASDQII_2 ~~ ASDQII_10  4.096 -0.028  -0.028   -0.016   -0.016
## 298  Definate =~     PWB_3  4.087  0.084   0.084    0.053    0.053
## 299    APSI_7 ~~     MLQ_1  4.005 -0.064  -0.064   -0.034   -0.034
## 300     MLQ_8 ~~  ASDQII_1  3.941  0.049   0.049    0.027    0.027
## 301  ASDQII_7 ~~ ASDQII_17  3.919  0.028   0.028    0.016    0.016
## 302   Science =~     MLQ_3  3.900 -0.080  -0.080   -0.051   -0.051
## 303     MLQ_6 ~~ ASDQII_18  3.886 -0.050  -0.050   -0.026   -0.026
## 304      MLQS =~  ASDQII_5  3.881  0.052   0.052    0.042    0.042
## 305  ASDQII_6 ~~ ASDQII_10  3.874 -0.031  -0.031   -0.015   -0.015
## 306     PWB_5 ~~  ASDQII_1  3.865 -0.051  -0.051   -0.027   -0.027
## 307   Science =~    APSI_4  3.860 -0.055  -0.055   -0.046   -0.046
## 308    APSI_4 ~~    APSI_1  3.860 -0.042  -0.042   -0.029   -0.029
fitmeasures(corrolation.fit)
##                npar                fmin               chisq 
##             157.000               1.177            2494.296 
##                  df              pvalue      baseline.chisq 
##             832.000               0.000           32703.201 
##         baseline.df     baseline.pvalue                 cfi 
##             903.000               0.000               0.948 
##                 tli                nnfi                 rfi 
##               0.943               0.943               0.917 
##                 nfi                pnfi                 ifi 
##               0.924               0.851               0.948 
##                 rni                logl   unrestricted.logl 
##               0.948          -53632.770          -52385.623 
##                 aic                 bic              ntotal 
##          107579.541          108359.207            1060.000 
##                bic2               rmsea      rmsea.ci.lower 
##          107860.548               0.043               0.041 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.045               1.000               0.096 
##          rmr_nomean                srmr        srmr_bentler 
##               0.098               0.050               0.050 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.051               0.050               0.051 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.050               0.051             383.564 
##               cn_01                 gfi                agfi 
##             396.148               0.968               0.962 
##                pgfi                 mfi                ecvi 
##               0.814               0.457                  NA
corolations<-(corrolation.fit)
fitted<-fitted(corrolation.fit)

See is APSI_6 (I don;t know where I fit in the world) is corrolated with APSI_2 and APSI_4 (3. I have a firm sense of who I am. I know what I want out of life.) – it is not.

cor(all_surveys$APSI_4, all_surveys$APSI_2, use  = "complete.obs")
## [1] 0.6054402
?cor
## starting httpd help server ... done
with(all_surveys, cor(APSI_6, APSI_4))
## [1] NA

Corrorlations

second.corrolation = '  F1  =~ PWB_1 + PWB_3 + APSI_6 + LET_1 + LET_3 + LET_5 
                F2 =~   PWB_7 + PWB_8 +  APSI_2 + APSI_4 + APSI_7 + APSI_8
               MLQP =~ MLQ_4 + MLQ_5 + MLQ_6 + MLQ_1
              MLQS =~ MLQ_2 + MLQ_3 + MLQ_7 + MLQ_8 + MLQ_10
              English =~ ASDQII_1 + ASDQII_2 + ASDQII_3 + ASDQII_4 + ASDQII_5 
              Math =~ ASDQII_6 + ASDQII_7 + ASDQII_8 + ASDQII_9 + ASDQII_10              
              Science =~ ASDQII_11 + ASDQII_12 + ASDQII_13 + ASDQII_14 + ASDQII_15
              General =~ ASDQII_16 + ASDQII_17 + ASDQII_18 + ASDQII_19 + ASDQII_20'

                 second.fit=cfa(second.corrolation, data=all_surveys, missing = "fiml", std.lv = T)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be removed:
##   17 22 23 24 28 29 43 45 78 79 85 94 110 111 112 116 123 128 129 152 170 183 184 220 226 234 240 243 247 271 275 292 304 311 312 327 360 361 364 365 368 445 457 459 460 463 470 478 539 540 541 545 546 548 549 553 555 557 560 563 573 575 577 584 585 587 588 589 591 592 596 598 599 600 602 603 606 610 662 679 687 782 783 784 785 809 810 829 903 1110 1113 1114 1117 1120 1125 1130 1146 1150 1159 1160
semPaths(second.fit, whatLabels = "std", layout = "tree")

summary(second.fit, standardized = TRUE, rsquare=TRUE)
## lavaan (0.5-18) converged normally after 123 iterations
## 
##                                                   Used       Total
##   Number of observations                          1060        1160
## 
##   Number of missing patterns                         5
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic             2188.724
##   Degrees of freedom                               751
##   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:
##   F1 =~
##     PWB_1             0.859    0.055   15.615    0.000    0.859    0.533
##     PWB_3             1.272    0.048   26.727    0.000    1.272    0.804
##     APSI_6            1.105    0.044   25.142    0.000    1.105    0.773
##     LET_1             0.914    0.044   20.780    0.000    0.914    0.670
##     LET_3             1.080    0.040   27.089    0.000    1.080    0.811
##     LET_5             1.043    0.041   25.639    0.000    1.043    0.781
##   F2 =~
##     PWB_7             0.879    0.041   21.282    0.000    0.879    0.685
##     PWB_8             0.847    0.046   18.284    0.000    0.847    0.607
##     APSI_2            0.820    0.034   23.783    0.000    0.820    0.742
##     APSI_4            0.978    0.036   27.295    0.000    0.978    0.815
##     APSI_7            0.876    0.035   25.273    0.000    0.876    0.774
##     APSI_8            0.996    0.036   27.816    0.000    0.996    0.824
##   MLQP =~
##     MLQ_4             1.237    0.048   25.647    0.000    1.237    0.780
##     MLQ_5             1.131    0.045   25.264    0.000    1.131    0.774
##     MLQ_6             1.332    0.051   26.160    0.000    1.332    0.792
##     MLQ_1             1.326    0.051   25.775    0.000    1.326    0.784
##   MLQS =~
##     MLQ_2             1.298    0.048   26.919    0.000    1.298    0.807
##     MLQ_3             1.168    0.049   24.032    0.000    1.168    0.746
##     MLQ_7             1.136    0.049   23.001    0.000    1.136    0.722
##     MLQ_8             1.161    0.049   23.682    0.000    1.161    0.737
##     MLQ_10            1.356    0.052   26.294    0.000    1.356    0.794
##   English =~
##     ASDQII_1          1.030    0.029   35.979    0.000    1.030    0.881
##     ASDQII_2          1.027    0.030   34.342    0.000    1.027    0.856
##     ASDQII_3          1.038    0.029   35.676    0.000    1.038    0.876
##     ASDQII_4          1.019    0.030   33.447    0.000    1.019    0.841
##     ASDQII_5          1.032    0.031   33.831    0.000    1.032    0.848
##   Math =~
##     ASDQII_6          1.315    0.035   37.415    0.000    1.315    0.897
##     ASDQII_7          1.363    0.036   38.121    0.000    1.363    0.906
##     ASDQII_8          1.380    0.035   39.492    0.000    1.380    0.925
##     ASDQII_9          1.332    0.035   38.089    0.000    1.332    0.906
##     ASDQII_10         1.313    0.034   38.371    0.000    1.313    0.910
##   Science =~
##     ASDQII_11         1.183    0.031   38.359    0.000    1.183    0.911
##     ASDQII_12         1.180    0.032   37.347    0.000    1.180    0.897
##     ASDQII_13         1.236    0.033   37.493    0.000    1.236    0.899
##     ASDQII_14         1.190    0.032   37.232    0.000    1.190    0.895
##     ASDQII_15         1.196    0.032   36.842    0.000    1.196    0.889
##   General =~
##     ASDQII_16         0.977    0.030   33.076    0.000    0.977    0.835
##     ASDQII_17         0.976    0.029   34.115    0.000    0.976    0.852
##     ASDQII_18         0.962    0.028   34.112    0.000    0.962    0.852
##     ASDQII_19         0.905    0.028   32.127    0.000    0.905    0.820
##     ASDQII_20         0.976    0.029   33.420    0.000    0.976    0.841
## 
## Covariances:
##   F1 ~~
##     F2                0.057    0.039    1.454    0.146    0.057    0.057
##     MLQP             -0.355    0.036   -9.868    0.000   -0.355   -0.355
##     MLQS              0.204    0.038    5.357    0.000    0.204    0.204
##     English          -0.154    0.038   -4.059    0.000   -0.154   -0.154
##     Math             -0.172    0.037   -4.641    0.000   -0.172   -0.172
##     Science          -0.110    0.038   -2.902    0.004   -0.110   -0.110
##     General          -0.229    0.038   -6.053    0.000   -0.229   -0.229
##   F2 ~~
##     MLQP              0.691    0.024   28.609    0.000    0.691    0.691
##     MLQS              0.112    0.039    2.851    0.004    0.112    0.112
##     English           0.212    0.037    5.647    0.000    0.212    0.212
##     Math              0.180    0.037    4.847    0.000    0.180    0.180
##     Science           0.150    0.037    4.011    0.000    0.150    0.150
##     General           0.188    0.038    4.906    0.000    0.188    0.188
##   MLQP ~~
##     MLQS              0.106    0.040    2.682    0.007    0.106    0.106
##     English           0.295    0.036    8.183    0.000    0.295    0.295
##     Math              0.176    0.037    4.747    0.000    0.176    0.176
##     Science           0.178    0.037    4.782    0.000    0.178    0.178
##     General           0.252    0.038    6.685    0.000    0.252    0.252
##   MLQS ~~
##     English           0.063    0.039    1.625    0.104    0.063    0.063
##     Math             -0.012    0.038   -0.307    0.759   -0.012   -0.012
##     Science           0.068    0.038    1.778    0.075    0.068    0.068
##     General           0.007    0.040    0.177    0.859    0.007    0.007
##   English ~~
##     Math              0.251    0.031    8.214    0.000    0.251    0.251
##     Science           0.403    0.028   14.648    0.000    0.403    0.403
##     General           0.696    0.018   38.026    0.000    0.696    0.696
##   Math ~~
##     Science           0.524    0.024   22.118    0.000    0.524    0.524
##     General           0.693    0.018   38.690    0.000    0.693    0.693
##   Science ~~
##     General           0.698    0.018   39.052    0.000    0.698    0.698
## 
## Intercepts:
##     PWB_1             3.106    0.056   55.256    0.000    3.106    1.928
##     PWB_3             2.851    0.055   51.891    0.000    2.851    1.802
##     APSI_6            2.897    0.050   58.171    0.000    2.897    2.027
##     LET_1             2.482    0.047   52.537    0.000    2.482    1.820
##     LET_3             2.517    0.046   54.622    0.000    2.517    1.890
##     LET_5             2.196    0.046   47.518    0.000    2.196    1.644
##     PWB_7             4.544    0.045  101.671    0.000    4.544    3.538
##     PWB_8             4.360    0.049   89.706    0.000    4.360    3.126
##     APSI_2            3.940    0.039  102.095    0.000    3.940    3.562
##     APSI_4            3.870    0.042   92.621    0.000    3.870    3.225
##     APSI_7            3.923    0.039   99.443    0.000    3.923    3.466
##     APSI_8            3.873    0.042   92.057    0.000    3.873    3.204
##     MLQ_4             4.986    0.054   91.740    0.000    4.986    3.145
##     MLQ_5             5.244    0.050  104.687    0.000    5.244    3.589
##     MLQ_6             4.788    0.058   83.015    0.000    4.788    2.845
##     MLQ_1             4.701    0.058   81.073    0.000    4.701    2.779
##     MLQ_2             5.371    0.055   96.934    0.000    5.371    3.340
##     MLQ_3             5.252    0.054   97.323    0.000    5.252    3.353
##     MLQ_7             5.186    0.054   95.621    0.000    5.186    3.295
##     MLQ_8             5.319    0.054   98.026    0.000    5.319    3.377
##     MLQ_10            5.062    0.059   86.047    0.000    5.062    2.965
##     ASDQII_1          4.518    0.036  125.823    0.000    4.518    3.865
##     ASDQII_2          4.371    0.037  118.628    0.000    4.371    3.644
##     ASDQII_3          4.479    0.036  123.146    0.000    4.479    3.782
##     ASDQII_4          4.417    0.037  118.705    0.000    4.417    3.646
##     ASDQII_5          4.392    0.037  117.387    0.000    4.392    3.606
##     ASDQII_6          4.180    0.045   92.785    0.000    4.180    2.850
##     ASDQII_7          4.123    0.046   89.275    0.000    4.123    2.742
##     ASDQII_8          4.148    0.046   90.516    0.000    4.148    2.780
##     ASDQII_9          4.047    0.045   89.655    0.000    4.047    2.754
##     ASDQII_10         4.245    0.044   95.805    0.000    4.245    2.943
##     ASDQII_11         4.267    0.040  106.922    0.000    4.267    3.284
##     ASDQII_12         4.129    0.040  102.170    0.000    4.129    3.138
##     ASDQII_13         4.191    0.042   99.239    0.000    4.191    3.048
##     ASDQII_14         4.176    0.041  102.264    0.000    4.176    3.141
##     ASDQII_15         4.143    0.041  100.332    0.000    4.143    3.082
##     ASDQII_16         4.419    0.036  123.007    0.000    4.419    3.778
##     ASDQII_17         4.458    0.035  126.707    0.000    4.458    3.892
##     ASDQII_18         4.538    0.035  130.839    0.000    4.538    4.019
##     ASDQII_19         4.362    0.034  128.599    0.000    4.362    3.950
##     ASDQII_20         4.441    0.036  124.593    0.000    4.441    3.827
##     F1                0.000                               0.000    0.000
##     F2                0.000                               0.000    0.000
##     MLQP              0.000                               0.000    0.000
##     MLQS              0.000                               0.000    0.000
##     English           0.000                               0.000    0.000
##     Math              0.000                               0.000    0.000
##     Science           0.000                               0.000    0.000
##     General           0.000                               0.000    0.000
## 
## Variances:
##     PWB_1             1.859    0.097                      1.859    0.716
##     PWB_3             0.885    0.057                      0.885    0.354
##     APSI_6            0.821    0.051                      0.821    0.402
##     LET_1             1.024    0.056                      1.024    0.551
##     LET_3             0.609    0.039                      0.609    0.343
##     LET_5             0.696    0.043                      0.696    0.390
##     PWB_7             0.876    0.049                      0.876    0.531
##     PWB_8             1.229    0.065                      1.229    0.631
##     APSI_2            0.551    0.032                      0.551    0.450
##     APSI_4            0.484    0.031                      0.484    0.336
##     APSI_7            0.514    0.031                      0.514    0.401
##     APSI_8            0.468    0.030                      0.468    0.320
##     MLQ_4             0.984    0.061                      0.984    0.392
##     MLQ_5             0.856    0.053                      0.856    0.401
##     MLQ_6             1.057    0.068                      1.057    0.373
##     MLQ_1             1.104    0.069                      1.104    0.386
##     MLQ_2             0.902    0.060                      0.902    0.349
##     MLQ_3             1.089    0.065                      1.089    0.444
##     MLQ_7             1.187    0.069                      1.187    0.479
##     MLQ_8             1.131    0.067                      1.131    0.456
##     MLQ_10            1.076    0.070                      1.076    0.369
##     ASDQII_1          0.306    0.017                      0.306    0.224
##     ASDQII_2          0.385    0.021                      0.385    0.268
##     ASDQII_3          0.326    0.018                      0.326    0.232
##     ASDQII_4          0.428    0.022                      0.428    0.292
##     ASDQII_5          0.417    0.022                      0.417    0.281
##     ASDQII_6          0.422    0.022                      0.422    0.196
##     ASDQII_7          0.403    0.022                      0.403    0.178
##     ASDQII_8          0.322    0.018                      0.322    0.145
##     ASDQII_9          0.387    0.021                      0.387    0.179
##     ASDQII_10         0.358    0.019                      0.358    0.172
##     ASDQII_11         0.288    0.016                      0.288    0.170
##     ASDQII_12         0.339    0.018                      0.339    0.196
##     ASDQII_13         0.363    0.020                      0.363    0.192
##     ASDQII_14         0.352    0.019                      0.352    0.199
##     ASDQII_15         0.378    0.020                      0.378    0.209
##     ASDQII_16         0.413    0.021                      0.413    0.302
##     ASDQII_17         0.360    0.019                      0.360    0.274
##     ASDQII_18         0.350    0.018                      0.350    0.274
##     ASDQII_19         0.400    0.020                      0.400    0.328
##     ASDQII_20         0.394    0.020                      0.394    0.293
##     F1                1.000                               1.000    1.000
##     F2                1.000                               1.000    1.000
##     MLQP              1.000                               1.000    1.000
##     MLQS              1.000                               1.000    1.000
##     English           1.000                               1.000    1.000
##     Math              1.000                               1.000    1.000
##     Science           1.000                               1.000    1.000
##     General           1.000                               1.000    1.000
## 
## R-Square:
## 
##     PWB_1             0.284
##     PWB_3             0.646
##     APSI_6            0.598
##     LET_1             0.449
##     LET_3             0.657
##     LET_5             0.610
##     PWB_7             0.469
##     PWB_8             0.369
##     APSI_2            0.550
##     APSI_4            0.664
##     APSI_7            0.599
##     APSI_8            0.680
##     MLQ_4             0.608
##     MLQ_5             0.599
##     MLQ_6             0.627
##     MLQ_1             0.614
##     MLQ_2             0.651
##     MLQ_3             0.556
##     MLQ_7             0.521
##     MLQ_8             0.544
##     MLQ_10            0.631
##     ASDQII_1          0.776
##     ASDQII_2          0.732
##     ASDQII_3          0.768
##     ASDQII_4          0.708
##     ASDQII_5          0.719
##     ASDQII_6          0.804
##     ASDQII_7          0.822
##     ASDQII_8          0.855
##     ASDQII_9          0.821
##     ASDQII_10         0.828
##     ASDQII_11         0.830
##     ASDQII_12         0.804
##     ASDQII_13         0.808
##     ASDQII_14         0.801
##     ASDQII_15         0.791
##     ASDQII_16         0.698
##     ASDQII_17         0.726
##     ASDQII_18         0.726
##     ASDQII_19         0.672
##     ASDQII_20         0.707
modindices(second.fit, sort. = TRUE, minimum.value = 3.84)
##           lhs op       rhs     mi    epc sepc.lv sepc.all sepc.nox
## 1    ASDQII_1 ~~ ASDQII_18 50.091  0.087   0.087    0.066    0.066
## 2          F2 =~     LET_1 47.025 -0.270  -0.270   -0.198   -0.198
## 3        MLQP =~     LET_1 46.765 -0.293  -0.293   -0.215   -0.215
## 4          F2 =~    MLQ_10 43.468 -0.290  -0.290   -0.170   -0.170
## 5          F2 =~     MLQ_1 38.356 -0.432  -0.432   -0.255   -0.255
## 6          F1 =~     MLQ_5 38.307 -0.262  -0.262   -0.179   -0.179
## 7        MLQP =~    MLQ_10 37.915 -0.270  -0.270   -0.158   -0.158
## 8       LET_1 ~~    MLQ_10 37.620  0.263   0.263    0.113    0.113
## 9       PWB_7 ~~    APSI_4 37.207 -0.175  -0.175   -0.113   -0.113
## 10         F2 =~     MLQ_6 36.409  0.416   0.416    0.247    0.247
## 11  ASDQII_14 ~~ ASDQII_17 36.078  0.079   0.079    0.052    0.052
## 12  ASDQII_10 ~~ ASDQII_11 34.024  0.072   0.072    0.038    0.038
## 13  ASDQII_12 ~~ ASDQII_13 33.745  0.086   0.086    0.048    0.048
## 14    General =~  ASDQII_1 33.572  0.173   0.173    0.148    0.148
## 15  ASDQII_11 ~~ ASDQII_18 33.305  0.069   0.069    0.047    0.047
## 16   ASDQII_2 ~~ ASDQII_12 32.776  0.077   0.077    0.049    0.049
## 17      PWB_7 ~~     PWB_8 32.378  0.228   0.228    0.127    0.127
## 18  ASDQII_12 ~~ ASDQII_19 30.418  0.074   0.074    0.051    0.051
## 19  ASDQII_10 ~~ ASDQII_18 29.785  0.072   0.072    0.044    0.044
## 20         F1 =~     MLQ_6 29.286  0.260   0.260    0.154    0.154
## 21  ASDQII_10 ~~ ASDQII_19 28.512 -0.073  -0.073   -0.046   -0.046
## 22   ASDQII_2 ~~  ASDQII_3 28.398  0.080   0.080    0.056    0.056
## 23      LET_3 ~~     LET_5 28.111  0.173   0.173    0.097    0.097
## 24  ASDQII_13 ~~ ASDQII_18 27.092 -0.069  -0.069   -0.044   -0.044
## 25   ASDQII_1 ~~ ASDQII_10 26.750  0.066   0.066    0.039    0.039
## 26   ASDQII_1 ~~ ASDQII_11 25.463  0.058   0.058    0.038    0.038
## 27         F1 =~     PWB_8 24.979 -0.213  -0.213   -0.153   -0.153
## 28       MLQP =~     PWB_7 24.227  0.277   0.277    0.216    0.216
## 29       MLQP =~     PWB_1 24.210  0.278   0.278    0.172    0.172
## 30         F2 =~     MLQ_3 23.991  0.208   0.208    0.133    0.133
## 31     APSI_4 ~~    APSI_7 23.769  0.116   0.116    0.085    0.085
## 32  ASDQII_17 ~~ ASDQII_18 23.475  0.068   0.068    0.053    0.053
## 33      MLQ_5 ~~     MLQ_1 22.785  0.227   0.227    0.092    0.092
## 34    General =~     MLQ_8 22.020  0.194   0.194    0.123    0.123
## 35     APSI_6 ~~     LET_3 20.991 -0.161  -0.161   -0.085   -0.085
## 36         F2 =~     MLQ_4 20.955  0.300   0.300    0.189    0.189
## 37         F2 =~     MLQ_5 20.864 -0.277  -0.277   -0.190   -0.190
## 38   ASDQII_1 ~~  ASDQII_3 20.815 -0.065  -0.065   -0.047   -0.047
## 39   ASDQII_5 ~~ ASDQII_16 19.960  0.067   0.067    0.047    0.047
## 40         F1 =~     MLQ_4 19.735  0.203   0.203    0.128    0.128
## 41     APSI_2 ~~    APSI_7 18.869 -0.101  -0.101   -0.080   -0.080
## 42   ASDQII_1 ~~  ASDQII_5 18.130  0.064   0.064    0.045    0.045
## 43  ASDQII_11 ~~ ASDQII_15 17.713  0.060   0.060    0.034    0.034
## 44       MLQS =~    APSI_7 17.692  0.126   0.126    0.111    0.111
## 45     APSI_6 ~~     MLQ_1 17.628 -0.170  -0.170   -0.070   -0.070
## 46   ASDQII_4 ~~ ASDQII_17 17.255  0.059   0.059    0.043    0.043
## 47  ASDQII_12 ~~ ASDQII_18 17.200 -0.053  -0.053   -0.036   -0.036
## 48   ASDQII_2 ~~ ASDQII_18 16.845 -0.055  -0.055   -0.041   -0.041
## 49      PWB_1 ~~     MLQ_4 16.837  0.219   0.219    0.086    0.086
## 50       MLQP =~     MLQ_3 16.761  0.174   0.174    0.111    0.111
## 51    Science =~     MLQ_8 16.092  0.165   0.165    0.105    0.105
## 52       MLQP =~    APSI_6 16.079 -0.164  -0.164   -0.115   -0.115
## 53       Math =~  ASDQII_2 16.038 -0.090  -0.090   -0.075   -0.075
## 54   ASDQII_3 ~~ ASDQII_13 15.759  0.052   0.052    0.032    0.032
## 55         F2 =~     LET_5 15.476  0.135   0.135    0.101    0.101
## 56       MLQS =~ ASDQII_15 15.074  0.097   0.097    0.072    0.072
## 57         F1 =~     MLQ_1 14.855 -0.187  -0.187   -0.111   -0.111
## 58    General =~ ASDQII_11 14.739  0.111   0.111    0.085    0.085
## 59  ASDQII_11 ~~ ASDQII_13 14.717 -0.055  -0.055   -0.031   -0.031
## 60         F2 =~ ASDQII_20 14.673  0.100   0.100    0.087    0.087
## 61      LET_1 ~~    APSI_2 14.539 -0.112  -0.112   -0.075   -0.075
## 62  ASDQII_17 ~~ ASDQII_20 14.323 -0.055  -0.055   -0.042   -0.042
## 63       Math =~  ASDQII_1 14.176  0.078   0.078    0.067    0.067
## 64       MLQP =~     MLQ_8 14.077  0.161   0.161    0.103    0.103
## 65       MLQP =~     MLQ_2 13.951 -0.152  -0.152   -0.095   -0.095
## 66       MLQS =~     LET_1 13.899  0.152   0.152    0.111    0.111
## 67         F2 =~     MLQ_8 13.713  0.159   0.159    0.101    0.101
## 68   ASDQII_8 ~~ ASDQII_14 13.539  0.048   0.048    0.024    0.024
## 69  ASDQII_12 ~~ ASDQII_17 13.503 -0.047  -0.047   -0.031   -0.031
## 70      MLQ_5 ~~     MLQ_6 13.388 -0.173  -0.173   -0.070   -0.070
## 71       MLQP =~     MLQ_7 13.298  0.159   0.159    0.101    0.101
## 72   ASDQII_2 ~~ ASDQII_19 13.277  0.051   0.051    0.039    0.039
## 73   ASDQII_3 ~~ ASDQII_16 13.256 -0.049  -0.049   -0.036   -0.036
## 74       MLQP =~     LET_5 13.203  0.136   0.136    0.102    0.102
## 75   ASDQII_1 ~~  ASDQII_6 13.123 -0.049  -0.049   -0.029   -0.029
## 76    General =~     PWB_7 12.938  0.132   0.132    0.102    0.102
## 77   ASDQII_6 ~~  ASDQII_9 12.666  0.058   0.058    0.027    0.027
## 78   ASDQII_6 ~~ ASDQII_11 12.606 -0.047  -0.047   -0.024   -0.024
## 79       MLQP =~    APSI_8 12.565 -0.163  -0.163   -0.135   -0.135
## 80     APSI_2 ~~  ASDQII_7 12.455  0.069   0.069    0.041    0.041
## 81   ASDQII_2 ~~ ASDQII_20 12.452  0.050   0.050    0.036    0.036
## 82    General =~  ASDQII_2 12.422 -0.114  -0.114   -0.095   -0.095
## 83   ASDQII_5 ~~ ASDQII_20 12.412 -0.052  -0.052   -0.037   -0.037
## 84         F1 =~     PWB_7 12.328 -0.129  -0.129   -0.101   -0.101
## 85      MLQ_2 ~~  ASDQII_4 11.890 -0.091  -0.091   -0.047   -0.047
## 86  ASDQII_19 ~~ ASDQII_20 11.726  0.051   0.051    0.040    0.040
## 87       MLQP =~ ASDQII_16 11.615 -0.093  -0.093   -0.079   -0.079
## 88   ASDQII_4 ~~ ASDQII_14 11.422  0.048   0.048    0.030    0.030
## 89    Science =~ ASDQII_18 11.361 -0.105  -0.105   -0.093   -0.093
## 90      LET_1 ~~     LET_5 11.322 -0.121  -0.121   -0.066   -0.066
## 91  ASDQII_13 ~~ ASDQII_19 11.284  0.046   0.046    0.031    0.031
## 92         F2 =~     PWB_1 11.146  0.173   0.173    0.107    0.107
## 93    General =~     MLQ_6 11.102 -0.148  -0.148   -0.088   -0.088
## 94       Math =~     MLQ_8 10.881  0.135   0.135    0.086    0.086
## 95   ASDQII_9 ~~ ASDQII_19 10.845  0.047   0.047    0.029    0.029
## 96       MLQP =~ ASDQII_20 10.820  0.088   0.088    0.076    0.076
## 97      LET_1 ~~ ASDQII_19 10.798 -0.082  -0.082   -0.054   -0.054
## 98       MLQP =~ ASDQII_19 10.759  0.087   0.087    0.078    0.078
## 99   ASDQII_4 ~~ ASDQII_19 10.714 -0.048  -0.048   -0.036   -0.036
## 100    APSI_7 ~~    APSI_8 10.681  0.078   0.078    0.057    0.057
## 101     PWB_1 ~~     LET_1 10.564 -0.171  -0.171   -0.078   -0.078
## 102     MLQ_6 ~~    MLQ_10 10.373 -0.148  -0.148   -0.052   -0.052
## 103     PWB_3 ~~     MLQ_3 10.355 -0.134  -0.134   -0.054   -0.054
## 104      MLQS =~  ASDQII_4 10.328 -0.085  -0.085   -0.070   -0.070
## 105  ASDQII_5 ~~  ASDQII_7 10.249  0.048   0.048    0.026    0.026
## 106      MLQP =~     LET_3 10.239  0.115   0.115    0.087    0.087
## 107     LET_5 ~~ ASDQII_13 10.233  0.068   0.068    0.037    0.037
## 108  ASDQII_9 ~~ ASDQII_12 10.034  0.043   0.043    0.022    0.022
## 109  ASDQII_6 ~~ ASDQII_20 10.015  0.047   0.047    0.027    0.027
## 110      MLQP =~    APSI_7  9.996 -0.144  -0.144   -0.127   -0.127
## 111      MLQP =~     PWB_8  9.893  0.205   0.205    0.147    0.147
## 112   English =~     MLQ_8  9.826  0.130   0.130    0.083    0.083
## 113     MLQ_3 ~~    MLQ_10  9.734  0.168   0.168    0.063    0.063
## 114     PWB_1 ~~     PWB_3  9.607  0.165   0.165    0.065    0.065
## 115     PWB_7 ~~    APSI_2  9.489  0.088   0.088    0.062    0.062
## 116 ASDQII_18 ~~ ASDQII_20  9.357 -0.044  -0.044   -0.034   -0.034
## 117  ASDQII_9 ~~ ASDQII_18  9.329 -0.041  -0.041   -0.025   -0.025
## 118      Math =~     PWB_7  9.081  0.109   0.109    0.085    0.085
## 119   English =~     MLQ_2  8.878 -0.117  -0.117   -0.073   -0.073
## 120     PWB_1 ~~    APSI_2  8.870  0.116   0.116    0.065    0.065
## 121   English =~     MLQ_6  8.771 -0.134  -0.134   -0.080   -0.080
## 122  ASDQII_8 ~~ ASDQII_10  8.770  0.045   0.045    0.021    0.021
## 123  ASDQII_6 ~~  ASDQII_8  8.701 -0.047  -0.047   -0.021   -0.021
## 124        F2 =~ ASDQII_16  8.581 -0.078  -0.078   -0.067   -0.067
## 125     MLQ_7 ~~ ASDQII_16  8.565 -0.082  -0.082   -0.044   -0.044
## 126  ASDQII_1 ~~ ASDQII_13  8.423 -0.037  -0.037   -0.023   -0.023
## 127   English =~ ASDQII_11  8.384  0.062   0.062    0.048    0.048
## 128        F1 =~    APSI_8  8.363  0.086   0.086    0.071    0.071
## 129 ASDQII_14 ~~ ASDQII_19  8.334 -0.039  -0.039   -0.027   -0.027
## 130  ASDQII_3 ~~ ASDQII_11  8.295 -0.034  -0.034   -0.022   -0.022
## 131      MLQS =~ ASDQII_17  8.089 -0.071  -0.071   -0.062   -0.062
## 132 ASDQII_13 ~~ ASDQII_15  8.078 -0.044  -0.044   -0.024   -0.024
## 133 ASDQII_16 ~~ ASDQII_18  8.071  0.042   0.042    0.032    0.032
## 134     LET_1 ~~     MLQ_4  8.068 -0.115  -0.115   -0.053   -0.053
## 135      Math =~  ASDQII_5  8.039  0.066   0.066    0.054    0.054
## 136     LET_1 ~~     MLQ_6  8.028 -0.120  -0.120   -0.052   -0.052
## 137     MLQ_2 ~~     MLQ_3  8.024 -0.143  -0.143   -0.057   -0.057
## 138     LET_5 ~~ ASDQII_16  7.957 -0.062  -0.062   -0.040   -0.040
## 139     LET_1 ~~ ASDQII_18  7.887  0.067   0.067    0.043    0.043
## 140     MLQ_6 ~~     MLQ_3  7.869  0.126   0.126    0.048    0.048
## 141  ASDQII_7 ~~ ASDQII_20  7.866 -0.041  -0.041   -0.023   -0.023
## 142    APSI_6 ~~     MLQ_5  7.790 -0.099  -0.099   -0.047   -0.047
## 143  ASDQII_1 ~~  ASDQII_2  7.773 -0.041  -0.041   -0.029   -0.029
## 144 ASDQII_13 ~~ ASDQII_20  7.705  0.039   0.039    0.024    0.024
## 145    APSI_8 ~~     MLQ_1  7.682 -0.088  -0.088   -0.043   -0.043
## 146  ASDQII_1 ~~ ASDQII_14  7.636 -0.035  -0.035   -0.022   -0.022
## 147     MLQ_4 ~~ ASDQII_16  7.461 -0.071  -0.071   -0.039   -0.039
## 148      Math =~    APSI_8  7.444 -0.079  -0.079   -0.066   -0.066
## 149     PWB_1 ~~     LET_3  7.386 -0.121  -0.121   -0.056   -0.056
## 150   General =~     MLQ_5  7.294  0.106   0.106    0.073    0.073
## 151     LET_5 ~~ ASDQII_19  7.245  0.058   0.058    0.039    0.039
## 152  ASDQII_9 ~~ ASDQII_11  7.216 -0.034  -0.034   -0.018   -0.018
## 153  ASDQII_6 ~~ ASDQII_13  7.193  0.039   0.039    0.019    0.019
## 154     LET_1 ~~     PWB_8  7.129 -0.113  -0.113   -0.059   -0.059
## 155  ASDQII_3 ~~ ASDQII_20  7.128  0.036   0.036    0.026    0.026
## 156        F1 =~     MLQ_8  7.128 -0.117  -0.117   -0.075   -0.075
## 157     LET_5 ~~     MLQ_5  7.118 -0.086  -0.086   -0.044   -0.044
## 158 ASDQII_12 ~~ ASDQII_16  7.080 -0.036  -0.036   -0.024   -0.024
## 159    APSI_7 ~~     MLQ_1  7.017 -0.085  -0.085   -0.044   -0.044
## 160  ASDQII_2 ~~  ASDQII_5  6.980 -0.042  -0.042   -0.029   -0.029
## 161  ASDQII_3 ~~ ASDQII_19  6.963  0.035   0.035    0.027    0.027
## 162     LET_3 ~~     MLQ_1  6.921  0.093   0.093    0.041    0.041
## 163  ASDQII_2 ~~ ASDQII_17  6.791 -0.036  -0.036   -0.026   -0.026
## 164  ASDQII_3 ~~  ASDQII_6  6.748  0.036   0.036    0.021    0.021
## 165      MLQP =~ ASDQII_12  6.724  0.062   0.062    0.047    0.047
## 166    APSI_8 ~~  ASDQII_7  6.657 -0.049  -0.049   -0.027   -0.027
## 167   English =~  ASDQII_6  6.637 -0.060  -0.060   -0.041   -0.041
## 168     LET_3 ~~     PWB_7  6.631 -0.077  -0.077   -0.045   -0.045
## 169      Math =~     PWB_8  6.569  0.107   0.107    0.077    0.077
## 170  ASDQII_1 ~~  ASDQII_9  6.568 -0.034  -0.034   -0.020   -0.020
## 171     LET_1 ~~ ASDQII_20  6.559 -0.064  -0.064   -0.040   -0.040
## 172    MLQ_10 ~~ ASDQII_19  6.534 -0.069  -0.069   -0.037   -0.037
## 173     PWB_8 ~~    APSI_4  6.466 -0.083  -0.083   -0.050   -0.050
## 174    APSI_7 ~~ ASDQII_15  6.460  0.047   0.047    0.031    0.031
## 175      MLQP =~ ASDQII_11  6.396 -0.057  -0.057   -0.044   -0.044
## 176     LET_5 ~~ ASDQII_17  6.365 -0.052  -0.052   -0.034   -0.034
## 177 ASDQII_10 ~~ ASDQII_13  6.348 -0.034  -0.034   -0.017   -0.017
## 178        F1 =~    APSI_7  6.256  0.074   0.074    0.065    0.065
## 179  ASDQII_3 ~~  ASDQII_7  6.236 -0.034  -0.034   -0.019   -0.019
## 180  ASDQII_1 ~~ ASDQII_19  6.223 -0.032  -0.032   -0.025   -0.025
## 181     PWB_7 ~~     MLQ_4  6.192  0.094   0.094    0.046    0.046
## 182 ASDQII_11 ~~ ASDQII_12  6.178 -0.034  -0.034   -0.020   -0.020
## 183  ASDQII_2 ~~ ASDQII_11  6.140 -0.031  -0.031   -0.020   -0.020
## 184   General =~    MLQ_10  6.111 -0.104  -0.104   -0.061   -0.061
## 185    APSI_7 ~~     MLQ_7  6.104  0.079   0.079    0.044    0.044
## 186   English =~ ASDQII_10  6.008  0.054   0.054    0.037    0.037
## 187    APSI_2 ~~     MLQ_7  6.002 -0.080  -0.080   -0.046   -0.046
## 188 ASDQII_11 ~~ ASDQII_19  5.981 -0.031  -0.031   -0.021   -0.021
## 189   General =~ ASDQII_12  5.945 -0.074  -0.074   -0.056   -0.056
## 190   General =~  ASDQII_6  5.926 -0.080  -0.080   -0.055   -0.055
## 191   Science =~ ASDQII_20  5.847  0.079   0.079    0.068    0.068
## 192     MLQ_1 ~~ ASDQII_12  5.788  0.062   0.062    0.028    0.028
## 193  ASDQII_5 ~~ ASDQII_12  5.773 -0.033  -0.033   -0.021   -0.021
## 194  ASDQII_4 ~~  ASDQII_8  5.765  0.034   0.034    0.019    0.019
## 195    MLQ_10 ~~  ASDQII_2  5.727  0.065   0.065    0.032    0.032
## 196  ASDQII_4 ~~ ASDQII_10  5.722 -0.035  -0.035   -0.020   -0.020
## 197      MLQS =~    APSI_2  5.663 -0.072  -0.072   -0.066   -0.066
## 198    APSI_8 ~~     MLQ_6  5.586  0.074   0.074    0.036    0.036
## 199   General =~     PWB_8  5.550  0.100   0.100    0.072    0.072
## 200        F2 =~     LET_3  5.524  0.077   0.077    0.058    0.058
## 201     MLQ_1 ~~     MLQ_7  5.481  0.110   0.110    0.041    0.041
## 202     MLQ_4 ~~     MLQ_3  5.478  0.100   0.100    0.040    0.040
## 203   Science =~     PWB_8  5.445  0.097   0.097    0.070    0.070
## 204   Science =~  ASDQII_1  5.421  0.052   0.052    0.044    0.044
## 205      Math =~     MLQ_6  5.409 -0.100  -0.100   -0.059   -0.059
## 206     MLQ_4 ~~     MLQ_5  5.409 -0.104  -0.104   -0.045   -0.045
## 207      MLQS =~ ASDQII_13  5.394 -0.058  -0.058   -0.042   -0.042
## 208   General =~ ASDQII_10  5.351  0.072   0.072    0.050    0.050
## 209     MLQ_1 ~~ ASDQII_11  5.211 -0.055  -0.055   -0.025   -0.025
## 210        F1 =~     MLQ_2  5.182  0.095   0.095    0.059    0.059
## 211        F1 =~  ASDQII_7  5.156  0.060   0.060    0.040    0.040
## 212      MLQS =~     PWB_3  5.089 -0.093  -0.093   -0.059   -0.059
## 213     LET_1 ~~ ASDQII_15  5.075  0.056   0.056    0.030    0.030
## 214     LET_5 ~~    APSI_4  5.019  0.056   0.056    0.035    0.035
## 215      MLQP =~  ASDQII_6  4.947  0.059   0.059    0.040    0.040
## 216     MLQ_4 ~~    MLQ_10  4.860 -0.097  -0.097   -0.036   -0.036
## 217    MLQ_10 ~~ ASDQII_16  4.836  0.061   0.061    0.031    0.031
## 218    APSI_7 ~~     MLQ_8  4.826  0.069   0.069    0.039    0.039
## 219  ASDQII_8 ~~ ASDQII_15  4.810 -0.029  -0.029   -0.015   -0.015
## 220     PWB_1 ~~    APSI_7  4.788 -0.083  -0.083   -0.046   -0.046
## 221     MLQ_4 ~~     MLQ_6  4.767  0.112   0.112    0.042    0.042
## 222      Math =~ ASDQII_20  4.764  0.070   0.070    0.061    0.061
## 223        F1 =~ ASDQII_19  4.730 -0.057  -0.057   -0.052   -0.052
## 224     PWB_3 ~~     MLQ_7  4.714  0.093   0.093    0.037    0.037
## 225 ASDQII_17 ~~ ASDQII_19  4.707 -0.031  -0.031   -0.025   -0.025
## 226  ASDQII_7 ~~  ASDQII_9  4.692 -0.035  -0.035   -0.016   -0.016
## 227   English =~     MLQ_5  4.654  0.086   0.086    0.059    0.059
## 228     MLQ_8 ~~ ASDQII_13  4.638 -0.057  -0.057   -0.026   -0.026
## 229  ASDQII_5 ~~  ASDQII_9  4.628  0.032   0.032    0.018    0.018
## 230     MLQ_1 ~~ ASDQII_13  4.620  0.058   0.058    0.025    0.025
## 231   General =~  ASDQII_4  4.618 -0.072  -0.072   -0.060   -0.060
## 232    APSI_2 ~~     MLQ_4  4.588  0.066   0.066    0.037    0.037
## 233      MLQS =~     LET_5  4.587 -0.076  -0.076   -0.057   -0.057
## 234     PWB_3 ~~ ASDQII_13  4.564 -0.052  -0.052   -0.024   -0.024
## 235  ASDQII_7 ~~ ASDQII_15  4.557  0.031   0.031    0.015    0.015
## 236        F2 =~     MLQ_2  4.557 -0.087  -0.087   -0.054   -0.054
## 237     MLQ_7 ~~    MLQ_10  4.525 -0.115  -0.115   -0.043   -0.043
## 238  ASDQII_6 ~~  ASDQII_7  4.510  0.035   0.035    0.016    0.016
## 239     LET_5 ~~ ASDQII_11  4.476 -0.041  -0.041   -0.023   -0.023
## 240      MLQS =~     PWB_8  4.473 -0.092  -0.092   -0.066   -0.066
## 241 ASDQII_12 ~~ ASDQII_14  4.460 -0.030  -0.030   -0.017   -0.017
## 242  ASDQII_6 ~~ ASDQII_12  4.430  0.029   0.029    0.015    0.015
## 243 ASDQII_18 ~~ ASDQII_19  4.416 -0.030  -0.030   -0.024   -0.024
## 244   Science =~ ASDQII_19  4.380  0.068   0.068    0.061    0.061
## 245     MLQ_3 ~~ ASDQII_14  4.375 -0.053  -0.053   -0.026   -0.026
## 246     LET_5 ~~ ASDQII_18  4.362 -0.043  -0.043   -0.028   -0.028
## 247   Science =~     MLQ_4  4.360 -0.086  -0.086   -0.054   -0.054
## 248        F2 =~ ASDQII_11  4.322 -0.047  -0.047   -0.036   -0.036
## 249     MLQ_1 ~~  ASDQII_9  4.321  0.057   0.057    0.023    0.023
## 250 ASDQII_10 ~~ ASDQII_12  4.306 -0.027  -0.027   -0.014   -0.014
## 251 ASDQII_13 ~~ ASDQII_14  4.288  0.031   0.031    0.017    0.017
## 252 ASDQII_16 ~~ ASDQII_17  4.281  0.031   0.031    0.023    0.023
## 253   General =~     MLQ_1  4.245  0.093   0.093    0.055    0.055
## 254    APSI_2 ~~     MLQ_5  4.177 -0.058  -0.058   -0.036   -0.036
## 255     MLQ_6 ~~ ASDQII_18  4.174 -0.052  -0.052   -0.027   -0.027
## 256     PWB_3 ~~     LET_5  4.098 -0.079  -0.079   -0.037   -0.037
## 257  ASDQII_2 ~~ ASDQII_10  4.093 -0.028  -0.028   -0.016   -0.016
## 258   English =~     PWB_8  4.084  0.086   0.086    0.062    0.062
## 259     MLQ_8 ~~  ASDQII_7  4.063 -0.056  -0.056   -0.024   -0.024
## 260    APSI_6 ~~  ASDQII_5  4.013 -0.049  -0.049   -0.028   -0.028
## 261   General =~     LET_5  3.959 -0.069  -0.069   -0.051   -0.051
## 262     PWB_1 ~~    APSI_6  3.955  0.100   0.100    0.043    0.043
## 263   Science =~     MLQ_3  3.942 -0.081  -0.081   -0.052   -0.052
## 264     MLQ_8 ~~  ASDQII_1  3.933  0.049   0.049    0.027    0.027
## 265  ASDQII_6 ~~ ASDQII_10  3.930 -0.031  -0.031   -0.015   -0.015
## 266     LET_3 ~~ ASDQII_20  3.914  0.041   0.041    0.026    0.026
## 267      MLQS =~  ASDQII_5  3.912  0.052   0.052    0.043    0.043
## 268     LET_5 ~~     MLQ_3  3.896  0.071   0.071    0.034    0.034
## 269        F1 =~     MLQ_7  3.889 -0.088  -0.088   -0.056   -0.056
## 270   General =~     PWB_3  3.863  0.079   0.079    0.050    0.050
## 271     PWB_1 ~~  ASDQII_5  3.848  0.067   0.067    0.034    0.034
## 272  ASDQII_7 ~~ ASDQII_17  3.845  0.028   0.028    0.016    0.016
fitmeasures(second.fit)
##                npar                fmin               chisq 
##             151.000               1.032            2188.724 
##                  df              pvalue      baseline.chisq 
##             751.000               0.000           32069.444 
##         baseline.df     baseline.pvalue                 cfi 
##             820.000               0.000               0.954 
##                 tli                nnfi                 rfi 
##               0.950               0.950               0.925 
##                 nfi                pnfi                 ifi 
##               0.932               0.853               0.954 
##                 rni                logl   unrestricted.logl 
##               0.954          -51334.226          -50239.864 
##                 aic                 bic              ntotal 
##          102970.453          103720.323            1060.000 
##                bic2               rmsea      rmsea.ci.lower 
##          103240.721               0.042               0.040 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.045               1.000               0.093 
##          rmr_nomean                srmr        srmr_bentler 
##               0.095               0.046               0.046 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.047               0.046               0.047 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.046               0.047             396.123 
##               cn_01                 gfi                agfi 
##             409.793               0.969               0.963 
##                pgfi                 mfi                ecvi 
##               0.807               0.508                  NA
corolations<-(second.fit)
fitted<-fitted(second.fit)