Meta-data

require(lavaan)
require(tidyverse)
require(semPlot)
set.seed(202102)
sessionInfo()
## R version 4.0.4 (2021-02-15)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19041)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] semPlot_1.1.2   forcats_0.5.1   stringr_1.4.0   dplyr_1.0.4    
##  [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.2     tibble_3.0.6   
##  [9] ggplot2_3.3.3   tidyverse_1.3.0 lavaan_0.6-7   
## 
## loaded via a namespace (and not attached):
##   [1] minqa_1.2.4         colorspace_2.0-0    ellipsis_0.3.1     
##   [4] htmlTable_2.1.0     corpcor_1.6.9       base64enc_0.1-3    
##   [7] fs_1.5.0            rstudioapi_0.13     lubridate_1.7.9.2  
##  [10] xml2_1.3.2          splines_4.0.4       mnormt_2.0.2       
##  [13] knitr_1.31          glasso_1.11         Formula_1.2-4      
##  [16] jsonlite_1.7.2      nloptr_1.2.2.2      broom_0.7.5        
##  [19] cluster_2.1.0       dbplyr_2.1.0        png_0.1-7          
##  [22] regsem_1.6.2        compiler_4.0.4      httr_1.4.2         
##  [25] backports_1.2.1     assertthat_0.2.1    Matrix_1.3-2       
##  [28] cli_2.3.0           htmltools_0.5.1.1   tools_4.0.4        
##  [31] OpenMx_2.18.1       igraph_1.2.6        coda_0.19-4        
##  [34] gtable_0.3.0        glue_1.4.2          reshape2_1.4.4     
##  [37] Rcpp_1.0.6          carData_3.0-4       cellranger_1.1.0   
##  [40] jquerylib_0.1.3     vctrs_0.3.6         nlme_3.1-152       
##  [43] lisrelToR_0.1.4     psych_2.0.12        xfun_0.21          
##  [46] openxlsx_4.2.3      lme4_1.1-26         rvest_0.3.6        
##  [49] lifecycle_1.0.0     gtools_3.8.2        XML_3.99-0.5       
##  [52] statmod_1.4.35      MASS_7.3-53         scales_1.1.1       
##  [55] hms_1.0.0           kutils_1.70         parallel_4.0.4     
##  [58] RColorBrewer_1.1-2  yaml_2.2.1          pbapply_1.4-3      
##  [61] gridExtra_2.3       sass_0.3.1          rpart_4.1-15       
##  [64] latticeExtra_0.6-29 stringi_1.5.3       sem_3.1-11         
##  [67] checkmate_2.0.0     boot_1.3-27         zip_2.1.1          
##  [70] truncnorm_1.0-8     rlang_0.4.10        pkgconfig_2.0.3    
##  [73] Rsolnp_1.16         arm_1.11-2          evaluate_0.14      
##  [76] lattice_0.20-41     htmlwidgets_1.5.3   tidyselect_1.1.0   
##  [79] plyr_1.8.6          magrittr_2.0.1      R6_2.5.0           
##  [82] generics_0.1.0      Hmisc_4.4-2         DBI_1.1.1          
##  [85] pillar_1.4.7        haven_2.3.1         foreign_0.8-81     
##  [88] withr_2.4.1         rockchalk_1.8.144   survival_3.2-7     
##  [91] abind_1.4-5         nnet_7.3-15         modelr_0.1.8       
##  [94] crayon_1.4.1        fdrtool_1.2.16      tmvnsim_1.0-2      
##  [97] rmarkdown_2.7       jpeg_0.1-8.1        qgraph_1.6.9       
## [100] grid_4.0.4          readxl_1.3.1        data.table_1.14.0  
## [103] pbivnorm_0.6.0      matrixcalc_1.0-3    reprex_1.0.0       
## [106] digest_0.6.27       xtable_1.8-4        mi_1.0             
## [109] stats4_4.0.4        munsell_0.5.0       bslib_0.2.4

Preprocessing

Data

data <- read.csv(file = "lavaanData.csv", na.strings = "-999", header = F)
colnames(data) <- c(#self reports:
                    paste0("w1bf_", 1:100),
                    paste0("w1epsi_", 1:12), 
                    paste0("w2bf_", 1:100),
                    paste0("w2epsi_", 1:12),
                    paste0("w3bf_", 1:100),
                    paste0("w3epsi_", 1:12),
                    paste0("w4bf_", 1:100),
                    paste0("w4epsi_", 1:12),
                    #peer reports:
                    paste0("pw1bf_", 1:100),
                    paste0("pw1epsi_", 1:12),
                    paste0("pw2bf_", 1:100),
                    paste0("pw2epsi_", 1:12),
                    paste0("pw3bf_", 1:100),
                    paste0("pw3epsi_", 1:12),
                    paste0("pw4bf_", 1:100),
                    paste0("pw4epsi_", 1:12))

Parcels

# self aspect randomization - 0, 4, 6, 7, 8 vs. 1, 2, 3, 5, 9
sample(c(0,1,2,3,4,5,6,7,8,9), 5)
## [1] 4 6 0 7 8
# peer aspect randomization - 1, 2, 4, 5, 6 vs. 0, 3, 7, 8, 9
sample(c(0,1,2,3,4,5,6,7,8,9), 5)
## [1] 2 5 1 4 6
# self domain randomization - 1,3,4,6,7,9,10,30,40,90 vs. 0,2,5,8,00,20,50,60,70,80 
sample(c(0,1,2,3,4,5,6,7,8,9,
         00,10,20,30,40,50,60,70,80,90), 10)
##  [1]  9  4  3 30  1 10 40  7 90  6
# peer domain randomization - 0,2,3,4,8,10,30,40,50,80 vs. 1,5,6,7,9,00,20,60,70,90
sample(c(0,1,2,3,4,5,6,7,8,9,
         00,10,20,30,40,50,60,70,80,90), 10)
##  [1] 30 50  2  0  3 80 10  8 40  4
# self identity randomization 
sample(c(1,3,7,10,11,12), 3) #confusion - 7,10,11 vs. 1,3,12
## [1]  7 11 10
sample(c(2,4,5,6,8,9), 3) #coherence - 2,5,6 vs. 4,8,9
## [1] 5 2 6
# peer identity randomization 
sample(c(1,3,7,10,11,12), 3) #confusion - 3,7,12 vs. 1,10,11
## [1]  3  7 12
sample(c(2,4,5,6,8,9), 3) #coherence - 4,5,9 vs. 2,6,8
## [1] 4 9 5
# >>> Aspects ----

# assertiveness 
data <- data %>% 
  mutate(# self
         assertW1S = rowMeans(select(data, w1bf_9, w1bf_19, w1bf_29, w1bf_39, w1bf_49, w1bf_59,
                                     w1bf_69, w1bf_79, w1bf_89, w1bf_99), na.rm = T),
         assertW2S = rowMeans(select(data, w2bf_9, w2bf_19, w2bf_29, w2bf_39, w2bf_49, w2bf_59,
                                     w2bf_69, w2bf_79, w2bf_89, w2bf_99), na.rm = T),
         assertW3S = rowMeans(select(data, w3bf_9, w3bf_19, w3bf_29, w3bf_39, w3bf_49, w3bf_59,
                                     w3bf_69, w3bf_79, w3bf_89, w3bf_99), na.rm = T),
         assertW4S = rowMeans(select(data, w4bf_9, w4bf_19, w4bf_29, w4bf_39, w4bf_49, w4bf_59,
                                     w4bf_69, w4bf_79, w4bf_89, w4bf_99), na.rm = T),
         
         # peer
         assertW1P = rowMeans(select(data, pw1bf_9, pw1bf_19, pw1bf_29, pw1bf_39, pw1bf_49, pw1bf_59,
                                     pw1bf_69, pw1bf_79, pw1bf_89, pw1bf_99), na.rm = T),
         assertW2P = rowMeans(select(data, pw2bf_9, pw2bf_19, pw2bf_29, pw2bf_39, pw2bf_49, pw2bf_59,
                                     pw2bf_69, pw2bf_79, pw2bf_89, pw2bf_99), na.rm = T),
         assertW3P = rowMeans(select(data, pw3bf_9, pw3bf_19, pw3bf_29, pw3bf_39, pw3bf_49, pw3bf_59,
                                     pw3bf_69, pw3bf_79, pw3bf_89, pw3bf_99), na.rm = T),
         assertW4P = rowMeans(select(data, pw4bf_9, pw4bf_19, pw4bf_29, pw4bf_39, pw4bf_49, pw4bf_59,
                                     pw4bf_69, pw4bf_79, pw4bf_89, pw4bf_99), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         assertW1S1 = rowMeans(select(data, w1bf_9, w1bf_49, w1bf_69, w1bf_79, w1bf_89),na.rm = T),
         assertW2S1 = rowMeans(select(data, w2bf_9, w2bf_49, w2bf_69, w2bf_79, w2bf_89),na.rm = T),
         assertW3S1 = rowMeans(select(data, w3bf_9, w3bf_49, w3bf_69, w3bf_79, w3bf_89),na.rm = T),
         assertW4S1 = rowMeans(select(data, w4bf_9, w4bf_49, w4bf_69, w4bf_79, w4bf_89),na.rm = T),
         
         # second self parcel
         assertW1S2 = rowMeans(select(data, w1bf_19, w1bf_29, w1bf_39, w1bf_59, w1bf_99),na.rm = T),
         assertW2S2 = rowMeans(select(data, w2bf_19, w2bf_29, w2bf_39, w2bf_59, w2bf_99),na.rm = T),
         assertW3S2 = rowMeans(select(data, w3bf_19, w3bf_29, w3bf_39, w3bf_59, w3bf_99),na.rm = T),
         assertW4S2 = rowMeans(select(data, w4bf_19, w4bf_29, w4bf_39, w4bf_59, w4bf_99),na.rm = T),
         
         # first peer parcel
         assertW1P1 = rowMeans(select(data, pw1bf_19, pw1bf_29, pw1bf_49, pw1bf_59, pw1bf_69), na.rm = T),
         assertW2P1 = rowMeans(select(data, pw2bf_19, pw2bf_29, pw2bf_49, pw2bf_59, pw2bf_69), na.rm = T),
         assertW3P1 = rowMeans(select(data, pw3bf_19, pw3bf_29, pw3bf_49, pw3bf_59, pw3bf_69), na.rm = T),
         assertW4P1 = rowMeans(select(data, pw4bf_19, pw4bf_29, pw4bf_49, pw4bf_59, pw4bf_69), na.rm = T),
         
         # second peer parcel
         assertW1P2 = rowMeans(select(data, pw1bf_9, pw1bf_39, pw1bf_79, pw1bf_89, pw1bf_99), na.rm = T),
         assertW2P2 = rowMeans(select(data, pw2bf_9, pw2bf_39, pw2bf_79, pw2bf_89, pw2bf_99), na.rm = T),
         assertW3P2 = rowMeans(select(data, pw3bf_9, pw3bf_39, pw3bf_79, pw3bf_89, pw3bf_99), na.rm = T),
         assertW4P2 = rowMeans(select(data, pw4bf_9, pw4bf_39, pw4bf_79, pw4bf_89, pw4bf_99), na.rm = T))

# compassion
data <- data %>% 
  mutate(# self
         compaW1S = rowMeans(select(data, w1bf_2, w1bf_12, w1bf_22, w1bf_32, w1bf_42, w1bf_52,
                                     w1bf_62, w1bf_72, w1bf_82, w1bf_92), na.rm = T),
         compaW2S = rowMeans(select(data, w2bf_2, w2bf_12, w2bf_22, w2bf_32, w2bf_42, w2bf_52,
                                     w2bf_62, w2bf_72, w2bf_82, w2bf_92), na.rm = T),
         compaW3S = rowMeans(select(data, w3bf_2, w3bf_12, w3bf_22, w3bf_32, w3bf_42, w3bf_52,
                                     w3bf_62, w3bf_72, w3bf_82, w3bf_92), na.rm = T),
         compaW4S = rowMeans(select(data, w4bf_2, w4bf_12, w4bf_22, w4bf_32, w4bf_42, w4bf_52,
                                     w4bf_62, w4bf_72, w4bf_82, w4bf_92), na.rm = T),
         
         # peer
         compaW1P = rowMeans(select(data, pw1bf_2, pw1bf_12, pw1bf_22, pw1bf_32, pw1bf_42, pw1bf_52,
                                     pw1bf_62, pw1bf_72, pw1bf_82, pw1bf_92), na.rm = T),
         compaW2P = rowMeans(select(data, pw2bf_2, pw2bf_12, pw2bf_22, pw2bf_32, pw2bf_42, pw2bf_52,
                                     pw2bf_62, pw2bf_72, pw2bf_82, pw2bf_92), na.rm = T),
         compaW3P = rowMeans(select(data, pw3bf_2, pw3bf_12, pw3bf_22, pw3bf_32, pw3bf_42, pw3bf_52,
                                     pw3bf_62, pw3bf_72, pw3bf_82, pw3bf_92), na.rm = T),
         compaW4P = rowMeans(select(data, pw4bf_2, pw4bf_12, pw4bf_22, pw4bf_32, pw4bf_42, pw4bf_52,
                                     pw4bf_62, pw4bf_72, pw4bf_82, pw4bf_92), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         compaW1S1 = rowMeans(select(data, w1bf_2, w1bf_42, w1bf_62, w1bf_72, w1bf_82),na.rm = T),
         compaW2S1 = rowMeans(select(data, w2bf_2, w2bf_42, w2bf_62, w2bf_72, w2bf_82),na.rm = T),
         compaW3S1 = rowMeans(select(data, w3bf_2, w3bf_42, w3bf_62, w3bf_72, w3bf_82),na.rm = T),
         compaW4S1 = rowMeans(select(data, w4bf_2, w4bf_42, w4bf_62, w4bf_72, w4bf_82),na.rm = T),
         
         # second self parcel
         compaW1S2 = rowMeans(select(data, w1bf_12, w1bf_22, w1bf_32, w1bf_52, w1bf_92),na.rm = T),
         compaW2S2 = rowMeans(select(data, w2bf_12, w2bf_22, w2bf_32, w2bf_52, w2bf_92),na.rm = T),
         compaW3S2 = rowMeans(select(data, w3bf_12, w3bf_22, w3bf_32, w3bf_52, w3bf_92),na.rm = T),
         compaW4S2 = rowMeans(select(data, w4bf_12, w4bf_22, w4bf_32, w4bf_52, w4bf_92),na.rm = T),
         
         # first peer parcel
         compaW1P1 = rowMeans(select(data, pw1bf_12, pw1bf_22, pw1bf_42, pw1bf_52, pw1bf_62), na.rm = T),
         compaW2P1 = rowMeans(select(data, pw2bf_12, pw2bf_22, pw2bf_42, pw2bf_52, pw2bf_62), na.rm = T),
         compaW3P1 = rowMeans(select(data, pw3bf_12, pw3bf_22, pw3bf_42, pw3bf_52, pw3bf_62), na.rm = T),
         compaW4P1 = rowMeans(select(data, pw4bf_12, pw4bf_22, pw4bf_42, pw4bf_52, pw4bf_62), na.rm = T),
         
         # second peer parcel
         compaW1P2 = rowMeans(select(data, pw1bf_2, pw1bf_32, pw1bf_72, pw1bf_82, pw1bf_92), na.rm = T),
         compaW2P2 = rowMeans(select(data, pw2bf_2, pw2bf_32, pw2bf_72, pw2bf_82, pw2bf_92), na.rm = T),
         compaW3P2 = rowMeans(select(data, pw3bf_2, pw3bf_32, pw3bf_72, pw3bf_82, pw3bf_92), na.rm = T),
         compaW4P2 = rowMeans(select(data, pw4bf_2, pw4bf_32, pw4bf_72, pw4bf_82, pw4bf_92), na.rm = T))

# enthusiasm
data <- data %>% 
  mutate(# self
         enthuW1S = rowMeans(select(data, w1bf_4, w1bf_14, w1bf_24, w1bf_34, w1bf_44, w1bf_54,
                                     w1bf_64, w1bf_74, w1bf_84, w1bf_94), na.rm = T),
         enthuW2S = rowMeans(select(data, w2bf_4, w2bf_14, w2bf_24, w2bf_34, w2bf_44, w2bf_54,
                                     w2bf_64, w2bf_74, w2bf_84, w2bf_94), na.rm = T),
         enthuW3S = rowMeans(select(data, w3bf_4, w3bf_14, w3bf_24, w3bf_34, w3bf_44, w3bf_54,
                                     w3bf_64, w3bf_74, w3bf_84, w3bf_94), na.rm = T),
         enthuW4S = rowMeans(select(data, w4bf_4, w4bf_14, w4bf_24, w4bf_34, w4bf_44, w4bf_54,
                                     w4bf_64, w4bf_74, w4bf_84, w4bf_94), na.rm = T),
         
         # peer
         enthuW1P = rowMeans(select(data, pw1bf_4, pw1bf_14, pw1bf_24, pw1bf_34, pw1bf_44, pw1bf_54,
                                     pw1bf_64, pw1bf_74, pw1bf_84, pw1bf_94), na.rm = T),
         enthuW2P = rowMeans(select(data, pw2bf_4, pw2bf_14, pw2bf_24, pw2bf_34, pw2bf_44, pw2bf_54,
                                     pw2bf_64, pw2bf_74, pw2bf_84, pw2bf_94), na.rm = T),
         enthuW3P = rowMeans(select(data, pw3bf_4, pw3bf_14, pw3bf_24, pw3bf_34, pw3bf_44, pw3bf_54,
                                     pw3bf_64, pw3bf_74, pw3bf_84, pw3bf_94), na.rm = T),
         enthuW4P = rowMeans(select(data, pw4bf_4, pw4bf_14, pw4bf_24, pw4bf_34, pw4bf_44, pw4bf_54,
                                     pw4bf_64, pw4bf_74, pw4bf_84, pw4bf_94), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         enthuW1S1 = rowMeans(select(data, w1bf_4, w1bf_44, w1bf_64, w1bf_74, w1bf_84),na.rm = T),
         enthuW2S1 = rowMeans(select(data, w2bf_4, w2bf_44, w2bf_64, w2bf_74, w2bf_84),na.rm = T),
         enthuW3S1 = rowMeans(select(data, w3bf_4, w3bf_44, w3bf_64, w3bf_74, w3bf_84),na.rm = T),
         enthuW4S1 = rowMeans(select(data, w4bf_4, w4bf_44, w4bf_64, w4bf_74, w4bf_84),na.rm = T),
         
         # second self parcel
         enthuW1S2 = rowMeans(select(data, w1bf_14, w1bf_24, w1bf_34, w1bf_54, w1bf_94),na.rm = T),
         enthuW2S2 = rowMeans(select(data, w2bf_14, w2bf_24, w2bf_34, w2bf_54, w2bf_94),na.rm = T),
         enthuW3S2 = rowMeans(select(data, w3bf_14, w3bf_24, w3bf_34, w3bf_54, w3bf_94),na.rm = T),
         enthuW4S2 = rowMeans(select(data, w4bf_14, w4bf_24, w4bf_34, w4bf_54, w4bf_94),na.rm = T),
         
         # first peer parcel
         enthuW1P1 = rowMeans(select(data, pw1bf_14, pw1bf_24, pw1bf_44, pw1bf_54, pw1bf_64), na.rm = T),
         enthuW2P1 = rowMeans(select(data, pw2bf_14, pw2bf_24, pw2bf_44, pw2bf_54, pw2bf_64), na.rm = T),
         enthuW3P1 = rowMeans(select(data, pw3bf_14, pw3bf_24, pw3bf_44, pw3bf_54, pw3bf_64), na.rm = T),
         enthuW4P1 = rowMeans(select(data, pw4bf_14, pw4bf_24, pw4bf_44, pw4bf_54, pw4bf_64), na.rm = T),
         
         # second peer parcel
         enthuW1P2 = rowMeans(select(data, pw1bf_4, pw1bf_34, pw1bf_74, pw1bf_84, pw1bf_94), na.rm = T),
         enthuW2P2 = rowMeans(select(data, pw2bf_4, pw2bf_34, pw2bf_74, pw2bf_84, pw2bf_94), na.rm = T),
         enthuW3P2 = rowMeans(select(data, pw3bf_4, pw3bf_34, pw3bf_74, pw3bf_84, pw3bf_94), na.rm = T),
         enthuW4P2 = rowMeans(select(data, pw4bf_4, pw4bf_34, pw4bf_74, pw4bf_84, pw4bf_94), na.rm = T))

# industriousness
data <- data %>% 
  mutate(# self
         indusW1S = rowMeans(select(data, w1bf_3, w1bf_13, w1bf_23, w1bf_33, w1bf_43, w1bf_53,
                                     w1bf_63, w1bf_73, w1bf_83, w1bf_93), na.rm = T),
         indusW2S = rowMeans(select(data, w2bf_3, w2bf_13, w2bf_23, w2bf_33, w2bf_43, w2bf_53,
                                     w2bf_63, w2bf_73, w2bf_83, w2bf_93), na.rm = T),
         indusW3S = rowMeans(select(data, w3bf_3, w3bf_13, w3bf_23, w3bf_33, w3bf_43, w3bf_53,
                                     w3bf_63, w3bf_73, w3bf_83, w3bf_93), na.rm = T),
         indusW4S = rowMeans(select(data, w4bf_3, w4bf_13, w4bf_23, w4bf_33, w4bf_43, w4bf_53,
                                     w4bf_63, w4bf_73, w4bf_83, w4bf_93), na.rm = T),
         
         # peer
         indusW1P = rowMeans(select(data, pw1bf_3, pw1bf_13, pw1bf_23, pw1bf_33, pw1bf_43, pw1bf_53,
                                     pw1bf_63, pw1bf_73, pw1bf_83, pw1bf_93), na.rm = T),
         indusW2P = rowMeans(select(data, pw2bf_3, pw2bf_13, pw2bf_23, pw2bf_33, pw2bf_43, pw2bf_53,
                                     pw2bf_63, pw2bf_73, pw2bf_83, pw2bf_93), na.rm = T),
         indusW3P = rowMeans(select(data, pw3bf_3, pw3bf_13, pw3bf_23, pw3bf_33, pw3bf_43, pw3bf_53,
                                     pw3bf_63, pw3bf_73, pw3bf_83, pw3bf_93), na.rm = T),
         indusW4P = rowMeans(select(data, pw4bf_3, pw4bf_13, pw4bf_23, pw4bf_33, pw4bf_43, pw4bf_53,
                                     pw4bf_63, pw4bf_73, pw4bf_83, pw4bf_93), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         indusW1S1 = rowMeans(select(data, w1bf_3, w1bf_43, w1bf_63, w1bf_73, w1bf_83),na.rm = T),
         indusW2S1 = rowMeans(select(data, w2bf_3, w2bf_43, w2bf_63, w2bf_73, w2bf_83),na.rm = T),
         indusW3S1 = rowMeans(select(data, w3bf_3, w3bf_43, w3bf_63, w3bf_73, w3bf_83),na.rm = T),
         indusW4S1 = rowMeans(select(data, w4bf_3, w4bf_43, w4bf_63, w4bf_73, w4bf_83),na.rm = T),
         
         # second self parcel
         indusW1S2 = rowMeans(select(data, w1bf_13, w1bf_23, w1bf_33, w1bf_53, w1bf_93),na.rm = T),
         indusW2S2 = rowMeans(select(data, w2bf_13, w2bf_23, w2bf_33, w2bf_53, w2bf_93),na.rm = T),
         indusW3S2 = rowMeans(select(data, w3bf_13, w3bf_23, w3bf_33, w3bf_53, w3bf_93),na.rm = T),
         indusW4S2 = rowMeans(select(data, w4bf_13, w4bf_23, w4bf_33, w4bf_53, w4bf_93),na.rm = T),
         
         # first peer parcel
         indusW1P1 = rowMeans(select(data, pw1bf_13, pw1bf_23, pw1bf_43, pw1bf_53, pw1bf_63), na.rm = T),
         indusW2P1 = rowMeans(select(data, pw2bf_13, pw2bf_23, pw2bf_43, pw2bf_53, pw2bf_63), na.rm = T),
         indusW3P1 = rowMeans(select(data, pw3bf_13, pw3bf_23, pw3bf_43, pw3bf_53, pw3bf_63), na.rm = T),
         indusW4P1 = rowMeans(select(data, pw4bf_13, pw4bf_23, pw4bf_43, pw4bf_53, pw4bf_63), na.rm = T),
         
         # second peer parcel
         indusW1P2 = rowMeans(select(data, pw1bf_3, pw1bf_33, pw1bf_73, pw1bf_83, pw1bf_93), na.rm = T),
         indusW2P2 = rowMeans(select(data, pw2bf_3, pw2bf_33, pw2bf_73, pw2bf_83, pw2bf_93), na.rm = T),
         indusW3P2 = rowMeans(select(data, pw3bf_3, pw3bf_33, pw3bf_73, pw3bf_83, pw3bf_93), na.rm = T),
         indusW4P2 = rowMeans(select(data, pw4bf_3, pw4bf_33, pw4bf_73, pw4bf_83, pw4bf_93), na.rm = T))

# intellect
data <- data %>% 
  mutate(# self
         intelW1S = rowMeans(select(data, w1bf_5, w1bf_15, w1bf_25, w1bf_35, w1bf_45, w1bf_55,
                                     w1bf_65, w1bf_75, w1bf_85, w1bf_95), na.rm = T),
         intelW2S = rowMeans(select(data, w2bf_5, w2bf_15, w2bf_25, w2bf_35, w2bf_45, w2bf_55,
                                     w2bf_65, w2bf_75, w2bf_85, w2bf_95), na.rm = T),
         intelW3S = rowMeans(select(data, w3bf_5, w3bf_15, w3bf_25, w3bf_35, w3bf_45, w3bf_55,
                                     w3bf_65, w3bf_75, w3bf_85, w3bf_95), na.rm = T),
         intelW4S = rowMeans(select(data, w4bf_5, w4bf_15, w4bf_25, w4bf_35, w4bf_45, w4bf_55,
                                     w4bf_65, w4bf_75, w4bf_85, w4bf_95), na.rm = T),
         
         # peer
         intelW1P = rowMeans(select(data, pw1bf_5, pw1bf_15, pw1bf_25, pw1bf_35, pw1bf_45, pw1bf_55,
                                     pw1bf_65, pw1bf_75, pw1bf_85, pw1bf_95), na.rm = T),
         intelW2P = rowMeans(select(data, pw2bf_5, pw2bf_15, pw2bf_25, pw2bf_35, pw2bf_45, pw2bf_55,
                                     pw2bf_65, pw2bf_75, pw2bf_85, pw2bf_95), na.rm = T),
         intelW3P = rowMeans(select(data, pw3bf_5, pw3bf_15, pw3bf_25, pw3bf_35, pw3bf_45, pw3bf_55,
                                     pw3bf_65, pw3bf_75, pw3bf_85, pw3bf_95), na.rm = T),
         intelW4P = rowMeans(select(data, pw4bf_5, pw4bf_15, pw4bf_25, pw4bf_35, pw4bf_45, pw4bf_55,
                                     pw4bf_65, pw4bf_75, pw4bf_85, pw4bf_95), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         intelW1S1 = rowMeans(select(data, w1bf_5, w1bf_45, w1bf_65, w1bf_75, w1bf_85),na.rm = T),
         intelW2S1 = rowMeans(select(data, w2bf_5, w2bf_45, w2bf_65, w2bf_75, w2bf_85),na.rm = T),
         intelW3S1 = rowMeans(select(data, w3bf_5, w3bf_45, w3bf_65, w3bf_75, w3bf_85),na.rm = T),
         intelW4S1 = rowMeans(select(data, w4bf_5, w4bf_45, w4bf_65, w4bf_75, w4bf_85),na.rm = T),
         
         # second self parcel
         intelW1S2 = rowMeans(select(data, w1bf_15, w1bf_25, w1bf_35, w1bf_55, w1bf_95),na.rm = T),
         intelW2S2 = rowMeans(select(data, w2bf_15, w2bf_25, w2bf_35, w2bf_55, w2bf_95),na.rm = T),
         intelW3S2 = rowMeans(select(data, w3bf_15, w3bf_25, w3bf_35, w3bf_55, w3bf_95),na.rm = T),
         intelW4S2 = rowMeans(select(data, w4bf_15, w4bf_25, w4bf_35, w4bf_55, w4bf_95),na.rm = T),
         
         # first peer parcel
         intelW1P1 = rowMeans(select(data, pw1bf_15, pw1bf_25, pw1bf_45, pw1bf_55, pw1bf_65), na.rm = T),
         intelW2P1 = rowMeans(select(data, pw2bf_15, pw2bf_25, pw2bf_45, pw2bf_55, pw2bf_65), na.rm = T),
         intelW3P1 = rowMeans(select(data, pw3bf_15, pw3bf_25, pw3bf_45, pw3bf_55, pw3bf_65), na.rm = T),
         intelW4P1 = rowMeans(select(data, pw4bf_15, pw4bf_25, pw4bf_45, pw4bf_55, pw4bf_65), na.rm = T),
         
         # second peer parcel
         intelW1P2 = rowMeans(select(data, pw1bf_5, pw1bf_35, pw1bf_75, pw1bf_85, pw1bf_95), na.rm = T),
         intelW2P2 = rowMeans(select(data, pw2bf_5, pw2bf_35, pw2bf_75, pw2bf_85, pw2bf_95), na.rm = T),
         intelW3P2 = rowMeans(select(data, pw3bf_5, pw3bf_35, pw3bf_75, pw3bf_85, pw3bf_95), na.rm = T),
         intelW4P2 = rowMeans(select(data, pw4bf_5, pw4bf_35, pw4bf_75, pw4bf_85, pw4bf_95), na.rm = T))

# openness aspect
data <- data %>% 
  mutate(# self
         openaW1S = rowMeans(select(data, w1bf_100, w1bf_10, w1bf_20, w1bf_30, w1bf_40, w1bf_50,
                                     w1bf_60, w1bf_70, w1bf_80, w1bf_90), na.rm = T),
         openaW2S = rowMeans(select(data, w2bf_100, w2bf_10, w2bf_20, w2bf_30, w2bf_40, w2bf_50,
                                     w2bf_60, w2bf_70, w2bf_80, w2bf_90), na.rm = T),
         openaW3S = rowMeans(select(data, w3bf_100, w3bf_10, w3bf_20, w3bf_30, w3bf_40, w3bf_50,
                                     w3bf_60, w3bf_70, w3bf_80, w3bf_90), na.rm = T),
         openaW4S = rowMeans(select(data, w4bf_100, w4bf_10, w4bf_20, w4bf_30, w4bf_40, w4bf_50,
                                     w4bf_60, w4bf_70, w4bf_80, w4bf_90), na.rm = T),
         
         # peer
         openaW1P = rowMeans(select(data, pw1bf_100, pw1bf_10, pw1bf_20, pw1bf_30, pw1bf_40, pw1bf_50,
                                     pw1bf_60, pw1bf_70, pw1bf_80, pw1bf_90), na.rm = T),
         openaW2P = rowMeans(select(data, pw2bf_100, pw2bf_10, pw2bf_20, pw2bf_30, pw2bf_40, pw2bf_50,
                                     pw2bf_60, pw2bf_70, pw2bf_80, pw2bf_90), na.rm = T),
         openaW3P = rowMeans(select(data, pw3bf_100, pw3bf_10, pw3bf_20, pw3bf_30, pw3bf_40, pw3bf_50,
                                     pw3bf_60, pw3bf_70, pw3bf_80, pw3bf_90), na.rm = T),
         openaW4P = rowMeans(select(data, pw4bf_100, pw4bf_10, pw4bf_20, pw4bf_30, pw4bf_40, pw4bf_50,
                                     pw4bf_60, pw4bf_70, pw4bf_80, pw4bf_90), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         openaW1S1 = rowMeans(select(data, w1bf_100, w1bf_40, w1bf_60, w1bf_70, w1bf_84),na.rm = T),
         openaW2S1 = rowMeans(select(data, w2bf_100, w2bf_40, w2bf_60, w2bf_70, w2bf_84),na.rm = T),
         openaW3S1 = rowMeans(select(data, w3bf_100, w3bf_40, w3bf_60, w3bf_70, w3bf_84),na.rm = T),
         openaW4S1 = rowMeans(select(data, w4bf_100, w4bf_40, w4bf_60, w4bf_70, w4bf_84),na.rm = T),
         
         # second self parcel
         openaW1S2 = rowMeans(select(data, w1bf_10, w1bf_20, w1bf_30, w1bf_50, w1bf_94),na.rm = T),
         openaW2S2 = rowMeans(select(data, w2bf_10, w2bf_20, w2bf_30, w2bf_50, w2bf_94),na.rm = T),
         openaW3S2 = rowMeans(select(data, w3bf_10, w3bf_20, w3bf_30, w3bf_50, w3bf_94),na.rm = T),
         openaW4S2 = rowMeans(select(data, w4bf_10, w4bf_20, w4bf_30, w4bf_50, w4bf_94),na.rm = T),
         
         # first peer parcel
         openaW1P1 = rowMeans(select(data, pw1bf_10, pw1bf_20, pw1bf_40, pw1bf_50, pw1bf_64), na.rm = T),
         openaW2P1 = rowMeans(select(data, pw2bf_10, pw2bf_20, pw2bf_40, pw2bf_50, pw2bf_64), na.rm = T),
         openaW3P1 = rowMeans(select(data, pw3bf_10, pw3bf_20, pw3bf_40, pw3bf_50, pw3bf_64), na.rm = T),
         openaW4P1 = rowMeans(select(data, pw4bf_10, pw4bf_20, pw4bf_40, pw4bf_50, pw4bf_64), na.rm = T),
         
         # second peer parcel
         openaW1P2 = rowMeans(select(data, pw1bf_100, pw1bf_30, pw1bf_70, pw1bf_80, pw1bf_94), na.rm = T),
         openaW2P2 = rowMeans(select(data, pw2bf_100, pw2bf_30, pw2bf_70, pw2bf_80, pw2bf_94), na.rm = T),
         openaW3P2 = rowMeans(select(data, pw3bf_100, pw3bf_30, pw3bf_70, pw3bf_80, pw3bf_94), na.rm = T),
         openaW4P2 = rowMeans(select(data, pw4bf_100, pw4bf_30, pw4bf_70, pw4bf_80, pw4bf_94), na.rm = T))

# orderliness
data <- data %>% 
  mutate(# self
         orderW1S = rowMeans(select(data, w1bf_8, w1bf_18, w1bf_28, w1bf_38, w1bf_48, w1bf_58,
                                     w1bf_68, w1bf_78, w1bf_88, w1bf_98), na.rm = T),
         orderW2S = rowMeans(select(data, w2bf_8, w2bf_18, w2bf_28, w2bf_38, w2bf_48, w2bf_58,
                                     w2bf_68, w2bf_78, w2bf_88, w2bf_98), na.rm = T),
         orderW3S = rowMeans(select(data, w3bf_8, w3bf_18, w3bf_28, w3bf_38, w3bf_48, w3bf_58,
                                     w3bf_68, w3bf_78, w3bf_88, w3bf_98), na.rm = T),
         orderW4S = rowMeans(select(data, w4bf_8, w4bf_18, w4bf_28, w4bf_38, w4bf_48, w4bf_58,
                                     w4bf_68, w4bf_78, w4bf_88, w4bf_98), na.rm = T),
         
         # peer
         orderW1P = rowMeans(select(data, pw1bf_8, pw1bf_18, pw1bf_28, pw1bf_38, pw1bf_48, pw1bf_58,
                                     pw1bf_68, pw1bf_78, pw1bf_88, pw1bf_98), na.rm = T),
         orderW2P = rowMeans(select(data, pw2bf_8, pw2bf_18, pw2bf_28, pw2bf_38, pw2bf_48, pw2bf_58,
                                     pw2bf_68, pw2bf_78, pw2bf_88, pw2bf_98), na.rm = T),
         orderW3P = rowMeans(select(data, pw3bf_8, pw3bf_18, pw3bf_28, pw3bf_38, pw3bf_48, pw3bf_58,
                                     pw3bf_68, pw3bf_78, pw3bf_88, pw3bf_98), na.rm = T),
         orderW4P = rowMeans(select(data, pw4bf_8, pw4bf_18, pw4bf_28, pw4bf_38, pw4bf_48, pw4bf_58,
                                     pw4bf_68, pw4bf_78, pw4bf_88, pw4bf_98), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         orderW1S1 = rowMeans(select(data, w1bf_8, w1bf_48, w1bf_68, w1bf_78, w1bf_88),na.rm = T),
         orderW2S1 = rowMeans(select(data, w2bf_8, w2bf_48, w2bf_68, w2bf_78, w2bf_88),na.rm = T),
         orderW3S1 = rowMeans(select(data, w3bf_8, w3bf_48, w3bf_68, w3bf_78, w3bf_88),na.rm = T),
         orderW4S1 = rowMeans(select(data, w4bf_8, w4bf_48, w4bf_68, w4bf_78, w4bf_88),na.rm = T),
         
         # second self parcel
         orderW1S2 = rowMeans(select(data, w1bf_18, w1bf_28, w1bf_38, w1bf_58, w1bf_98),na.rm = T),
         orderW2S2 = rowMeans(select(data, w2bf_18, w2bf_28, w2bf_38, w2bf_58, w2bf_98),na.rm = T),
         orderW3S2 = rowMeans(select(data, w3bf_18, w3bf_28, w3bf_38, w3bf_58, w3bf_98),na.rm = T),
         orderW4S2 = rowMeans(select(data, w4bf_18, w4bf_28, w4bf_38, w4bf_58, w4bf_98),na.rm = T),
         
         # first peer parcel
         orderW1P1 = rowMeans(select(data, pw1bf_18, pw1bf_28, pw1bf_48, pw1bf_58, pw1bf_68), na.rm = T),
         orderW2P1 = rowMeans(select(data, pw2bf_18, pw2bf_28, pw2bf_48, pw2bf_58, pw2bf_68), na.rm = T),
         orderW3P1 = rowMeans(select(data, pw3bf_18, pw3bf_28, pw3bf_48, pw3bf_58, pw3bf_68), na.rm = T),
         orderW4P1 = rowMeans(select(data, pw4bf_18, pw4bf_28, pw4bf_48, pw4bf_58, pw4bf_68), na.rm = T),
         
         # second peer parcel
         orderW1P2 = rowMeans(select(data, pw1bf_8, pw1bf_38, pw1bf_78, pw1bf_88, pw1bf_98), na.rm = T),
         orderW2P2 = rowMeans(select(data, pw2bf_8, pw2bf_38, pw2bf_78, pw2bf_88, pw2bf_98), na.rm = T),
         orderW3P2 = rowMeans(select(data, pw3bf_8, pw3bf_38, pw3bf_78, pw3bf_88, pw3bf_98), na.rm = T),
         orderW4P2 = rowMeans(select(data, pw4bf_8, pw4bf_38, pw4bf_78, pw4bf_88, pw4bf_98), na.rm = T))

# politeness
data <- data %>% 
  mutate(# self
         politW1S = rowMeans(select(data, w1bf_7, w1bf_17, w1bf_27, w1bf_37, w1bf_47, w1bf_57,
                                     w1bf_67, w1bf_77, w1bf_87, w1bf_97), na.rm = T),
         politW2S = rowMeans(select(data, w2bf_7, w2bf_17, w2bf_27, w2bf_37, w2bf_47, w2bf_57,
                                     w2bf_67, w2bf_77, w2bf_87, w2bf_97), na.rm = T),
         politW3S = rowMeans(select(data, w3bf_7, w3bf_17, w3bf_27, w3bf_37, w3bf_47, w3bf_57,
                                     w3bf_67, w3bf_77, w3bf_87, w3bf_97), na.rm = T),
         politW4S = rowMeans(select(data, w4bf_7, w4bf_17, w4bf_27, w4bf_37, w4bf_47, w4bf_57,
                                     w4bf_67, w4bf_77, w4bf_87, w4bf_97), na.rm = T),
         
         # peer
         politW1P = rowMeans(select(data, pw1bf_7, pw1bf_17, pw1bf_27, pw1bf_37, pw1bf_47, pw1bf_57,
                                     pw1bf_67, pw1bf_77, pw1bf_87, pw1bf_97), na.rm = T),
         politW2P = rowMeans(select(data, pw2bf_7, pw2bf_17, pw2bf_27, pw2bf_37, pw2bf_47, pw2bf_57,
                                     pw2bf_67, pw2bf_77, pw2bf_87, pw2bf_97), na.rm = T),
         politW3P = rowMeans(select(data, pw3bf_7, pw3bf_17, pw3bf_27, pw3bf_37, pw3bf_47, pw3bf_57,
                                     pw3bf_67, pw3bf_77, pw3bf_87, pw3bf_97), na.rm = T),
         politW4P = rowMeans(select(data, pw4bf_7, pw4bf_17, pw4bf_27, pw4bf_37, pw4bf_47, pw4bf_57,
                                     pw4bf_67, pw4bf_77, pw4bf_87, pw4bf_97), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         politW1S1 = rowMeans(select(data, w1bf_7, w1bf_47, w1bf_67, w1bf_77, w1bf_87),na.rm = T),
         politW2S1 = rowMeans(select(data, w2bf_7, w2bf_47, w2bf_67, w2bf_77, w2bf_87),na.rm = T),
         politW3S1 = rowMeans(select(data, w3bf_7, w3bf_47, w3bf_67, w3bf_77, w3bf_87),na.rm = T),
         politW4S1 = rowMeans(select(data, w4bf_7, w4bf_47, w4bf_67, w4bf_77, w4bf_87),na.rm = T),
         
         # second self parcel
         politW1S2 = rowMeans(select(data, w1bf_17, w1bf_27, w1bf_37, w1bf_57, w1bf_97),na.rm = T),
         politW2S2 = rowMeans(select(data, w2bf_17, w2bf_27, w2bf_37, w2bf_57, w2bf_97),na.rm = T),
         politW3S2 = rowMeans(select(data, w3bf_17, w3bf_27, w3bf_37, w3bf_57, w3bf_97),na.rm = T),
         politW4S2 = rowMeans(select(data, w4bf_17, w4bf_27, w4bf_37, w4bf_57, w4bf_97),na.rm = T),
         
         # first peer parcel
         politW1P1 = rowMeans(select(data, pw1bf_17, pw1bf_27, pw1bf_47, pw1bf_57, pw1bf_67), na.rm = T),
         politW2P1 = rowMeans(select(data, pw2bf_17, pw2bf_27, pw2bf_47, pw2bf_57, pw2bf_67), na.rm = T),
         politW3P1 = rowMeans(select(data, pw3bf_17, pw3bf_27, pw3bf_47, pw3bf_57, pw3bf_67), na.rm = T),
         politW4P1 = rowMeans(select(data, pw4bf_17, pw4bf_27, pw4bf_47, pw4bf_57, pw4bf_67), na.rm = T),
         
         # second peer parcel
         politW1P2 = rowMeans(select(data, pw1bf_7, pw1bf_37, pw1bf_77, pw1bf_87, pw1bf_97), na.rm = T),
         politW2P2 = rowMeans(select(data, pw2bf_7, pw2bf_37, pw2bf_77, pw2bf_87, pw2bf_97), na.rm = T),
         politW3P2 = rowMeans(select(data, pw3bf_7, pw3bf_37, pw3bf_77, pw3bf_87, pw3bf_97), na.rm = T),
         politW4P2 = rowMeans(select(data, pw4bf_7, pw4bf_37, pw4bf_77, pw4bf_87, pw4bf_97), na.rm = T))

# volatility
data <- data %>% 
  mutate(# self
         volatW1S = rowMeans(select(data, w1bf_6, w1bf_16, w1bf_26, w1bf_36, w1bf_46, w1bf_56,
                                     w1bf_66, w1bf_76, w1bf_86, w1bf_96), na.rm = T),
         volatW2S = rowMeans(select(data, w2bf_6, w2bf_16, w2bf_26, w2bf_36, w2bf_46, w2bf_56,
                                     w2bf_66, w2bf_76, w2bf_86, w2bf_96), na.rm = T),
         volatW3S = rowMeans(select(data, w3bf_6, w3bf_16, w3bf_26, w3bf_36, w3bf_46, w3bf_56,
                                     w3bf_66, w3bf_76, w3bf_86, w3bf_96), na.rm = T),
         volatW4S = rowMeans(select(data, w4bf_6, w4bf_16, w4bf_26, w4bf_36, w4bf_46, w4bf_56,
                                     w4bf_66, w4bf_76, w4bf_86, w4bf_96), na.rm = T),
         
         # peer
         volatW1P = rowMeans(select(data, pw1bf_6, pw1bf_16, pw1bf_26, pw1bf_36, pw1bf_46, pw1bf_56,
                                     pw1bf_66, pw1bf_76, pw1bf_86, pw1bf_96), na.rm = T),
         volatW2P = rowMeans(select(data, pw2bf_6, pw2bf_16, pw2bf_26, pw2bf_36, pw2bf_46, pw2bf_56,
                                     pw2bf_66, pw2bf_76, pw2bf_86, pw2bf_96), na.rm = T),
         volatW3P = rowMeans(select(data, pw3bf_6, pw3bf_16, pw3bf_26, pw3bf_36, pw3bf_46, pw3bf_56,
                                     pw3bf_66, pw3bf_76, pw3bf_86, pw3bf_96), na.rm = T),
         volatW4P = rowMeans(select(data, pw4bf_6, pw4bf_16, pw4bf_26, pw4bf_36, pw4bf_46, pw4bf_56,
                                     pw4bf_66, pw4bf_76, pw4bf_86, pw4bf_96), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         volatW1S1 = rowMeans(select(data, w1bf_6, w1bf_46, w1bf_66, w1bf_76, w1bf_86),na.rm = T),
         volatW2S1 = rowMeans(select(data, w2bf_6, w2bf_46, w2bf_66, w2bf_76, w2bf_86),na.rm = T),
         volatW3S1 = rowMeans(select(data, w3bf_6, w3bf_46, w3bf_66, w3bf_76, w3bf_86),na.rm = T),
         volatW4S1 = rowMeans(select(data, w4bf_6, w4bf_46, w4bf_66, w4bf_76, w4bf_86),na.rm = T),
         
         # second self parcel
         volatW1S2 = rowMeans(select(data, w1bf_16, w1bf_26, w1bf_36, w1bf_56, w1bf_96),na.rm = T),
         volatW2S2 = rowMeans(select(data, w2bf_16, w2bf_26, w2bf_36, w2bf_56, w2bf_96),na.rm = T),
         volatW3S2 = rowMeans(select(data, w3bf_16, w3bf_26, w3bf_36, w3bf_56, w3bf_96),na.rm = T),
         volatW4S2 = rowMeans(select(data, w4bf_16, w4bf_26, w4bf_36, w4bf_56, w4bf_96),na.rm = T),
         
         # first peer parcel
         volatW1P1 = rowMeans(select(data, pw1bf_16, pw1bf_26, pw1bf_46, pw1bf_56, pw1bf_66), na.rm = T),
         volatW2P1 = rowMeans(select(data, pw2bf_16, pw2bf_26, pw2bf_46, pw2bf_56, pw2bf_66), na.rm = T),
         volatW3P1 = rowMeans(select(data, pw3bf_16, pw3bf_26, pw3bf_46, pw3bf_56, pw3bf_66), na.rm = T),
         volatW4P1 = rowMeans(select(data, pw4bf_16, pw4bf_26, pw4bf_46, pw4bf_56, pw4bf_66), na.rm = T),
         
         # second peer parcel
         volatW1P2 = rowMeans(select(data, pw1bf_6, pw1bf_36, pw1bf_76, pw1bf_86, pw1bf_96), na.rm = T),
         volatW2P2 = rowMeans(select(data, pw2bf_6, pw2bf_36, pw2bf_76, pw2bf_86, pw2bf_96), na.rm = T),
         volatW3P2 = rowMeans(select(data, pw3bf_6, pw3bf_36, pw3bf_76, pw3bf_86, pw3bf_96), na.rm = T),
         volatW4P2 = rowMeans(select(data, pw4bf_6, pw4bf_36, pw4bf_76, pw4bf_86, pw4bf_96), na.rm = T))

# withdrawal
data <- data %>% 
  mutate(# self
         withdW1S = rowMeans(select(data, w1bf_1, w1bf_11, w1bf_21, w1bf_31, w1bf_41, w1bf_51,
                                     w1bf_61, w1bf_71, w1bf_81, w1bf_91), na.rm = T),
         withdW2S = rowMeans(select(data, w2bf_1, w2bf_11, w2bf_21, w2bf_31, w2bf_41, w2bf_51,
                                     w2bf_61, w2bf_71, w2bf_81, w2bf_91), na.rm = T),
         withdW3S = rowMeans(select(data, w3bf_1, w3bf_11, w3bf_21, w3bf_31, w3bf_41, w3bf_51,
                                     w3bf_61, w3bf_71, w3bf_81, w3bf_91), na.rm = T),
         withdW4S = rowMeans(select(data, w4bf_1, w4bf_11, w4bf_21, w4bf_31, w4bf_41, w4bf_51,
                                     w4bf_61, w4bf_71, w4bf_81, w4bf_91), na.rm = T),
         
         # peer
         withdW1P = rowMeans(select(data, pw1bf_1, pw1bf_11, pw1bf_21, pw1bf_31, pw1bf_41, pw1bf_51,
                                     pw1bf_61, pw1bf_71, pw1bf_81, pw1bf_91), na.rm = T),
         withdW2P = rowMeans(select(data, pw2bf_1, pw2bf_11, pw2bf_21, pw2bf_31, pw2bf_41, pw2bf_51,
                                     pw2bf_61, pw2bf_71, pw2bf_81, pw2bf_91), na.rm = T),
         withdW3P = rowMeans(select(data, pw3bf_1, pw3bf_11, pw3bf_21, pw3bf_31, pw3bf_41, pw3bf_51,
                                     pw3bf_61, pw3bf_71, pw3bf_81, pw3bf_91), na.rm = T),
         withdW4P = rowMeans(select(data, pw4bf_1, pw4bf_11, pw4bf_21, pw4bf_31, pw4bf_41, pw4bf_51,
                                     pw4bf_61, pw4bf_71, pw4bf_81, pw4bf_91), na.rm = T))

data <- data %>% 
  mutate(# first self parcel
         withdW1S1 = rowMeans(select(data, w1bf_1, w1bf_41, w1bf_61, w1bf_71, w1bf_81),na.rm = T),
         withdW2S1 = rowMeans(select(data, w2bf_1, w2bf_41, w2bf_61, w2bf_71, w2bf_81),na.rm = T),
         withdW3S1 = rowMeans(select(data, w3bf_1, w3bf_41, w3bf_61, w3bf_71, w3bf_81),na.rm = T),
         withdW4S1 = rowMeans(select(data, w4bf_1, w4bf_41, w4bf_61, w4bf_71, w4bf_81),na.rm = T),
         
         # second self parcel
         withdW1S2 = rowMeans(select(data, w1bf_11, w1bf_21, w1bf_31, w1bf_51, w1bf_91),na.rm = T),
         withdW2S2 = rowMeans(select(data, w2bf_11, w2bf_21, w2bf_31, w2bf_51, w2bf_91),na.rm = T),
         withdW3S2 = rowMeans(select(data, w3bf_11, w3bf_21, w3bf_31, w3bf_51, w3bf_91),na.rm = T),
         withdW4S2 = rowMeans(select(data, w4bf_11, w4bf_21, w4bf_31, w4bf_51, w4bf_91),na.rm = T),
         
         # first peer parcel
         withdW1P1 = rowMeans(select(data, pw1bf_11, pw1bf_21, pw1bf_41, pw1bf_51, pw1bf_61), na.rm = T),
         withdW2P1 = rowMeans(select(data, pw2bf_11, pw2bf_21, pw2bf_41, pw2bf_51, pw2bf_61), na.rm = T),
         withdW3P1 = rowMeans(select(data, pw3bf_11, pw3bf_21, pw3bf_41, pw3bf_51, pw3bf_61), na.rm = T),
         withdW4P1 = rowMeans(select(data, pw4bf_11, pw4bf_21, pw4bf_41, pw4bf_51, pw4bf_61), na.rm = T),
         
         # second peer parcel
         withdW1P2 = rowMeans(select(data, pw1bf_1, pw1bf_31, pw1bf_71, pw1bf_81, pw1bf_91), na.rm = T),
         withdW2P2 = rowMeans(select(data, pw2bf_1, pw2bf_31, pw2bf_71, pw2bf_81, pw2bf_91), na.rm = T),
         withdW3P2 = rowMeans(select(data, pw3bf_1, pw3bf_31, pw3bf_71, pw3bf_81, pw3bf_91), na.rm = T),
         withdW4P2 = rowMeans(select(data, pw4bf_1, pw4bf_31, pw4bf_71, pw4bf_81, pw4bf_91), na.rm = T))

# >>> Domains ----

### agreeableness
data <- data %>% 
  mutate(# first self parcel
         agreeW1S1 = rowMeans(select(data, w1bf_12, w1bf_32, w1bf_42, w1bf_62, w1bf_72,
                                     w1bf_92, w1bf_17, w1bf_37, w1bf_47, w1bf_97),na.rm = T),
         agreeW2S1 = rowMeans(select(data, w2bf_12, w2bf_32, w2bf_42, w2bf_62, w2bf_72,
                                     w2bf_92, w2bf_17, w2bf_37, w2bf_47, w2bf_97),na.rm = T),
         agreeW3S1 = rowMeans(select(data, w3bf_12, w3bf_32, w3bf_42, w3bf_62, w3bf_72,
                                     w3bf_92, w3bf_17, w3bf_37, w3bf_47, w3bf_97),na.rm = T),
         agreeW4S1 = rowMeans(select(data, w4bf_12, w4bf_32, w4bf_42, w4bf_62, w4bf_72,
                                     w4bf_92, w4bf_17, w4bf_37, w4bf_47, w4bf_97),na.rm = T),
         
         # second self parcel
         agreeW1S2 = rowMeans(select(data, w1bf_2, w1bf_22, w1bf_52, w1bf_82, w1bf_7,
                                     w1bf_27, w1bf_57, w1bf_67, w1bf_77, w1bf_87),na.rm = T),
         agreeW2S2 = rowMeans(select(data, w2bf_2, w2bf_22, w2bf_52, w2bf_82, w2bf_7,
                                     w2bf_27, w2bf_57, w2bf_67, w2bf_77, w2bf_87),na.rm = T),
         agreeW3S2 = rowMeans(select(data, w3bf_2, w3bf_22, w3bf_52, w3bf_82, w3bf_7,
                                     w3bf_27, w3bf_57, w3bf_67, w3bf_77, w3bf_87),na.rm = T),
         agreeW4S2 = rowMeans(select(data, w4bf_2, w4bf_22, w4bf_52, w4bf_82, w4bf_7,
                                     w4bf_27, w4bf_57, w4bf_67, w4bf_77, w4bf_87),na.rm = T),
         
         # first peer parcel
         agreeW1P1 = rowMeans(select(data, pw1bf_2, pw1bf_22, pw1bf_32, pw1bf_42, pw1bf_82, 
                                     pw1bf_17, pw1bf_37, pw1bf_47, pw1bf_57, pw1bf_87), na.rm = T),
         agreeW2P1 = rowMeans(select(data, pw2bf_2, pw2bf_22, pw2bf_32, pw2bf_42, pw2bf_82, 
                                     pw2bf_17, pw2bf_37, pw2bf_47, pw2bf_57, pw2bf_87), na.rm = T),
         agreeW3P1 = rowMeans(select(data, pw3bf_2, pw3bf_22, pw3bf_32, pw3bf_42, pw3bf_82, 
                                     pw3bf_17, pw3bf_37, pw3bf_47, pw3bf_57, pw3bf_87), na.rm = T),
         agreeW4P1 = rowMeans(select(data, pw4bf_2, pw4bf_22, pw4bf_32, pw4bf_42, pw4bf_82, 
                                     pw4bf_17, pw4bf_37, pw4bf_47, pw4bf_57, pw4bf_87), na.rm = T),
         
         # second peer parcel
         agreeW1P2 = rowMeans(select(data, pw1bf_12, pw1bf_52, pw1bf_62, pw1bf_72, pw1bf_92,
                                     pw1bf_7, pw1bf_27, pw1bf_67, pw1bf_77, pw1bf_97), na.rm = T),
         agreeW2P2 = rowMeans(select(data, pw1bf_12, pw1bf_52, pw1bf_62, pw1bf_72, pw1bf_92,
                                     pw1bf_7, pw1bf_27, pw1bf_67, pw1bf_77, pw1bf_97), na.rm = T),
         agreeW3P2 = rowMeans(select(data, pw1bf_12, pw1bf_52, pw1bf_62, pw1bf_72, pw1bf_92,
                                     pw1bf_7, pw1bf_27, pw1bf_67, pw1bf_77, pw1bf_97), na.rm = T),
         agreeW4P2 = rowMeans(select(data, pw1bf_12, pw1bf_52, pw1bf_62, pw1bf_72, pw1bf_92,
                                     pw1bf_7, pw1bf_27, pw1bf_67, pw1bf_77, pw1bf_97), na.rm = T))

### conscientiousness
data <- data %>% 
  mutate(# first self parcel
         consciW1S1 = rowMeans(select(data, w1bf_13, w1bf_33, w1bf_43, w1bf_63, w1bf_73,
                                     w1bf_93, w1bf_18, w1bf_38, w1bf_48, w1bf_98),na.rm = T),
         consciW2S1 = rowMeans(select(data, w2bf_13, w2bf_33, w2bf_43, w2bf_63, w2bf_73,
                                     w2bf_93, w2bf_18, w2bf_38, w2bf_48, w2bf_98),na.rm = T),
         consciW3S1 = rowMeans(select(data, w3bf_13, w3bf_33, w3bf_43, w3bf_63, w3bf_73,
                                     w3bf_93, w3bf_18, w3bf_38, w3bf_48, w3bf_98),na.rm = T),
         consciW4S1 = rowMeans(select(data, w4bf_13, w4bf_33, w4bf_43, w4bf_63, w4bf_73,
                                     w4bf_93, w4bf_18, w4bf_38, w4bf_48, w4bf_98),na.rm = T),
         
         # second self parcel
         consciW1S2 = rowMeans(select(data, w1bf_3, w1bf_23, w1bf_53, w1bf_83, w1bf_8,
                                     w1bf_28, w1bf_58, w1bf_68, w1bf_78, w1bf_88),na.rm = T),
         consciW2S2 = rowMeans(select(data, w2bf_3, w2bf_23, w2bf_53, w2bf_83, w2bf_8,
                                     w2bf_28, w2bf_58, w2bf_68, w2bf_78, w2bf_88),na.rm = T),
         consciW3S2 = rowMeans(select(data, w3bf_3, w3bf_23, w3bf_53, w3bf_83, w3bf_8,
                                     w3bf_28, w3bf_58, w3bf_68, w3bf_78, w3bf_88),na.rm = T),
         consciW4S2 = rowMeans(select(data, w4bf_3, w4bf_23, w4bf_53, w4bf_83, w4bf_8,
                                     w4bf_28, w4bf_58, w4bf_68, w4bf_78, w4bf_88),na.rm = T),
         
         # first peer parcel
         consciW1P1 = rowMeans(select(data, pw1bf_3, pw1bf_23, pw1bf_33, pw1bf_43, pw1bf_83, 
                                     pw1bf_18, pw1bf_38, pw1bf_48, pw1bf_58, pw1bf_88), na.rm = T),
         consciW2P1 = rowMeans(select(data, pw2bf_3, pw2bf_23, pw2bf_33, pw2bf_43, pw2bf_83, 
                                     pw2bf_18, pw2bf_38, pw2bf_48, pw2bf_58, pw2bf_88), na.rm = T),
         consciW3P1 = rowMeans(select(data, pw3bf_3, pw3bf_23, pw3bf_33, pw3bf_43, pw3bf_83, 
                                     pw3bf_18, pw3bf_38, pw3bf_48, pw3bf_58, pw3bf_88), na.rm = T),
         consciW4P1 = rowMeans(select(data, pw4bf_3, pw4bf_23, pw4bf_33, pw4bf_43, pw4bf_83, 
                                     pw4bf_18, pw4bf_38, pw4bf_48, pw4bf_58, pw4bf_88), na.rm = T),
         
         # second peer parcel
         consciW1P2 = rowMeans(select(data, pw1bf_13, pw1bf_53, pw1bf_63, pw1bf_73, pw1bf_93,
                                     pw1bf_8, pw1bf_28, pw1bf_68, pw1bf_78, pw1bf_98), na.rm = T),
         consciW2P2 = rowMeans(select(data, pw1bf_13, pw1bf_53, pw1bf_63, pw1bf_73, pw1bf_93,
                                     pw1bf_8, pw1bf_28, pw1bf_68, pw1bf_78, pw1bf_98), na.rm = T),
         consciW3P2 = rowMeans(select(data, pw1bf_13, pw1bf_53, pw1bf_63, pw1bf_73, pw1bf_93,
                                     pw1bf_8, pw1bf_28, pw1bf_68, pw1bf_78, pw1bf_98), na.rm = T),
         consciW4P2 = rowMeans(select(data, pw1bf_13, pw1bf_53, pw1bf_63, pw1bf_73, pw1bf_93,
                                     pw1bf_8, pw1bf_28, pw1bf_68, pw1bf_78, pw1bf_98), na.rm = T))

### extraversion
data <- data %>% 
  mutate(# first self parcel
         extraW1S1 = rowMeans(select(data, w1bf_14, w1bf_34, w1bf_44, w1bf_64, w1bf_74,
                                     w1bf_94, w1bf_19, w1bf_39, w1bf_49, w1bf_99),na.rm = T),
         extraW2S1 = rowMeans(select(data, w2bf_14, w2bf_34, w2bf_44, w2bf_64, w2bf_74,
                                     w2bf_94, w2bf_19, w2bf_39, w2bf_49, w2bf_99),na.rm = T),
         extraW3S1 = rowMeans(select(data, w3bf_14, w3bf_34, w3bf_44, w3bf_64, w3bf_74,
                                     w3bf_94, w3bf_19, w3bf_39, w3bf_49, w3bf_99),na.rm = T),
         extraW4S1 = rowMeans(select(data, w4bf_14, w4bf_34, w4bf_44, w4bf_64, w4bf_74,
                                     w4bf_94, w4bf_19, w4bf_39, w4bf_49, w4bf_99),na.rm = T),
         
         # second self parcel
         extraW1S2 = rowMeans(select(data, w1bf_4, w1bf_24, w1bf_54, w1bf_84, w1bf_9,
                                     w1bf_29, w1bf_59, w1bf_69, w1bf_79, w1bf_89),na.rm = T),
         extraW2S2 = rowMeans(select(data, w2bf_4, w2bf_24, w2bf_54, w2bf_84, w2bf_9,
                                     w2bf_29, w2bf_59, w2bf_69, w2bf_79, w2bf_89),na.rm = T),
         extraW3S2 = rowMeans(select(data, w3bf_4, w3bf_24, w3bf_54, w3bf_84, w3bf_9,
                                     w3bf_29, w3bf_59, w3bf_69, w3bf_79, w3bf_89),na.rm = T),
         extraW4S2 = rowMeans(select(data, w4bf_4, w4bf_24, w4bf_54, w4bf_84, w4bf_9,
                                     w4bf_29, w4bf_59, w4bf_69, w4bf_79, w4bf_89),na.rm = T),
         
         # first peer parcel
         extraW1P1 = rowMeans(select(data, pw1bf_4, pw1bf_24, pw1bf_34, pw1bf_44, pw1bf_84, 
                                     pw1bf_19, pw1bf_39, pw1bf_49, pw1bf_59, pw1bf_89), na.rm = T),
         extraW2P1 = rowMeans(select(data, pw2bf_4, pw2bf_24, pw2bf_34, pw2bf_44, pw2bf_84, 
                                     pw2bf_19, pw2bf_39, pw2bf_49, pw2bf_59, pw2bf_89), na.rm = T),
         extraW3P1 = rowMeans(select(data, pw3bf_4, pw3bf_24, pw3bf_34, pw3bf_44, pw3bf_84, 
                                     pw3bf_19, pw3bf_39, pw3bf_49, pw3bf_59, pw3bf_89), na.rm = T),
         extraW4P1 = rowMeans(select(data, pw4bf_4, pw4bf_24, pw4bf_34, pw4bf_44, pw4bf_84, 
                                     pw4bf_19, pw4bf_39, pw4bf_49, pw4bf_59, pw4bf_89), na.rm = T),
         
         # second peer parcel
         extraW1P2 = rowMeans(select(data, pw1bf_14, pw1bf_54, pw1bf_64, pw1bf_74, pw1bf_94,
                                     pw1bf_9, pw1bf_29, pw1bf_69, pw1bf_79, pw1bf_99), na.rm = T),
         extraW2P2 = rowMeans(select(data, pw1bf_14, pw1bf_54, pw1bf_64, pw1bf_74, pw1bf_94,
                                     pw1bf_9, pw1bf_29, pw1bf_69, pw1bf_79, pw1bf_99), na.rm = T),
         extraW3P2 = rowMeans(select(data, pw1bf_14, pw1bf_54, pw1bf_64, pw1bf_74, pw1bf_94,
                                     pw1bf_9, pw1bf_29, pw1bf_69, pw1bf_79, pw1bf_99), na.rm = T),
         extraW4P2 = rowMeans(select(data, pw1bf_14, pw1bf_54, pw1bf_64, pw1bf_74, pw1bf_94,
                                     pw1bf_9, pw1bf_29, pw1bf_69, pw1bf_79, pw1bf_99), na.rm = T))

### neuroticism
data <- data %>% 
  mutate(# first self parcel
         neuroW1S1 = rowMeans(select(data, w1bf_11, w1bf_31, w1bf_41, w1bf_61, w1bf_71,
                                     w1bf_91, w1bf_16, w1bf_36, w1bf_46, w1bf_96),na.rm = T),
         neuroW2S1 = rowMeans(select(data, w2bf_11, w2bf_31, w2bf_41, w2bf_61, w2bf_71,
                                     w2bf_91, w2bf_16, w2bf_36, w2bf_46, w2bf_96),na.rm = T),
         neuroW3S1 = rowMeans(select(data, w3bf_11, w3bf_31, w3bf_41, w3bf_61, w3bf_71,
                                     w3bf_91, w3bf_16, w3bf_36, w3bf_46, w3bf_96),na.rm = T),
         neuroW4S1 = rowMeans(select(data, w4bf_11, w4bf_31, w4bf_41, w4bf_61, w4bf_71,
                                     w4bf_91, w4bf_16, w4bf_36, w4bf_46, w4bf_96),na.rm = T),
         
         # second self parcel
         neuroW1S2 = rowMeans(select(data, w1bf_1, w1bf_21, w1bf_51, w1bf_81, w1bf_6,
                                     w1bf_26, w1bf_56, w1bf_66, w1bf_76, w1bf_86),na.rm = T),
         neuroW2S2 = rowMeans(select(data, w2bf_1, w2bf_21, w2bf_51, w2bf_81, w2bf_6,
                                     w2bf_26, w2bf_56, w2bf_66, w2bf_76, w2bf_86),na.rm = T),
         neuroW3S2 = rowMeans(select(data, w3bf_1, w3bf_21, w3bf_51, w3bf_81, w3bf_6,
                                     w3bf_26, w3bf_56, w3bf_66, w3bf_76, w3bf_86),na.rm = T),
         neuroW4S2 = rowMeans(select(data, w4bf_1, w4bf_21, w4bf_51, w4bf_81, w4bf_6,
                                     w4bf_26, w4bf_56, w4bf_66, w4bf_76, w4bf_86),na.rm = T),
         
         # first peer parcel
         neuroW1P1 = rowMeans(select(data, pw1bf_1, pw1bf_21, pw1bf_31, pw1bf_41, pw1bf_81, 
                                     pw1bf_16, pw1bf_36, pw1bf_46, pw1bf_56, pw1bf_86), na.rm = T),
         neuroW2P1 = rowMeans(select(data, pw2bf_1, pw2bf_21, pw2bf_31, pw2bf_41, pw2bf_81, 
                                     pw2bf_16, pw2bf_36, pw2bf_46, pw2bf_56, pw2bf_86), na.rm = T),
         neuroW3P1 = rowMeans(select(data, pw3bf_1, pw3bf_21, pw3bf_31, pw3bf_41, pw3bf_81, 
                                     pw3bf_16, pw3bf_36, pw3bf_46, pw3bf_56, pw3bf_86), na.rm = T),
         neuroW4P1 = rowMeans(select(data, pw4bf_1, pw4bf_21, pw4bf_31, pw4bf_41, pw4bf_81, 
                                     pw4bf_16, pw4bf_36, pw4bf_46, pw4bf_56, pw4bf_86), na.rm = T),
         
         # second peer parcel
         neuroW1P2 = rowMeans(select(data, pw1bf_11, pw1bf_51, pw1bf_61, pw1bf_71, pw1bf_91,
                                     pw1bf_6, pw1bf_26, pw1bf_66, pw1bf_76, pw1bf_96), na.rm = T),
         neuroW2P2 = rowMeans(select(data, pw1bf_11, pw1bf_51, pw1bf_61, pw1bf_71, pw1bf_91,
                                     pw1bf_6, pw1bf_26, pw1bf_66, pw1bf_76, pw1bf_96), na.rm = T),
         neuroW3P2 = rowMeans(select(data, pw1bf_11, pw1bf_51, pw1bf_61, pw1bf_71, pw1bf_91,
                                     pw1bf_6, pw1bf_26, pw1bf_66, pw1bf_76, pw1bf_96), na.rm = T),
         neuroW4P2 = rowMeans(select(data, pw1bf_11, pw1bf_51, pw1bf_61, pw1bf_71, pw1bf_91,
                                     pw1bf_6, pw1bf_26, pw1bf_66, pw1bf_76, pw1bf_96), na.rm = T))

### openness domain
data <- data %>% 
  mutate(# first self parcel
         opendW1S1 = rowMeans(select(data, w1bf_10, w1bf_30, w1bf_40, w1bf_60, w1bf_70,
                                     w1bf_90, w1bf_15, w1bf_35, w1bf_45, w1bf_95),na.rm = T),
         opendW2S1 = rowMeans(select(data, w2bf_10, w2bf_30, w2bf_40, w2bf_60, w2bf_70,
                                     w2bf_90, w2bf_15, w2bf_35, w2bf_45, w2bf_95),na.rm = T),
         opendW3S1 = rowMeans(select(data, w3bf_10, w3bf_30, w3bf_40, w3bf_60, w3bf_70,
                                     w3bf_90, w3bf_15, w3bf_35, w3bf_45, w3bf_95),na.rm = T),
         opendW4S1 = rowMeans(select(data, w4bf_10, w4bf_30, w4bf_40, w4bf_60, w4bf_70,
                                     w4bf_90, w4bf_15, w4bf_35, w4bf_45, w4bf_95),na.rm = T),
         
         # second self parcel
         opendW1S2 = rowMeans(select(data, w1bf_100, w1bf_20, w1bf_50, w1bf_80, w1bf_5,
                                     w1bf_25, w1bf_55, w1bf_65, w1bf_75, w1bf_85),na.rm = T),
         opendW2S2 = rowMeans(select(data, w2bf_100, w2bf_20, w2bf_50, w2bf_80, w2bf_5,
                                     w2bf_25, w2bf_55, w2bf_65, w2bf_75, w2bf_85),na.rm = T),
         opendW3S2 = rowMeans(select(data, w3bf_100, w3bf_20, w3bf_50, w3bf_80, w3bf_5,
                                     w3bf_25, w3bf_55, w3bf_65, w3bf_75, w3bf_85),na.rm = T),
         opendW4S2 = rowMeans(select(data, w4bf_100, w4bf_20, w4bf_50, w4bf_80, w4bf_5,
                                     w4bf_25, w4bf_55, w4bf_65, w4bf_75, w4bf_85),na.rm = T),
         
         # first peer parcel
         opendW1P1 = rowMeans(select(data, pw1bf_100, pw1bf_20, pw1bf_30, pw1bf_40, pw1bf_80, 
                                     pw1bf_15, pw1bf_35, pw1bf_45, pw1bf_55, pw1bf_85), na.rm = T),
         opendW2P1 = rowMeans(select(data, pw2bf_100, pw2bf_20, pw2bf_30, pw2bf_40, pw2bf_80, 
                                     pw2bf_15, pw2bf_35, pw2bf_45, pw2bf_55, pw2bf_85), na.rm = T),
         opendW3P1 = rowMeans(select(data, pw3bf_100, pw3bf_20, pw3bf_30, pw3bf_40, pw3bf_80, 
                                     pw3bf_15, pw3bf_35, pw3bf_45, pw3bf_55, pw3bf_85), na.rm = T),
         opendW4P1 = rowMeans(select(data, pw4bf_100, pw4bf_20, pw4bf_30, pw4bf_40, pw4bf_80, 
                                     pw4bf_15, pw4bf_35, pw4bf_45, pw4bf_55, pw4bf_85), na.rm = T),
         
         # second peer parcel
         opendW1P2 = rowMeans(select(data, pw1bf_10, pw1bf_50, pw1bf_60, pw1bf_70, pw1bf_90,
                                     pw1bf_5, pw1bf_25, pw1bf_65, pw1bf_75, pw1bf_95), na.rm = T),
         opendW2P2 = rowMeans(select(data, pw1bf_10, pw1bf_50, pw1bf_60, pw1bf_70, pw1bf_90,
                                     pw1bf_5, pw1bf_25, pw1bf_65, pw1bf_75, pw1bf_95), na.rm = T),
         opendW3P2 = rowMeans(select(data, pw1bf_10, pw1bf_50, pw1bf_60, pw1bf_70, pw1bf_90,
                                     pw1bf_5, pw1bf_25, pw1bf_65, pw1bf_75, pw1bf_95), na.rm = T),
         opendW4P2 = rowMeans(select(data, pw1bf_10, pw1bf_50, pw1bf_60, pw1bf_70, pw1bf_90,
                                     pw1bf_5, pw1bf_25, pw1bf_65, pw1bf_75, pw1bf_95), na.rm = T))


# >>> Identity ----

### Confusion
data <- data %>% 
  mutate(# first self parcel
         confuW1S1 = rowMeans(select(data, w1epsi_7, w1epsi_10, w1epsi_11),na.rm = T),
         confuW2S1 = rowMeans(select(data, w2epsi_7, w2epsi_10, w2epsi_11),na.rm = T),
         confuW3S1 = rowMeans(select(data, w3epsi_7, w3epsi_10, w3epsi_11),na.rm = T),
         confuW4S1 = rowMeans(select(data, w4epsi_7, w4epsi_10, w4epsi_11),na.rm = T),
         
         # second self parcel
         confuW1S2 = rowMeans(select(data, w1epsi_1, w1epsi_3, w1epsi_12),na.rm = T),
         confuW2S2 = rowMeans(select(data, w2epsi_1, w2epsi_3, w2epsi_12),na.rm = T),
         confuW3S2 = rowMeans(select(data, w3epsi_1, w3epsi_3, w3epsi_12),na.rm = T),
         confuW4S2 = rowMeans(select(data, w4epsi_1, w4epsi_3, w4epsi_12),na.rm = T),
         
         # first peer parcel
         confuW1P1 = rowMeans(select(data, pw1epsi_3, pw1epsi_7, pw1epsi_12), na.rm = T),
         confuW2P1 = rowMeans(select(data, pw2epsi_3, pw2epsi_7, pw2epsi_12), na.rm = T),
         confuW3P1 = rowMeans(select(data, pw3epsi_3, pw3epsi_7, pw3epsi_12), na.rm = T),
         confuW4P1 = rowMeans(select(data, pw4epsi_3, pw4epsi_7, pw4epsi_12), na.rm = T),
         
         # second peer parcel
         confuW1P2 = rowMeans(select(data, pw1epsi_1, pw1epsi_10, pw1epsi_11), na.rm = T),
         confuW2P2 = rowMeans(select(data, pw2epsi_1, pw2epsi_10, pw2epsi_11), na.rm = T),
         confuW3P2 = rowMeans(select(data, pw3epsi_1, pw3epsi_10, pw3epsi_11), na.rm = T),
         confuW4P2 = rowMeans(select(data, pw4epsi_1, pw4epsi_10, pw4epsi_11), na.rm = T))

### Coherence
data <- data %>% 
  mutate(# first self parcel
         coherW1S1 = rowMeans(select(data, w1epsi_2, w1epsi_5, w1epsi_6),na.rm = T),
         coherW2S1 = rowMeans(select(data, w2epsi_2, w2epsi_5, w2epsi_6),na.rm = T),
         coherW3S1 = rowMeans(select(data, w3epsi_2, w3epsi_5, w3epsi_6),na.rm = T),
         coherW4S1 = rowMeans(select(data, w4epsi_2, w4epsi_5, w4epsi_6),na.rm = T),
         
         # second self parcel
         coherW1S2 = rowMeans(select(data, w1epsi_4, w1epsi_8, w1epsi_9),na.rm = T),
         coherW2S2 = rowMeans(select(data, w2epsi_4, w2epsi_8, w2epsi_9),na.rm = T),
         coherW3S2 = rowMeans(select(data, w3epsi_4, w3epsi_8, w3epsi_9),na.rm = T),
         coherW4S2 = rowMeans(select(data, w4epsi_4, w4epsi_8, w4epsi_9),na.rm = T),
         
         # first peer parcel
         coherW1P1 = rowMeans(select(data, pw1epsi_4, pw1epsi_5, pw1epsi_9), na.rm = T),
         coherW2P1 = rowMeans(select(data, pw2epsi_4, pw2epsi_5, pw2epsi_9), na.rm = T),
         coherW3P1 = rowMeans(select(data, pw3epsi_4, pw3epsi_5, pw3epsi_9), na.rm = T),
         coherW4P1 = rowMeans(select(data, pw4epsi_4, pw4epsi_5, pw4epsi_9), na.rm = T),
         
         # second peer parcel
         coherW1P2 = rowMeans(select(data, pw1epsi_2, pw1epsi_6, pw1epsi_8), na.rm = T),
         coherW2P2 = rowMeans(select(data, pw2epsi_2, pw2epsi_6, pw2epsi_8), na.rm = T),
         coherW3P2 = rowMeans(select(data, pw3epsi_2, pw3epsi_6, pw3epsi_8), na.rm = T),
         coherW4P2 = rowMeans(select(data, pw4epsi_2, pw4epsi_6, pw4epsi_8), na.rm = T))

data[data == "NaN"] <- NA

Latent growth model

LGM Agreeableness

with aspects as parcels

lgmAgree <- '

# factor at each time point with same loading
agree1 =~ compaW1S        + a * politW1S + 
          peer * compaW1P + aa * politW1P

agree2 =~ compaW2S        + a * politW2S + 
          peer * compaW2P + aa * politW2P

agree3 =~ compaW3S        + a * politW3S + 
          peer * compaW3P + aa * politW3P
  
agree4 =~ compaW4S        + a * politW4S + 
          peer * compaW4P + aa * politW4P

# second order factor for intercept and slope
interc =~ 1*agree1 + 1*agree2 + 1*agree3 + 1*agree4
slope =~ 0*agree1 + 6*agree2 + 13*agree3 + 19*agree4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
compaW1S ~ 0*1
compaW2S ~ 0*1
compaW3S ~ 0*1
compaW4S ~ 0*1

# fix equal intercepts
politW1S ~ b*1
politW2S ~ b*1
politW3S ~ b*1
politW4S ~ b*1

compaW1P ~ c*1
compaW2P ~ c*1
compaW3P ~ c*1
compaW4P ~ c*1

politW1P ~ d*1
politW2P ~ d*1
politW3P ~ d*1
politW4P ~ d*1

# error covariance - similar aspects across waves and informants
compaW1S ~~ compaW2S + compaW3S + compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW2S ~~ compaW3S + compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW3S ~~ compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW4S ~~ compaW1P + compaW2P + compaW3P + compaW4P

politW1S ~~ politW2S + politW3S + politW4S +
            politW1P + politW2P + politW3P + politW4P
politW2S ~~ politW3S + politW4S +
            politW1P + politW2P + politW3P + politW4P
politW3S ~~ politW4S +
            politW1P + politW2P + politW3P + politW4P
politW4S ~~ politW1P + politW2P + politW3P + politW4P

compaW1P ~~ compaW2P + compaW3P + compaW4P
compaW2P ~~ compaW3P + compaW4P
compaW3P ~~ compaW4P

politW1P ~~ politW2P + politW3P + politW4P
politW2P ~~ politW3P + politW4P
politW3P ~~ politW4P
'
lgmAgree <- sem(lgmAgree, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
summary(lgmAgree, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 1672 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        105
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all 
##   agree1 =~                                                              
##     compW1S           1.000                               8.042    17.183
##     poltW1S    (a)    0.000       NA                      0.004     0.007
##     compW1P (peer)    3.473       NA                     27.933    47.495
##     poltW1P   (aa)    0.001       NA                      0.008     0.013
##   agree2 =~                                                              
##     compW2S           1.000                               7.818    16.238
##     poltW2S    (a)    0.000       NA                      0.004     0.007
##     compW2P (peer)    3.473       NA                     27.153    47.424
##     poltW2P   (aa)    0.001       NA                      0.008     0.013
##   agree3 =~                                                              
##     compW3S           1.000                               8.068    16.853
##     poltW3S    (a)    0.000       NA                      0.004     0.007
##     compW3P (peer)    3.473       NA                     28.023    50.664
##     poltW3P   (aa)    0.001       NA                      0.008     0.012
##   agree4 =~                                                              
##     compW4S           1.000                               8.725    17.943
##     poltW4S    (a)    0.000       NA                      0.004     0.007
##     compW4P (peer)    3.473       NA                     30.306    51.837
##     poltW4P   (aa)    0.001       NA                      0.008     0.013
##   interc =~                                                              
##     agree1            1.000                               0.862     0.862
##     agree2            1.000                               0.887     0.887
##     agree3            1.000                               0.859     0.859
##     agree4            1.000                               0.794     0.794
##   slope =~                                                               
##     agree1            0.000                               0.000     0.000
##     agree2            6.000                               0.117     0.117
##     agree3           13.000                               0.246     0.246
##     agree4           19.000                               0.332     0.332
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all 
##   interc ~~                                                              
##     slope             0.347       NA                      0.328     0.328
##  .compaW1S ~~                                                            
##    .compaW2S        -49.981       NA                    -49.981    -0.798
##    .compaW3S        -52.417       NA                    -52.417    -0.811
##    .compaW4S        -54.493       NA                    -54.493    -0.779
##    .compaW1P       -224.559       NA                   -224.559    -1.002
##    .compaW2P       -173.992       NA                   -173.992    -0.798
##    .compaW3P       -182.425       NA                   -182.425    -0.811
##    .compaW4P       -189.676       NA                   -189.676    -0.780
##  .compaW2S ~~                                                            
##    .compaW3S        -56.265       NA                    -56.265    -0.895
##    .compaW4S        -59.181       NA                    -59.181    -0.871
##  .compaW1P ~~                                                            
##    .compaW2S       -174.003       NA                   -174.003    -0.799
##  .compaW2S ~~                                                            
##    .compaW2P       -212.197       NA                   -212.197    -1.002
##    .compaW3P       -195.953       NA                   -195.953    -0.896
##    .compaW4P       -206.088       NA                   -206.088    -0.872
##  .compaW3S ~~                                                            
##    .compaW4S        -64.681       NA                    -64.681    -0.922
##  .compaW1P ~~                                                            
##    .compaW3S       -182.448       NA                   -182.448    -0.811
##  .compaW2P ~~                                                            
##    .compaW3S       -195.975       NA                   -195.975    -0.896
##  .compaW3S ~~                                                            
##    .compaW3P       -226.012       NA                   -226.012    -1.002
##    .compaW4P       -225.281       NA                   -225.281    -0.923
##  .compaW1P ~~                                                            
##    .compaW4S       -189.683       NA                   -189.683    -0.780
##  .compaW2P ~~                                                            
##    .compaW4S       -206.106       NA                   -206.106    -0.872
##  .compaW3P ~~                                                            
##    .compaW4S       -225.256       NA                   -225.256    -0.923
##  .compaW4S ~~                                                            
##    .compaW4P       -264.350       NA                   -264.350    -1.001
##  .politW1S ~~                                                            
##    .politW2S          0.214       NA                      0.214     0.749
##    .politW3S          0.199       NA                      0.199     0.678
##    .politW4S          0.199       NA                      0.199     0.688
##    .politW1P          0.163       NA                      0.163     0.508
##    .politW2P          0.124       NA                      0.124     0.416
##    .politW3P          0.126       NA                      0.126     0.373
##    .politW4P          0.136       NA                      0.136     0.403
##  .politW2S ~~                                                            
##    .politW3S          0.237       NA                      0.237     0.803
##    .politW4S          0.224       NA                      0.224     0.770
##  .politW1P ~~                                                            
##    .politW2S          0.149       NA                      0.149     0.463
##  .politW2S ~~                                                            
##    .politW2P          0.134       NA                      0.134     0.448
##    .politW3P          0.103       NA                      0.103     0.302
##    .politW4P          0.126       NA                      0.126     0.373
##  .politW3S ~~                                                            
##    .politW4S          0.255       NA                      0.255     0.856
##  .politW1P ~~                                                            
##    .politW3S          0.156       NA                      0.156     0.473
##  .politW2P ~~                                                            
##    .politW3S          0.136       NA                      0.136     0.443
##  .politW3S ~~                                                            
##    .politW3P          0.122       NA                      0.122     0.348
##    .politW4P          0.131       NA                      0.131     0.378
##  .politW1P ~~                                                            
##    .politW4S          0.159       NA                      0.159     0.488
##  .politW2P ~~                                                            
##    .politW4S          0.150       NA                      0.150     0.496
##  .politW3P ~~                                                            
##    .politW4S          0.136       NA                      0.136     0.395
##  .politW4S ~~                                                            
##    .politW4P          0.159       NA                      0.159     0.466
##  .compaW1P ~~                                                            
##    .compaW2P       -604.494       NA                   -604.494    -0.797
##    .compaW3P       -633.747       NA                   -633.747    -0.810
##    .compaW4P       -658.848       NA                   -658.848    -0.779
##  .compaW2P ~~                                                            
##    .compaW3P       -680.701       NA                   -680.701    -0.895
##    .compaW4P       -715.888       NA                   -715.888    -0.870
##  .compaW3P ~~                                                            
##    .compaW4P       -782.428       NA                   -782.428    -0.922
##  .politW1P ~~                                                            
##    .politW2P          0.246       NA                      0.246     0.734
##    .politW3P          0.246       NA                      0.246     0.645
##    .politW4P          0.266       NA                      0.266     0.704
##  .politW2P ~~                                                            
##    .politW3P          0.270       NA                      0.270     0.761
##    .politW4P          0.274       NA                      0.274     0.777
##  .politW3P ~~                                                            
##    .politW4P          0.334       NA                      0.334     0.835
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all 
##     interc            4.139       NA                      0.597     0.597
##     slope             0.000       NA                      0.002     0.002
##    .compaW1S          0.000                               0.000     0.000
##    .compaW2S          0.000                               0.000     0.000
##    .compaW3S          0.000                               0.000     0.000
##    .compaW4S          0.000                               0.000     0.000
##    .politW1S   (b)    3.717       NA                      3.717     6.969
##    .politW2S   (b)    3.717       NA                      3.717     6.935
##    .politW3S   (b)    3.717       NA                      3.717     6.752
##    .politW4S   (b)    3.717       NA                      3.717     6.863
##    .compaW1P   (c)  -10.427       NA                    -10.427   -17.729
##    .compaW2P   (c)  -10.427       NA                    -10.427   -18.211
##    .compaW3P   (c)  -10.427       NA                    -10.427   -18.852
##    .compaW4P   (c)  -10.427       NA                    -10.427   -17.836
##    .politW1P   (d)    3.793       NA                      3.793     6.320
##    .politW2P   (d)    3.793       NA                      3.793     6.788
##    .politW3P   (d)    3.793       NA                      3.793     5.977
##    .politW4P   (d)    3.793       NA                      3.793     6.019
##    .agree1            0.000                               0.000     0.000
##    .agree2            0.000                               0.000     0.000
##    .agree3            0.000                               0.000     0.000
##    .agree4            0.000                               0.000     0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all 
##    .compaW1S        -64.457       NA                    -64.457  -294.266
##    .politW1S          0.285       NA                      0.285     1.000
##    .compaW1P       -779.931       NA                   -779.931 -2254.742
##    .politW1P          0.360       NA                      0.360     1.000
##    .compaW2S        -60.882       NA                    -60.882  -262.683
##    .politW2S          0.287       NA                      0.287     1.000
##    .compaW2P       -736.980       NA                   -736.980 -2248.046
##    .politW2P          0.312       NA                      0.312     1.000
##    .compaW3S        -64.862       NA                    -64.862  -283.012
##    .politW3S          0.303       NA                      0.303     1.000
##    .compaW3P       -784.980       NA                   -784.980 -2565.888
##    .politW3P          0.403       NA                      0.403     1.000
##    .compaW4S        -75.890       NA                    -75.890  -320.960
##    .politW4S          0.293       NA                      0.293     1.000
##    .compaW4P       -918.087       NA                   -918.087 -2686.068
##    .politW4P          0.397       NA                      0.397     1.000
##    .agree1           16.634       NA                      0.257     0.257
##    .agree2            8.075       NA                      0.132     0.132
##    .agree3            4.107       NA                      0.063     0.063
##    .agree4            6.521       NA                      0.086     0.086
##     interc           48.042       NA                      1.000     1.000
##     slope             0.023       NA                      1.000     1.000
semPaths(lgmAgree, what = "col", whatLabels = "est", intercepts = T)

with random parcels

lgmAgree <- '

# factor at each time point with same loading
agree1 =~ agreeW1S1        + a * agreeW1S2 + 
           peer * agreeW1P1 + aa * agreeW1P2

agree2 =~ agreeW2S1        + a * agreeW2S2 + 
           peer * agreeW2P1 + aa * agreeW2P2

agree3 =~ agreeW3S1        + a * agreeW3S2 + 
           peer * agreeW3P1 + aa * agreeW3P2
  
agree4 =~ agreeW4S1        + a * agreeW4S2 + 
           peer * agreeW4P1 + aa * agreeW4P2

# second order factor for intercept and slope
interc =~ 1*agree1 + 1*agree2 + 1*agree3 + 1*agree4
slope =~ 0*agree1 + 6*agree2 + 13*agree3 + 19*agree4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
agreeW1S1 ~ 0*1
agreeW2S1 ~ 0*1
agreeW3S1 ~ 0*1
agreeW4S1 ~ 0*1

# fix equal intercepts
agreeW1S2 ~ b*1
agreeW2S2 ~ b*1
agreeW3S2 ~ b*1
agreeW4S2 ~ b*1

agreeW1P1 ~ c*1
agreeW2P1 ~ c*1
agreeW3P1 ~ c*1
agreeW4P1 ~ c*1

agreeW1P2 ~ d*1
agreeW2P2 ~ d*1
agreeW3P2 ~ d*1
agreeW4P2 ~ d*1

# error covariance - similar parcels across waves
agreeW1S1 ~~ agreeW2S1 + agreeW3S1 + agreeW4S1
agreeW2S1 ~~ agreeW3S1 + agreeW4S1
agreeW3S1 ~~ agreeW4S1

agreeW1S2 ~~ agreeW2S2 + agreeW3S2 + agreeW4S2
agreeW2S2 ~~ agreeW3S2 + agreeW4S2
agreeW3S2 ~~ agreeW4S2

agreeW1P1 ~~ agreeW2P1 + agreeW3P1 + agreeW4P1
agreeW2P1 ~~ agreeW3P1 + agreeW4P1
agreeW3P1 ~~ agreeW4P1

agreeW1P2 ~~ agreeW2P2 + agreeW3P2 + agreeW4P2
agreeW2P2 ~~ agreeW3P2 + agreeW4P2
agreeW3P2 ~~ agreeW4P2

# error covariance - same method at one wave
agreeW1S1 ~~ agreeW1S2
agreeW1P1 ~~ agreeW1P2
agreeW2S1 ~~ agreeW2S2
agreeW2P1 ~~ agreeW2P2
agreeW3S1 ~~ agreeW3S2
agreeW3P1 ~~ agreeW3P2
agreeW4S1 ~~ agreeW4S2
agreeW4P1 ~~ agreeW4P2
'
lgmAgree <- sem(lgmAgree, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmAgree, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 314 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree1 =~                                                             
##     agrW1S1           1.000                               1.348    0.949
##     agrW1S2    (a)    0.948       NA                      1.278    0.946
##     agrW1P1 (peer)    0.935       NA                      1.261    0.967
##     agrW1P2   (aa)    0.930       NA                      1.253    0.972
##   agree2 =~                                                             
##     agrW2S1           1.000                               1.259    0.954
##     agrW2S2    (a)    0.948       NA                      1.193    0.953
##     agrW2P1 (peer)    0.935       NA                      1.177    0.920
##     agrW2P2   (aa)    0.930       NA                      1.170    0.940
##   agree3 =~                                                             
##     agrW3S1           1.000                               1.262    0.945
##     agrW3S2    (a)    0.948       NA                      1.196    0.943
##     agrW3P1 (peer)    0.935       NA                      1.180    0.900
##     agrW3P2   (aa)    0.930       NA                      1.173    0.947
##   agree4 =~                                                             
##     agrW4S1           1.000                               1.324    0.949
##     agrW4S2    (a)    0.948       NA                      1.255    0.945
##     agrW4P1 (peer)    0.935       NA                      1.238    0.925
##     agrW4P2   (aa)    0.930       NA                      1.231    0.961
##   interc =~                                                             
##     agree1            1.000                               0.863    0.863
##     agree2            1.000                               0.925    0.925
##     agree3            1.000                               0.922    0.922
##     agree4            1.000                               0.879    0.879
##   slope =~                                                              
##     agree1            0.000                                  NA       NA
##     agree2            6.000                                  NA       NA
##     agree3           13.000                                  NA       NA
##     agree4           19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.014       NA                      0.509    0.509
##  .agreeW1S1 ~~                                                          
##    .agreeW2S1         0.086       NA                      0.086    0.489
##    .agreeW3S1         0.065       NA                      0.065    0.332
##    .agreeW4S1         0.019       NA                      0.019    0.099
##  .agreeW2S1 ~~                                                          
##    .agreeW3S1         0.087       NA                      0.087    0.502
##    .agreeW4S1         0.094       NA                      0.094    0.541
##  .agreeW3S1 ~~                                                          
##    .agreeW4S1         0.065       NA                      0.065    0.336
##  .agreeW1S2 ~~                                                          
##    .agreeW2S2         0.083       NA                      0.083    0.500
##    .agreeW3S2         0.063       NA                      0.063    0.339
##    .agreeW4S2         0.040       NA                      0.040    0.212
##  .agreeW2S2 ~~                                                          
##    .agreeW3S2         0.090       NA                      0.090    0.554
##    .agreeW4S2         0.065       NA                      0.065    0.391
##  .agreeW3S2 ~~                                                          
##    .agreeW4S2         0.036       NA                      0.036    0.197
##  .agreeW1P1 ~~                                                          
##    .agreeW2P1         0.050       NA                      0.050    0.300
##    .agreeW3P1         0.056       NA                      0.056    0.298
##    .agreeW4P1         0.047       NA                      0.047    0.281
##  .agreeW2P1 ~~                                                          
##    .agreeW3P1         0.219       NA                      0.219    0.763
##    .agreeW4P1         0.208       NA                      0.208    0.818
##  .agreeW3P1 ~~                                                          
##    .agreeW4P1         0.245       NA                      0.245    0.843
##  .agreeW1P2 ~~                                                          
##    .agreeW2P2         0.144       NA                      0.144    1.119
##    .agreeW3P2         0.132       NA                      0.132    1.093
##    .agreeW4P2         0.124       NA                      0.124    1.155
##  .agreeW2P2 ~~                                                          
##    .agreeW3P2         0.169       NA                      0.169    1.004
##    .agreeW4P2         0.156       NA                      0.156    1.043
##  .agreeW3P2 ~~                                                          
##    .agreeW4P2         0.144       NA                      0.144    1.027
##  .agreeW1S1 ~~                                                          
##    .agreeW1S2         0.097       NA                      0.097    0.498
##  .agreeW1P1 ~~                                                          
##    .agreeW1P2        -0.000       NA                     -0.000   -0.003
##  .agreeW2S1 ~~                                                          
##    .agreeW2S2        -0.022       NA                     -0.022   -0.143
##  .agreeW2P1 ~~                                                          
##    .agreeW2P2        -0.000       NA                     -0.000   -0.000
##  .agreeW3S1 ~~                                                          
##    .agreeW3S2         0.094       NA                      0.094    0.509
##  .agreeW3P1 ~~                                                          
##    .agreeW3P2        -0.000       NA                     -0.000   -0.000
##  .agreeW4S1 ~~                                                          
##    .agreeW4S2         0.121       NA                      0.121    0.629
##  .agreeW4P1 ~~                                                          
##    .agreeW4P2        -0.000       NA                     -0.000   -0.001
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.712       NA                      3.190    3.190
##     slope            -0.000       NA                         NA       NA
##    .agreeW1S1         0.000                               0.000    0.000
##    .agreeW2S1         0.000                               0.000    0.000
##    .agreeW3S1         0.000                               0.000    0.000
##    .agreeW4S1         0.000                               0.000    0.000
##    .agreeW1S2  (b)    0.278       NA                      0.278    0.206
##    .agreeW2S2  (b)    0.278       NA                      0.278    0.222
##    .agreeW3S2  (b)    0.278       NA                      0.278    0.219
##    .agreeW4S2  (b)    0.278       NA                      0.278    0.210
##    .agreeW1P1  (c)    0.137       NA                      0.137    0.105
##    .agreeW2P1  (c)    0.137       NA                      0.137    0.107
##    .agreeW3P1  (c)    0.137       NA                      0.137    0.105
##    .agreeW4P1  (c)    0.137       NA                      0.137    0.103
##    .agreeW1P2  (d)    0.327       NA                      0.327    0.254
##    .agreeW2P2  (d)    0.327       NA                      0.327    0.263
##    .agreeW3P2  (d)    0.327       NA                      0.327    0.264
##    .agreeW4P2  (d)    0.327       NA                      0.327    0.256
##    .agree1            0.000                               0.000    0.000
##    .agree2            0.000                               0.000    0.000
##    .agree3            0.000                               0.000    0.000
##    .agree4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .agreeW1S1         0.199       NA                      0.199    0.099
##    .agreeW1S2         0.191       NA                      0.191    0.105
##    .agreeW1P1         0.109       NA                      0.109    0.064
##    .agreeW1P2         0.092       NA                      0.092    0.056
##    .agreeW2S1         0.156       NA                      0.156    0.090
##    .agreeW2S2         0.145       NA                      0.145    0.093
##    .agreeW2P1         0.251       NA                      0.251    0.153
##    .agreeW2P2         0.180       NA                      0.180    0.116
##    .agreeW3S1         0.192       NA                      0.192    0.107
##    .agreeW3S2         0.180       NA                      0.180    0.112
##    .agreeW3P1         0.327       NA                      0.327    0.190
##    .agreeW3P2         0.158       NA                      0.158    0.103
##    .agreeW4S1         0.194       NA                      0.194    0.100
##    .agreeW4S2         0.190       NA                      0.190    0.107
##    .agreeW4P1         0.258       NA                      0.258    0.144
##    .agreeW4P2         0.124       NA                      0.124    0.076
##    .agree1            0.462       NA                      0.254    0.254
##    .agree2            0.082       NA                      0.052    0.052
##    .agree3           -0.032       NA                     -0.020   -0.020
##    .agree4            0.067       NA                      0.038    0.038
##     interc            1.355       NA                      1.000    1.000
##     slope            -0.001       NA                         NA       NA
semPaths(lgmAgree, what = "col", whatLabels = "est", intercepts = T)

parcelAllocation

item.syntax <- c(paste0("f1 =~ w1bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f1 =~ pw1bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f2 =~ w2bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f2 =~ pw2bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f3 =~ w3bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f3 =~ pw3bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f4 =~ w4bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)),
                 paste0("f4 =~ pw4bf_", c(2,12,22,32,42,52,62,72,82,92,
                                        7,17,27,37,47,57,67,77,87,97)))
mod.parcels <- '
f1 =~ par1 + par2 + par3 + par4
f2 =~ par5 + par6 + par7 + par8
f3 =~ par9 + par10 + par11 + par12
f4 =~ par13 + par14 + par15 + par16
'

parcel.names <- paste0("par", 1:16)

parcelAllocation(mod.parcels, data = data, nAlloc = 100,
                 parcel.names = parcel.names, item.syntax = item.syntax,
                 std.lv = TRUE)
## Error in parcelAllocation(mod.parcels, data = data, nAlloc = 100, parcel.names = parcel.names, : could not find function "parcelAllocation"
dataList <- parcelAllocation(mod.parcels, data = data, nAlloc = 100,
                             parcel.names = parcel.names,
                             item.syntax = item.syntax)
## Error in parcelAllocation(mod.parcels, data = data, nAlloc = 100, parcel.names = parcel.names, : could not find function "parcelAllocation"

with latent method factors

lgmAgree <- '
# factor at each time point with same loading
agree1 =~ agreeW1S1        + a * agreeW1S2 + 
           peer * agreeW1P1 + aa * agreeW1P2

agree2 =~ agreeW2S1        + a * agreeW2S2 + 
           peer * agreeW2P1 + aa * agreeW2P2

agree3 =~ agreeW3S1        + a * agreeW3S2 + 
           peer * agreeW3P1 + aa * agreeW3P2
  
agree4 =~ agreeW4S1        + a * agreeW4S2 + 
           peer * agreeW4P1 + aa * agreeW4P2

# second order factor for intercept and slope
interc =~ 1*agree1 + 1*agree2 + 1*agree3 + 1*agree4
slope =~ 0*agree1 + 6*agree2 + 13*agree3 + 19*agree4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
agreeW1S1 ~ 0*1
agreeW2S1 ~ 0*1
agreeW3S1 ~ 0*1
agreeW4S1 ~ 0*1

# fix equal intercepts
agreeW1S2 ~ b*1
agreeW2S2 ~ b*1
agreeW3S2 ~ b*1
agreeW4S2 ~ b*1

agreeW1P1 ~ c*1
agreeW2P1 ~ c*1
agreeW3P1 ~ c*1
agreeW4P1 ~ c*1

agreeW1P2 ~ d*1
agreeW2P2 ~ d*1
agreeW3P2 ~ d*1
agreeW4P2 ~ d*1

# latent method variances
self =~ agreeW1S1 + agreeW1S2 + 
        agreeW2S1 + agreeW2S2 + 
        agreeW3S1 + agreeW3S2 +
        agreeW4S1 + agreeW4S2
peer =~ agreeW1P1 + agreeW1P2 + 
        agreeW2P1 + agreeW2P2 + 
        agreeW3P1 + agreeW3P2 +
        agreeW4P1 + agreeW4P2
'
lgmAgree <- sem(lgmAgree, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmAgree, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 392 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         70
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree1 =~                                                             
##     agrW1S1           1.000                               1.069    0.840
##     agrW1S2    (a)    0.960       NA                      1.026    0.840
##     agrW1P1 (peer)    0.837       NA                      0.895    0.538
##     agrW1P2   (aa)    0.803       NA                      0.859    0.476
##   agree2 =~                                                             
##     agrW2S1           1.000                               1.080    0.886
##     agrW2S2    (a)    0.960       NA                      1.037    0.859
##     agrW2P1 (peer)    0.837       NA                      0.904    0.608
##     agrW2P2   (aa)    0.803       NA                      0.868    0.482
##   agree3 =~                                                             
##     agrW3S1           1.000                               1.096    0.877
##     agrW3S2    (a)    0.960       NA                      1.051    0.868
##     agrW3P1 (peer)    0.837       NA                      0.917    0.656
##     agrW3P2   (aa)    0.803       NA                      0.880    0.491
##   agree4 =~                                                             
##     agrW4S1           1.000                               1.111    0.939
##     agrW4S2    (a)    0.960       NA                      1.066    0.935
##     agrW4P1 (peer)    0.837       NA                      0.930    0.678
##     agrW4P2   (aa)    0.803       NA                      0.892    0.500
##   interc =~                                                             
##     agree1            1.000                               1.000    1.000
##     agree2            1.000                               0.990    0.990
##     agree3            1.000                               0.976    0.976
##     agree4            1.000                               0.962    0.962
##   slope =~                                                              
##     agree1            0.000                               0.000    0.000
##     agree2            6.000                               0.044    0.044
##     agree3           13.000                               0.093    0.093
##     agree4           19.000                               0.134    0.134
##   self =~                                                               
##     agrW1S1           1.000                               0.790    0.621
##     agrW1S2           0.920       NA                      0.727    0.595
##     agrW2S1           0.762       NA                      0.602    0.494
##     agrW2S2           0.806       NA                      0.637    0.528
##     agrW3S1           0.643       NA                      0.508    0.406
##     agrW3S2           0.645       NA                      0.510    0.421
##     agrW4S1           0.398       NA                      0.315    0.266
##     agrW4S2           0.396       NA                      0.313    0.274
##   peer =~                                                               
##     agrW1P1           1.000                               1.133    0.681
##     agrW1P2           1.180       NA                      1.337    0.741
##     agrW2P1           0.730       NA                      0.827    0.556
##     agrW2P2           1.147       NA                      1.299    0.721
##     agrW3P1           0.601       NA                      0.681    0.487
##     agrW3P2           1.100       NA                      1.247    0.696
##     agrW4P1           0.577       NA                      0.654    0.477
##     agrW4P2           1.063       NA                      1.204    0.675
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.002       NA                      0.216    0.216
##     self             -0.089       NA                     -0.106   -0.106
##     peer              0.383       NA                      0.316    0.316
##   slope ~~                                                              
##     self              0.005       NA                      0.856    0.856
##     peer              0.009       NA                      0.989    0.989
##   self ~~                                                               
##     peer              0.725       NA                      0.810    0.810
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.321       NA                      3.107    3.107
##     slope             0.001       NA                      0.076    0.076
##    .agreeW1S1         0.000                               0.000    0.000
##    .agreeW2S1         0.000                               0.000    0.000
##    .agreeW3S1         0.000                               0.000    0.000
##    .agreeW4S1         0.000                               0.000    0.000
##    .agreeW1S2  (b)    0.278       NA                      0.278    0.228
##    .agreeW2S2  (b)    0.278       NA                      0.278    0.231
##    .agreeW3S2  (b)    0.278       NA                      0.278    0.230
##    .agreeW4S2  (b)    0.278       NA                      0.278    0.244
##    .agreeW1P1  (c)    0.265       NA                      0.265    0.159
##    .agreeW2P1  (c)    0.265       NA                      0.265    0.178
##    .agreeW3P1  (c)    0.265       NA                      0.265    0.190
##    .agreeW4P1  (c)    0.265       NA                      0.265    0.194
##    .agreeW1P2  (d)    0.409       NA                      0.409    0.227
##    .agreeW2P2  (d)    0.409       NA                      0.409    0.227
##    .agreeW3P2  (d)    0.409       NA                      0.409    0.228
##    .agreeW4P2  (d)    0.409       NA                      0.409    0.229
##    .agree1            0.000                               0.000    0.000
##    .agree2            0.000                               0.000    0.000
##    .agree3            0.000                               0.000    0.000
##    .agree4            0.000                               0.000    0.000
##     self              0.000                               0.000    0.000
##     peer              0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .agreeW1S1         0.029       NA                      0.029    0.018
##    .agreeW1S2         0.070       NA                      0.070    0.047
##    .agreeW1P1         0.045       NA                      0.045    0.016
##    .agreeW1P2        -0.000       NA                     -0.000   -0.000
##    .agreeW2S1         0.044       NA                      0.044    0.029
##    .agreeW2S2         0.064       NA                      0.064    0.044
##    .agreeW2P1         0.180       NA                      0.180    0.081
##    .agreeW2P2        -0.000       NA                     -0.000   -0.000
##    .agreeW3S1         0.129       NA                      0.129    0.083
##    .agreeW3S2         0.127       NA                      0.127    0.087
##    .agreeW3P1         0.150       NA                      0.150    0.077
##    .agreeW3P2         0.000       NA                      0.000    0.000
##    .agreeW4S1         0.056       NA                      0.056    0.040
##    .agreeW4S2         0.056       NA                      0.056    0.043
##    .agreeW4P1         0.055       NA                      0.055    0.029
##    .agreeW4P2        -0.000       NA                     -0.000   -0.000
##    .agree1            0.000       NA                      0.000    0.000
##    .agree2            0.000       NA                      0.000    0.000
##    .agree3           -0.000       NA                     -0.000   -0.000
##    .agree4            0.000       NA                      0.000    0.000
##     interc            1.143       NA                      1.000    1.000
##     slope             0.000       NA                      1.000    1.000
##     self              0.624       NA                      1.000    1.000
##     peer              1.283       NA                      1.000    1.000
semPaths(lgmAgree, what = "col", whatLabels = "est", intercepts = T)

with random parcels + equality and positive constraints in residual covar

lgmAgree <- '

# factor at each time point with same loading
agree1 =~ agreeW1S1        + a * agreeW1S2 + 
           peer * agreeW1P1 + aa * agreeW1P2

agree2 =~ agreeW2S1        + a * agreeW2S2 + 
           peer * agreeW2P1 + aa * agreeW2P2

agree3 =~ agreeW3S1        + a * agreeW3S2 + 
           peer * agreeW3P1 + aa * agreeW3P2
  
agree4 =~ agreeW4S1        + a * agreeW4S2 + 
           peer * agreeW4P1 + aa * agreeW4P2

# second order factor for intercept and slope
interc =~ 1*agree1 + 1*agree2 + 1*agree3 + 1*agree4
slope =~ 0*agree1 + 6*agree2 + 13*agree3 + 19*agree4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
agreeW1S1 ~ 0*1
agreeW2S1 ~ 0*1
agreeW3S1 ~ 0*1
agreeW4S1 ~ 0*1

# fix equal intercepts
agreeW1S2 ~ b*1
agreeW2S2 ~ b*1
agreeW3S2 ~ b*1
agreeW4S2 ~ b*1

agreeW1P1 ~ c*1
agreeW2P1 ~ c*1
agreeW3P1 ~ c*1
agreeW4P1 ~ c*1

agreeW1P2 ~ d*1
agreeW2P2 ~ d*1
agreeW3P2 ~ d*1
agreeW4P2 ~ d*1

# error covariance - similar parcels across waves
agreeW1S1 ~~ covs1*agreeW2S1 + covs2*agreeW3S1 + covs3*agreeW4S1 
agreeW2S1 ~~ covs1*agreeW3S1 + covs2*agreeW4S1
agreeW3S1 ~~ covs1*agreeW4S1

agreeW1S2 ~~ covs1*agreeW2S2 + covs2*agreeW3S2 + covs3*agreeW4S2
agreeW2S2 ~~ covs1*agreeW3S2 + covs2*agreeW4S2
agreeW3S2 ~~ covs1*agreeW4S2

agreeW1P1 ~~ covp1*agreeW2P1 + covp2*agreeW3P1 + covp3*agreeW4P1
agreeW2P1 ~~ covp1*agreeW3P1 + covp2*agreeW4P1
agreeW3P1 ~~ covp1*agreeW4P1

agreeW1P2 ~~ covp1*agreeW2P2 + covp2*agreeW3P2 + covp3*agreeW4P2
agreeW2P2 ~~ covp1*agreeW3P2 + covp2*agreeW4P2
agreeW3P2 ~~ covp1*agreeW4P2

# positive constraints for variances
agree1 ~~ var1*agree1
agree2 ~~ var2*agree2
agree3 ~~ var3*agree3
agree4 ~~ var4*agree4
interc ~~ var5*interc
slope ~~ var6*slope
var1 > 0
var2 > 0
var3 > 0
var4 > 0
var5 > 0
var6 > 0
agreeW1S1 ~~ var7*agreeW1S1
agreeW2S1 ~~ var8*agreeW2S1
agreeW3S1 ~~ var9*agreeW3S1
agreeW4S1 ~~ var10*agreeW4S1
agreeW1S2 ~~ var11*agreeW1S2
agreeW2S2 ~~ var12*agreeW2S2
agreeW3S2 ~~ var13*agreeW3S2
agreeW4S2 ~~ var14*agreeW4S2
agreeW1P1 ~~ var15*agreeW1P1
agreeW2P1 ~~ var16*agreeW2P1
agreeW3P1 ~~ var17*agreeW3P1
agreeW4P1 ~~ var18*agreeW4P1
agreeW1P2 ~~ var19*agreeW1P2
agreeW2P2 ~~ var20*agreeW2P2
agreeW3P2 ~~ var21*agreeW3P2
agreeW4P2 ~~ var22*agreeW4P2
var7 > 0
var8 > 0
var9 > 0
var10 > 0
var11 > 0
var12 > 0
var13 > 0
var14 > 0
var15 > 0
var16 > 0
var17 > 0
var18 > 0
var19 > 0
var20 > 0
var21 > 0
var22 > 0
'
lgmAgree <- sem(lgmAgree, data = data, missing = "FIML")
## Warning in computeOmega(Sigma.hat = Sigma.hat, Mu.hat = Mu.hat, lavsamplestats = lavsamplestats, : lav_model_gradient: Sigma.hat is not positive definite

## Warning in computeOmega(Sigma.hat = Sigma.hat, Mu.hat = Mu.hat, lavsamplestats = lavsamplestats, : lav_model_gradient: Sigma.hat is not positive definite
## Error in chol.default(S): the leading minor of order 3 is not positive definite
summary(lgmAgree, fit.measures = T, standardized = T)
##    Length     Class      Mode 
##         1 character character
semPaths(lgmAgree, what = "col", whatLabels = "est", intercepts = T)
## Error in semPlotModel.default("\n\n# factor at each time point with same loading\nagree1 =~ agreeW1S1        + a * agreeW1S2 + \n           peer * agreeW1P1 + aa * agreeW1P2\n\nagree2 =~ agreeW2S1        + a * agreeW2S2 + \n           peer * agreeW2P1 + aa * agreeW2P2\n\nagree3 =~ agreeW3S1        + a * agreeW3S2 + \n           peer * agreeW3P1 + aa * agreeW3P2\n  \nagree4 =~ agreeW4S1        + a * agreeW4S2 + \n           peer * agreeW4P1 + aa * agreeW4P2\n\n# second order factor for intercept and slope\ninterc =~ 1*agree1 + 1*agree2 + 1*agree3 + 1*agree4\nslope =~ 0*agree1 + 6*agree2 + 13*agree3 + 19*agree4\ninterc ~~ slope\ninterc ~ 1\nslope ~ 1\n\n# fix zero intercepts\nagreeW1S1 ~ 0*1\nagreeW2S1 ~ 0*1\nagreeW3S1 ~ 0*1\nagreeW4S1 ~ 0*1\n\n# fix equal intercepts\nagreeW1S2 ~ b*1\nagreeW2S2 ~ b*1\nagreeW3S2 ~ b*1\nagreeW4S2 ~ b*1\n\nagreeW1P1 ~ c*1\nagreeW2P1 ~ c*1\nagreeW3P1 ~ c*1\nagreeW4P1 ~ c*1\n\nagreeW1P2 ~ d*1\nagreeW2P2 ~ d*1\nagreeW3P2 ~ d*1\nagreeW4P2 ~ d*1\n\n# error covariance - similar parcels across waves\nagreeW1S1 ~~ covs1*agreeW2S1 + covs2*agreeW3S1 + covs3*agreeW4S1 \nagreeW2S1 ~~ covs1*agreeW3S1 + covs2*agreeW4S1\nagreeW3S1 ~~ covs1*agreeW4S1\n\nagreeW1S2 ~~ covs1*agreeW2S2 + covs2*agreeW3S2 + covs3*agreeW4S2\nagreeW2S2 ~~ covs1*agreeW3S2 + covs2*agreeW4S2\nagreeW3S2 ~~ covs1*agreeW4S2\n\nagreeW1P1 ~~ covp1*agreeW2P1 + covp2*agreeW3P1 + covp3*agreeW4P1\nagreeW2P1 ~~ covp1*agreeW3P1 + covp2*agreeW4P1\nagreeW3P1 ~~ covp1*agreeW4P1\n\nagreeW1P2 ~~ covp1*agreeW2P2 + covp2*agreeW3P2 + covp3*agreeW4P2\nagreeW2P2 ~~ covp1*agreeW3P2 + covp2*agreeW4P2\nagreeW3P2 ~~ covp1*agreeW4P2\n\n# positive constraints for variances\nagree1 ~~ var1*agree1\nagree2 ~~ var2*agree2\nagree3 ~~ var3*agree3\nagree4 ~~ var4*agree4\ninterc ~~ var5*interc\nslope ~~ var6*slope\nvar1 > 0\nvar2 > 0\nvar3 > 0\nvar4 > 0\nvar5 > 0\nvar6 > 0\nagreeW1S1 ~~ var7*agreeW1S1\nagreeW2S1 ~~ var8*agreeW2S1\nagreeW3S1 ~~ var9*agreeW3S1\nagreeW4S1 ~~ var10*agreeW4S1\nagreeW1S2 ~~ var11*agreeW1S2\nagreeW2S2 ~~ var12*agreeW2S2\nagreeW3S2 ~~ var13*agreeW3S2\nagreeW4S2 ~~ var14*agreeW4S2\nagreeW1P1 ~~ var15*agreeW1P1\nagreeW2P1 ~~ var16*agreeW2P1\nagreeW3P1 ~~ var17*agreeW3P1\nagreeW4P1 ~~ var18*agreeW4P1\nagreeW1P2 ~~ var19*agreeW1P2\nagreeW2P2 ~~ var20*agreeW2P2\nagreeW3P2 ~~ var21*agreeW3P2\nagreeW4P2 ~~ var22*agreeW4P2\nvar7 > 0\nvar8 > 0\nvar9 > 0\nvar10 > 0\nvar11 > 0\nvar12 > 0\nvar13 > 0\nvar14 > 0\nvar15 > 0\nvar16 > 0\nvar17 > 0\nvar18 > 0\nvar19 > 0\nvar20 > 0\nvar21 > 0\nvar22 > 0\n", : Input string neither an existing file or Lavaan model.

LGM Conscientiousness

with aspects as parcels

lgmConsci <- '

# factor at each time point with same loading
consci1 =~ indusW1S        + a * orderW1S + 
          peer * indusW1P + aa * orderW1P

consci2 =~ indusW2S        + a * orderW2S + 
          peer * indusW2P + aa * orderW2P

consci3 =~ indusW3S        + a * orderW3S + 
          peer * indusW3P + aa * orderW3P
  
consci4 =~ indusW4S        + a * orderW4S + 
          peer * indusW4P + aa * orderW4P

# second order factor for intercept and slope
interc =~ 1*consci1 + 1*consci2 + 1*consci3 + 1*consci4
slope =~ 0*consci1 + 6*consci2 + 13*consci3 + 19*consci4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
indusW1S ~ 0*1
indusW2S ~ 0*1
indusW3S ~ 0*1
indusW4S ~ 0*1

# fix equal intercepts
orderW1S ~ b*1
orderW2S ~ b*1
orderW3S ~ b*1
orderW4S ~ b*1

indusW1P ~ c*1
indusW2P ~ c*1
indusW3P ~ c*1
indusW4P ~ c*1

orderW1P ~ d*1
orderW2P ~ d*1
orderW3P ~ d*1
orderW4P ~ d*1

# error covariance - similar aspects across waves and informants
indusW1S ~~ indusW2S + indusW3S + indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW2S ~~ indusW3S + indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW3S ~~ indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW4S ~~ indusW1P + indusW2P + indusW3P + indusW4P

orderW1S ~~ orderW2S + orderW3S + orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW2S ~~ orderW3S + orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW3S ~~ orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW4S ~~ orderW1P + orderW2P + orderW3P + orderW4P

indusW1P ~~ indusW2P + indusW3P + indusW4P
indusW2P ~~ indusW3P + indusW4P
indusW3P ~~ indusW4P

orderW1P ~~ orderW2P + orderW3P + orderW4P
orderW2P ~~ orderW3P + orderW4P
orderW3P ~~ orderW4P
'
lgmConsci <- sem(lgmConsci, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
summary(lgmConsci, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 388 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        105
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci1 =~                                                            
##     indsW1S           1.000                               0.097    0.163
##     ordrW1S    (a)    1.374       NA                      0.134    0.215
##     indsW1P (peer)    4.988       NA                      0.485    0.778
##     ordrW1P   (aa)    4.525       NA                      0.440    0.685
##   consci2 =~                                                            
##     indsW2S           1.000                               0.087    0.140
##     ordrW2S    (a)    1.374       NA                      0.119    0.214
##     indsW2P (peer)    4.988       NA                      0.432    0.707
##     ordrW2P   (aa)    4.525       NA                      0.392    0.679
##   consci3 =~                                                            
##     indsW3S           1.000                               0.077    0.131
##     ordrW3S    (a)    1.374       NA                      0.105    0.180
##     indsW3P (peer)    4.988       NA                      0.382    0.620
##     ordrW3P   (aa)    4.525       NA                      0.347    0.549
##   consci4 =~                                                            
##     indsW4S           1.000                               0.082    0.137
##     ordrW4S    (a)    1.374       NA                      0.112    0.177
##     indsW4P (peer)    4.988       NA                      0.407    0.701
##     ordrW4P   (aa)    4.525       NA                      0.369    0.601
##   interc =~                                                             
##     consci1           1.000                               0.811    0.811
##     consci2           1.000                               0.912    0.912
##     consci3           1.000                               1.030    1.030
##     consci4           1.000                               0.968    0.968
##   slope =~                                                              
##     consci1           0.000                                  NA       NA
##     consci2           6.000                                  NA       NA
##     consci3          13.000                                  NA       NA
##     consci4          19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.000       NA                     -0.061   -0.061
##  .indusW1S ~~                                                           
##    .indusW2S          0.275       NA                      0.275    0.765
##    .indusW3S          0.235       NA                      0.235    0.688
##    .indusW4S          0.239       NA                      0.239    0.689
##    .indusW1P          0.062       NA                      0.062    0.270
##    .indusW2P          0.086       NA                      0.086    0.340
##    .indusW3P          0.083       NA                      0.083    0.291
##    .indusW4P          0.060       NA                      0.060    0.247
##  .indusW2S ~~                                                           
##    .indusW3S          0.285       NA                      0.285    0.803
##    .indusW4S          0.294       NA                      0.294    0.816
##  .indusW1P ~~                                                           
##    .indusW2S          0.048       NA                      0.048    0.200
##  .indusW2S ~~                                                           
##    .indusW2P          0.101       NA                      0.101    0.384
##    .indusW3P          0.102       NA                      0.102    0.344
##    .indusW4P          0.080       NA                      0.080    0.318
##  .indusW3S ~~                                                           
##    .indusW4S          0.291       NA                      0.291    0.851
##  .indusW1P ~~                                                           
##    .indusW3S          0.037       NA                      0.037    0.164
##  .indusW2P ~~                                                           
##    .indusW3S          0.091       NA                      0.091    0.362
##  .indusW3S ~~                                                           
##    .indusW3P          0.064       NA                      0.064    0.227
##    .indusW4P          0.046       NA                      0.046    0.190
##  .indusW1P ~~                                                           
##    .indusW4S          0.066       NA                      0.066    0.286
##  .indusW2P ~~                                                           
##    .indusW4S          0.106       NA                      0.106    0.419
##  .indusW3P ~~                                                           
##    .indusW4S          0.074       NA                      0.074    0.260
##  .indusW4S ~~                                                           
##    .indusW4P          0.063       NA                      0.063    0.258
##  .orderW1S ~~                                                           
##    .orderW2S          0.246       NA                      0.246    0.743
##    .orderW3S          0.263       NA                      0.263    0.752
##    .orderW4S          0.247       NA                      0.247    0.652
##    .orderW1P          0.083       NA                      0.083    0.290
##    .orderW2P          0.122       NA                      0.122    0.474
##    .orderW3P          0.093       NA                      0.093    0.290
##    .orderW4P          0.102       NA                      0.102    0.342
##  .orderW2S ~~                                                           
##    .orderW3S          0.259       NA                      0.259    0.826
##    .orderW4S          0.255       NA                      0.255    0.754
##  .orderW1P ~~                                                           
##    .orderW2S          0.101       NA                      0.101    0.397
##  .orderW2S ~~                                                           
##    .orderW2P          0.117       NA                      0.117    0.507
##    .orderW3P          0.098       NA                      0.098    0.339
##    .orderW4P          0.097       NA                      0.097    0.361
##  .orderW3S ~~                                                           
##    .orderW4S          0.291       NA                      0.291    0.811
##  .orderW1P ~~                                                           
##    .orderW3S          0.096       NA                      0.096    0.354
##  .orderW2P ~~                                                           
##    .orderW3S          0.142       NA                      0.142    0.581
##  .orderW3S ~~                                                           
##    .orderW3P          0.091       NA                      0.091    0.300
##    .orderW4P          0.106       NA                      0.106    0.376
##  .orderW1P ~~                                                           
##    .orderW4S          0.109       NA                      0.109    0.375
##  .orderW2P ~~                                                           
##    .orderW4S          0.155       NA                      0.155    0.587
##  .orderW3P ~~                                                           
##    .orderW4S          0.126       NA                      0.126    0.382
##  .orderW4S ~~                                                           
##    .orderW4P          0.127       NA                      0.127    0.415
##  .indusW1P ~~                                                           
##    .indusW2P          0.094       NA                      0.094    0.558
##    .indusW3P          0.115       NA                      0.115    0.607
##    .indusW4P          0.106       NA                      0.106    0.651
##  .indusW2P ~~                                                           
##    .indusW3P          0.152       NA                      0.152    0.728
##    .indusW4P          0.141       NA                      0.141    0.788
##  .indusW3P ~~                                                           
##    .indusW4P          0.166       NA                      0.166    0.826
##  .orderW1P ~~                                                           
##    .orderW2P          0.145       NA                      0.145    0.730
##    .orderW3P          0.193       NA                      0.193    0.781
##    .orderW4P          0.142       NA                      0.142    0.619
##  .orderW2P ~~                                                           
##    .orderW3P          0.172       NA                      0.172    0.769
##    .orderW4P          0.147       NA                      0.147    0.708
##  .orderW3P ~~                                                           
##    .orderW4P          0.204       NA                      0.204    0.786
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.186       NA                     40.371   40.371
##     slope            -0.000       NA                         NA       NA
##    .indusW1S          0.000                               0.000    0.000
##    .indusW2S          0.000                               0.000    0.000
##    .indusW3S          0.000                               0.000    0.000
##    .indusW4S          0.000                               0.000    0.000
##    .orderW1S   (b)   -0.777       NA                     -0.777   -1.249
##    .orderW2S   (b)   -0.777       NA                     -0.777   -1.395
##    .orderW3S   (b)   -0.777       NA                     -0.777   -1.327
##    .orderW4S   (b)   -0.777       NA                     -0.777   -1.229
##    .indusW1P   (c)  -12.202       NA                    -12.202  -19.548
##    .indusW2P   (c)  -12.202       NA                    -12.202  -20.000
##    .indusW3P   (c)  -12.202       NA                    -12.202  -19.790
##    .indusW4P   (c)  -12.202       NA                    -12.202  -21.019
##    .orderW1P   (d)  -11.001       NA                    -11.001  -17.103
##    .orderW2P   (d)  -11.001       NA                    -11.001  -19.066
##    .orderW3P   (d)  -11.001       NA                    -11.001  -17.409
##    .orderW4P   (d)  -11.001       NA                    -11.001  -17.906
##    .consci1           0.000                               0.000    0.000
##    .consci2           0.000                               0.000    0.000
##    .consci3           0.000                               0.000    0.000
##    .consci4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S          0.346       NA                      0.346    0.973
##    .orderW1S          0.369       NA                      0.369    0.954
##    .indusW1P          0.154       NA                      0.154    0.395
##    .orderW1P          0.220       NA                      0.220    0.531
##    .indusW2S          0.373       NA                      0.373    0.980
##    .orderW2S          0.296       NA                      0.296    0.954
##    .indusW2P          0.186       NA                      0.186    0.500
##    .orderW2P          0.180       NA                      0.180    0.540
##    .indusW3S          0.338       NA                      0.338    0.983
##    .orderW3S          0.332       NA                      0.332    0.968
##    .indusW3P          0.234       NA                      0.234    0.616
##    .orderW3P          0.279       NA                      0.279    0.699
##    .indusW4S          0.346       NA                      0.346    0.981
##    .orderW4S          0.388       NA                      0.388    0.969
##    .indusW4P          0.171       NA                      0.171    0.509
##    .orderW4P          0.241       NA                      0.241    0.639
##    .consci1           0.003       NA                      0.342    0.342
##    .consci2           0.001       NA                      0.191    0.191
##    .consci3           0.000       NA                      0.038    0.038
##    .consci4           0.002       NA                      0.231    0.231
##     interc            0.006       NA                      1.000    1.000
##     slope            -0.000       NA                         NA       NA
semPaths(lgmConsci, what = "col", whatLabels = "est", intercepts = T)

with random parcels

lgmConsci <- '

# factor at each time point with same loading
consci1 =~ consciW1S1        + a * consciW1S2 + 
           peer * consciW1P1 + aa * consciW1P2

consci2 =~ consciW2S1        + a * consciW2S2 + 
           peer * consciW2P1 + aa * consciW2P2

consci3 =~ consciW3S1        + a * consciW3S2 + 
           peer * consciW3P1 + aa * consciW3P2
  
consci4 =~ consciW4S1        + a * consciW4S2 + 
           peer * consciW4P1 + aa * consciW4P2

# second order factor for intercept and slope
interc =~ 1*consci1 + 1*consci2 + 1*consci3 + 1*consci4
slope =~ 0*consci1 + 6*consci2 + 13*consci3 + 19*consci4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
consciW1S1 ~ 0*1
consciW2S1 ~ 0*1
consciW3S1 ~ 0*1
consciW4S1 ~ 0*1

# fix equal intercepts
consciW1S2 ~ b*1
consciW2S2 ~ b*1
consciW3S2 ~ b*1
consciW4S2 ~ b*1

consciW1P1 ~ c*1
consciW2P1 ~ c*1
consciW3P1 ~ c*1
consciW4P1 ~ c*1

consciW1P2 ~ d*1
consciW2P2 ~ d*1
consciW3P2 ~ d*1
consciW4P2 ~ d*1

# error covariance - similar parcels across waves
consciW1S1 ~~ consciW2S1 + consciW3S1 + consciW4S1
consciW2S1 ~~ consciW3S1 + consciW4S1
consciW3S1 ~~ consciW4S1

consciW1S2 ~~ consciW2S2 + consciW3S2 + consciW4S2
consciW2S2 ~~ consciW3S2 + consciW4S2
consciW3S2 ~~ consciW4S2

consciW1P1 ~~ consciW2P1 + consciW3P1 + consciW4P1
consciW2P1 ~~ consciW3P1 + consciW4P1
consciW3P1 ~~ consciW4P1

consciW1P2 ~~ consciW2P2 + consciW3P2 + consciW4P2
consciW2P2 ~~ consciW3P2 + consciW4P2
consciW3P2 ~~ consciW4P2

# error covariance - same method at one wave
consciW1S1 ~~ consciW1S2
consciW1P1 ~~ consciW1P2
consciW2S1 ~~ consciW2S2
consciW2P1 ~~ consciW2P2
consciW3S1 ~~ consciW3S2
consciW3P1 ~~ consciW3P2
consciW4S1 ~~ consciW4S2
consciW4P1 ~~ consciW4P2
'
lgmConsci <- sem(lgmConsci, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmConsci, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 364 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci1 =~                                                            
##     cnsW1S1           1.000                               1.566    0.917
##     cnsW1S2    (a)    0.912       NA                      1.428    0.926
##     cnsW1P1 (peer)    0.989       NA                      1.548    0.963
##     cnsW1P2   (aa)    0.885       NA                      1.385    0.973
##   consci2 =~                                                            
##     cnsW2S1           1.000                               1.380    0.966
##     cnsW2S2    (a)    0.912       NA                      1.259    0.977
##     cnsW2P1 (peer)    0.989       NA                      1.365    0.936
##     cnsW2P2   (aa)    0.885       NA                      1.221    0.911
##   consci3 =~                                                            
##     cnsW3S1           1.000                               1.369    0.978
##     cnsW3S2    (a)    0.912       NA                      1.248    0.956
##     cnsW3P1 (peer)    0.989       NA                      1.353    0.917
##     cnsW3P2   (aa)    0.885       NA                      1.211    0.912
##   consci4 =~                                                            
##     cnsW4S1           1.000                               1.386    0.986
##     cnsW4S2    (a)    0.912       NA                      1.264    0.958
##     cnsW4P1 (peer)    0.989       NA                      1.371    0.936
##     cnsW4P2   (aa)    0.885       NA                      1.226    0.918
##   interc =~                                                             
##     consci1           1.000                               0.856    0.856
##     consci2           1.000                               0.971    0.971
##     consci3           1.000                               0.980    0.980
##     consci4           1.000                               0.967    0.967
##   slope =~                                                              
##     consci1           0.000                                  NA       NA
##     consci2           6.000                                  NA       NA
##     consci3          13.000                                  NA       NA
##     consci4          19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.006       NA                      0.231    0.231
##  .consciW1S1 ~~                                                         
##    .consciW2S1        0.060       NA                      0.060    0.239
##    .consciW3S1        0.023       NA                      0.023    0.115
##    .consciW4S1        0.071       NA                      0.071    0.446
##  .consciW2S1 ~~                                                         
##    .consciW3S1        0.021       NA                      0.021    0.198
##    .consciW4S1        0.025       NA                      0.025    0.284
##  .consciW3S1 ~~                                                         
##    .consciW4S1        0.010       NA                      0.010    0.148
##  .consciW1S2 ~~                                                         
##    .consciW2S2       -0.001       NA                     -0.001   -0.005
##    .consciW3S2        0.032       NA                      0.032    0.145
##    .consciW4S2       -0.014       NA                     -0.014   -0.064
##  .consciW2S2 ~~                                                         
##    .consciW3S2        0.038       NA                      0.038    0.358
##    .consciW4S2        0.031       NA                      0.031    0.299
##  .consciW3S2 ~~                                                         
##    .consciW4S2        0.041       NA                      0.041    0.282
##  .consciW1P1 ~~                                                         
##    .consciW2P1        0.050       NA                      0.050    0.224
##    .consciW3P1        0.086       NA                      0.086    0.336
##    .consciW4P1        0.034       NA                      0.034    0.150
##  .consciW2P1 ~~                                                         
##    .consciW3P1        0.243       NA                      0.243    0.807
##    .consciW4P1        0.187       NA                      0.187    0.707
##  .consciW3P1 ~~                                                         
##    .consciW4P1        0.250       NA                      0.250    0.822
##  .consciW1P2 ~~                                                         
##    .consciW2P2        0.222       NA                      0.222    1.226
##    .consciW3P2        0.213       NA                      0.213    1.200
##    .consciW4P2        0.206       NA                      0.206    1.192
##  .consciW2P2 ~~                                                         
##    .consciW3P2        0.302       NA                      0.302    1.002
##    .consciW4P2        0.295       NA                      0.295    1.002
##  .consciW3P2 ~~                                                         
##    .consciW4P2        0.289       NA                      0.289    1.003
##  .consciW1S1 ~~                                                         
##    .consciW1S2        0.325       NA                      0.325    0.820
##  .consciW1P1 ~~                                                         
##    .consciW1P2        0.000       NA                      0.000    0.003
##  .consciW2S1 ~~                                                         
##    .consciW2S2        0.027       NA                      0.027    0.263
##  .consciW2P1 ~~                                                         
##    .consciW2P2       -0.000       NA                     -0.000   -0.000
##  .consciW3S1 ~~                                                         
##    .consciW3S2        0.047       NA                      0.047    0.418
##  .consciW3P1 ~~                                                         
##    .consciW3P2        0.000       NA                      0.000    0.000
##  .consciW4S1 ~~                                                         
##    .consciW4S2        0.033       NA                      0.033    0.376
##  .consciW4P1 ~~                                                         
##    .consciW4P2        0.000       NA                      0.000    0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.547       NA                      2.646    2.646
##     slope             0.000       NA                         NA       NA
##    .consciW1S1        0.000                               0.000    0.000
##    .consciW2S1        0.000                               0.000    0.000
##    .consciW3S1        0.000                               0.000    0.000
##    .consciW4S1        0.000                               0.000    0.000
##    .consciW1S2 (b)    0.389       NA                      0.389    0.253
##    .consciW2S2 (b)    0.389       NA                      0.389    0.302
##    .consciW3S2 (b)    0.389       NA                      0.389    0.298
##    .consciW4S2 (b)    0.389       NA                      0.389    0.295
##    .consciW1P1 (c)    0.305       NA                      0.305    0.189
##    .consciW2P1 (c)    0.305       NA                      0.305    0.209
##    .consciW3P1 (c)    0.305       NA                      0.305    0.206
##    .consciW4P1 (c)    0.305       NA                      0.305    0.208
##    .consciW1P2 (d)    0.403       NA                      0.403    0.283
##    .consciW2P2 (d)    0.403       NA                      0.403    0.301
##    .consciW3P2 (d)    0.403       NA                      0.403    0.304
##    .consciW4P2 (d)    0.403       NA                      0.403    0.302
##    .consci1           0.000                               0.000    0.000
##    .consci2           0.000                               0.000    0.000
##    .consci3           0.000                               0.000    0.000
##    .consci4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .consciW1S1        0.462       NA                      0.462    0.159
##    .consciW1S2        0.339       NA                      0.339    0.143
##    .consciW1P1        0.189       NA                      0.189    0.073
##    .consciW1P2        0.107       NA                      0.107    0.053
##    .consciW2S1        0.136       NA                      0.136    0.067
##    .consciW2S2        0.075       NA                      0.075    0.045
##    .consciW2P1        0.262       NA                      0.262    0.123
##    .consciW2P2        0.307       NA                      0.307    0.171
##    .consciW3S1        0.086       NA                      0.086    0.044
##    .consciW3S2        0.147       NA                      0.147    0.086
##    .consciW3P1        0.346       NA                      0.346    0.159
##    .consciW3P2        0.296       NA                      0.296    0.168
##    .consciW4S1        0.055       NA                      0.055    0.028
##    .consciW4S2        0.142       NA                      0.142    0.081
##    .consciW4P1        0.267       NA                      0.267    0.124
##    .consciW4P2        0.281       NA                      0.281    0.158
##    .consci1           0.655       NA                      0.267    0.267
##    .consci2           0.047       NA                      0.024    0.024
##    .consci3          -0.018       NA                     -0.010   -0.010
##    .consci4           0.037       NA                      0.019    0.019
##     interc            1.797       NA                      1.000    1.000
##     slope            -0.000       NA                         NA       NA
semPaths(lgmConsci, what = "col", whatLabels = "est", intercepts = T)

LGM Extraversion

with aspects as parcels

lgmExtra <- '

# factor at each time point with same loading
extra1 =~ assertW1S        + a * enthuW1S + 
          peer * assertW1P + aa * enthuW1P

extra2 =~ assertW2S        + a * enthuW2S + 
          peer * assertW2P + aa * enthuW2P

extra3 =~ assertW3S        + a * enthuW3S + 
          peer * assertW3P + aa * enthuW3P
  
extra4 =~ assertW4S        + a * enthuW4S + 
          peer * assertW4P + aa * enthuW4P

# second order factor for intercept and slope
interc =~ 1*extra1 + 1*extra2 + 1*extra3 + 1*extra4
slope =~ 0*extra1 + 6*extra2 + 13*extra3 + 19*extra4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
assertW1S ~ 0*1
assertW2S ~ 0*1
assertW3S ~ 0*1
assertW4S ~ 0*1

# fix equal intercepts
enthuW1S ~ b*1
enthuW2S ~ b*1
enthuW3S ~ b*1
enthuW4S ~ b*1

assertW1P ~ c*1
assertW2P ~ c*1
assertW3P ~ c*1
assertW4P ~ c*1

enthuW1P ~ d*1
enthuW2P ~ d*1
enthuW3P ~ d*1
enthuW4P ~ d*1

# error covariance - similar aspects across waves and informants
assertW1S ~~ assertW2S + assertW3S + assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW2S ~~ assertW3S + assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW3S ~~ assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW4S ~~ assertW1P + assertW2P + assertW3P + assertW4P

enthuW1S ~~ enthuW2S + enthuW3S + enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW2S ~~ enthuW3S + enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW3S ~~ enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW4S ~~ enthuW1P + enthuW2P + enthuW3P + enthuW4P

assertW1P ~~ assertW2P + assertW3P + assertW4P
assertW2P ~~ assertW3P + assertW4P
assertW3P ~~ assertW4P

enthuW1P ~~ enthuW2P + enthuW3P + enthuW4P
enthuW2P ~~ enthuW3P + enthuW4P
enthuW3P ~~ enthuW4P
'
lgmExtra <- sem(lgmExtra, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmExtra, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 1083 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        105
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               150.466
##   Degrees of freedom                                65
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2412.811
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.963
##   Tucker-Lewis Index (TLI)                       0.931
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1277.743
##   Loglikelihood unrestricted model (H1)      -1202.510
##                                                       
##   Akaike (AIC)                                2729.486
##   Bayesian (BIC)                              3038.930
##   Sample-size adjusted Bayesian (BIC)         2763.108
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.071
##   90 Percent confidence interval - lower         0.056
##   90 Percent confidence interval - upper         0.086
##   P-value RMSEA <= 0.05                          0.011
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.087
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   extra1 =~                                                             
##     assrW1S           1.000                               4.024    5.963
##     enthW1S    (a)    0.006    0.001    4.726    0.000    0.022    0.035
##     assrW1P (peer)    1.236       NA                      4.973    8.142
##     enthW1P   (aa)    0.008    0.001    5.988    0.000    0.033    0.053
##   extra2 =~                                                             
##     assrW2S           1.000                               3.980    5.807
##     enthW2S    (a)    0.006    0.001    4.747    0.000    0.022    0.036
##     assrW2P (peer)    1.236       NA                      4.919    8.469
##     enthW2P   (aa)    0.008    0.001    5.923    0.000    0.032    0.054
##   extra3 =~                                                             
##     assrW3S           1.000                               3.563    5.261
##     enthW3S    (a)    0.006    0.001    4.691    0.000    0.020    0.032
##     assrW3P (peer)    1.236       NA                      4.404    7.782
##     enthW3P   (aa)    0.008    0.001    5.874    0.000    0.029    0.056
##   extra4 =~                                                             
##     assrW4S           1.000                               3.392    4.994
##     enthW4S    (a)    0.006    0.001    4.756    0.000    0.019    0.029
##     assrW4P (peer)    1.236       NA                      4.192    8.008
##     enthW4P   (aa)    0.008    0.001    6.106    0.000    0.028    0.053
##   interc =~                                                             
##     extra1            1.000                               1.003    1.003
##     extra2            1.000                               1.014    1.014
##     extra3            1.000                               1.132    1.132
##     extra4            1.000                               1.190    1.190
##   slope =~                                                              
##     extra1            0.000                               0.000    0.000
##     extra2            6.000                               0.167    0.167
##     extra3           13.000                               0.405    0.405
##     extra4           19.000                               0.621    0.621
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.237    0.093   -2.553    0.011   -0.530   -0.530
##  .assertW1S ~~                                                          
##    .assertW2S       -14.475    0.688  -21.032    0.000  -14.475   -0.931
##    .assertW3S       -12.820    0.200  -64.142    0.000  -12.820   -0.924
##    .assertW4S       -11.429    0.581  -19.657    0.000  -11.429   -0.867
##    .assertW1P       -19.830    1.619  -12.249    0.000  -19.830   -1.013
##    .assertW2P       -18.205    1.017  -17.906    0.000  -18.205   -0.939
##    .assertW3P       -16.179    0.392  -41.296    0.000  -16.179   -0.934
##    .assertW4P       -14.437    0.674  -21.419    0.000  -14.437   -0.875
##  .assertW2S ~~                                                          
##    .assertW3S       -12.333    0.187  -66.012    0.000  -12.333   -0.899
##    .assertW4S       -11.367    0.659  -17.245    0.000  -11.367   -0.872
##  .assertW1P ~~                                                          
##    .assertW2S       -18.171    1.015  -17.895    0.000  -18.171   -0.939
##  .assertW2S ~~                                                          
##    .assertW2P       -19.408    0.987  -19.665    0.000  -19.408   -1.013
##    .assertW3P       -15.600    0.208  -74.957    0.000  -15.600   -0.911
##    .assertW4P       -14.419    0.731  -19.716    0.000  -14.419   -0.884
##  .assertW3S ~~                                                          
##    .assertW4S       -11.325    1.017  -11.139    0.000  -11.325   -0.974
##  .assertW1P ~~                                                          
##    .assertW3S       -16.153    0.389  -41.565    0.000  -16.153   -0.935
##  .assertW2P ~~                                                          
##    .assertW3S       -15.596    0.206  -75.784    0.000  -15.596   -0.913
##  .assertW3S ~~                                                          
##    .assertW3P       -15.564    0.905  -17.193    0.000  -15.564   -1.019
##    .assertW4P       -14.403    1.170  -12.310    0.000  -14.403   -0.990
##  .assertW1P ~~                                                          
##    .assertW4S       -14.391    0.674  -21.359    0.000  -14.391   -0.877
##  .assertW2P ~~                                                          
##    .assertW4S       -14.374    0.731  -19.651    0.000  -14.374   -0.885
##  .assertW3P ~~                                                          
##    .assertW4S       -14.377    1.172  -12.272    0.000  -14.377   -0.991
##  .assertW4S ~~                                                          
##    .assertW4P       -14.103    1.757   -8.028    0.000  -14.103   -1.020
##  .enthuW1S ~~                                                           
##    .enthuW2S          0.309    0.032    9.684    0.000    0.309    0.780
##    .enthuW3S          0.285    0.031    9.111    0.000    0.285    0.717
##    .enthuW4S          0.299    0.033    8.968    0.000    0.299    0.729
##    .enthuW1P          0.170    0.031    5.466    0.000    0.170    0.435
##    .enthuW2P          0.157    0.030    5.163    0.000    0.157    0.411
##    .enthuW3P          0.106    0.026    4.050    0.000    0.106    0.321
##    .enthuW4P          0.079    0.030    2.625    0.009    0.079    0.235
##  .enthuW2S ~~                                                           
##    .enthuW3S          0.322    0.033    9.698    0.000    0.322    0.825
##    .enthuW4S          0.325    0.035    9.376    0.000    0.325    0.807
##  .enthuW1P ~~                                                           
##    .enthuW2S          0.159    0.031    5.118    0.000    0.159    0.413
##  .enthuW2S ~~                                                           
##    .enthuW2P          0.152    0.031    4.947    0.000    0.152    0.405
##    .enthuW3P          0.116    0.026    4.457    0.000    0.116    0.357
##    .enthuW4P          0.067    0.031    2.195    0.028    0.067    0.205
##  .enthuW3S ~~                                                           
##    .enthuW4S          0.340    0.036    9.461    0.000    0.340    0.842
##  .enthuW1P ~~                                                           
##    .enthuW3S          0.163    0.031    5.255    0.000    0.163    0.425
##  .enthuW2P ~~                                                           
##    .enthuW3S          0.168    0.030    5.598    0.000    0.168    0.448
##  .enthuW3S ~~                                                           
##    .enthuW3P          0.113    0.026    4.329    0.000    0.113    0.347
##    .enthuW4P          0.095    0.029    3.277    0.001    0.095    0.288
##  .enthuW1P ~~                                                           
##    .enthuW4S          0.174    0.034    5.196    0.000    0.174    0.438
##  .enthuW2P ~~                                                           
##    .enthuW4S          0.174    0.032    5.428    0.000    0.174    0.449
##  .enthuW3P ~~                                                           
##    .enthuW4S          0.122    0.028    4.351    0.000    0.122    0.362
##  .enthuW4S ~~                                                           
##    .enthuW4P          0.089    0.032    2.839    0.005    0.089    0.264
##  .assertW1P ~~                                                          
##    .assertW2P       -22.420    1.426  -15.719    0.000  -22.420   -0.930
##    .assertW3P       -19.888    0.601  -33.089    0.000  -19.888   -0.923
##    .assertW4P       -17.756    0.770  -23.050    0.000  -17.756   -0.865
##  .assertW2P ~~                                                          
##    .assertW3P       -19.178    0.202  -94.973    0.000  -19.178   -0.899
##    .assertW4P       -17.715    0.785  -22.570    0.000  -17.715   -0.872
##  .assertW3P ~~                                                          
##    .assertW4P       -17.677    1.334  -13.255    0.000  -17.677   -0.973
##  .enthuW1P ~~                                                           
##    .enthuW2P          0.300    0.037    8.196    0.000    0.300    0.813
##    .enthuW3P          0.248    0.032    7.853    0.000    0.248    0.776
##    .enthuW4P          0.220    0.033    6.596    0.000    0.220    0.682
##  .enthuW2P ~~                                                           
##    .enthuW3P          0.246    0.030    8.071    0.000    0.246    0.788
##    .enthuW4P          0.230    0.033    6.874    0.000    0.230    0.729
##  .enthuW3P ~~                                                           
##    .enthuW4P          0.226    0.030    7.440    0.000    0.226    0.828
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.452    0.042   82.559    0.000    0.856    0.856
##     slope            -0.001    0.001   -0.766    0.444   -0.008   -0.008
##    .assertW1S         0.000                               0.000    0.000
##    .assertW2S         0.000                               0.000    0.000
##    .assertW3S         0.000                               0.000    0.000
##    .assertW4S         0.000                               0.000    0.000
##    .enthuW1S   (b)    3.690    0.036  102.239    0.000    3.690    5.811
##    .enthuW2S   (b)    3.690    0.036  102.239    0.000    3.690    5.908
##    .enthuW3S   (b)    3.690    0.036  102.239    0.000    3.690    5.897
##    .enthuW4S   (b)    3.690    0.036  102.239    0.000    3.690    5.713
##    .assertW1P  (c)   -0.641    0.048  -13.229    0.000   -0.641   -1.049
##    .assertW2P  (c)   -0.641    0.048  -13.229    0.000   -0.641   -1.103
##    .assertW3P  (c)   -0.641    0.048  -13.229    0.000   -0.641   -1.133
##    .assertW4P  (c)   -0.641    0.048  -13.229    0.000   -0.641   -1.224
##    .enthuW1P   (d)    3.801    0.038   99.350    0.000    3.801    6.171
##    .enthuW2P   (d)    3.801    0.038   99.350    0.000    3.801    6.327
##    .enthuW3P   (d)    3.801    0.038   99.350    0.000    3.801    7.295
##    .enthuW4P   (d)    3.801    0.038   99.350    0.000    3.801    7.223
##    .extra1            0.000                               0.000    0.000
##    .extra2            0.000                               0.000    0.000
##    .extra3            0.000                               0.000    0.000
##    .extra4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S       -15.739    1.191  -13.214    0.000  -15.739  -34.563
##    .enthuW1S          0.403    0.035   11.466    0.000    0.403    0.999
##    .assertW1P       -24.362    2.163  -11.262    0.000  -24.362  -65.288
##    .enthuW1P          0.378    0.042    9.100    0.000    0.378    0.997
##    .assertW2S       -15.373    0.715  -21.488    0.000  -15.373  -32.720
##    .enthuW2S          0.390    0.036   10.775    0.000    0.390    0.999
##    .assertW2P       -23.861    1.329  -17.960    0.000  -23.861  -70.719
##    .enthuW2P          0.360    0.039    9.155    0.000    0.360    0.997
##    .assertW3S       -12.238    0.774  -15.819    0.000  -12.238  -26.677
##    .enthuW3S          0.391    0.037   10.622    0.000    0.391    0.999
##    .assertW3P       -19.073    1.050  -18.166    0.000  -19.073  -59.562
##    .enthuW3P          0.271    0.030    9.101    0.000    0.271    0.997
##    .assertW4S       -11.045    1.492   -7.403    0.000  -11.045  -23.935
##    .enthuW4S          0.417    0.042    9.886    0.000    0.417    0.999
##    .assertW4P       -17.300    2.062   -8.390    0.000  -17.300  -63.127
##    .enthuW4P          0.276    0.036    7.581    0.000    0.276    0.997
##    .extra1           -0.090    1.014   -0.088    0.930   -0.006   -0.006
##    .extra2            1.962    0.712    2.757    0.006    0.124    0.124
##    .extra3            0.500    0.557    0.897    0.370    0.039    0.039
##    .extra4           -0.207    0.843   -0.245    0.806   -0.018   -0.018
##     interc           16.284    1.234   13.194    0.000    1.000    1.000
##     slope             0.012    0.005    2.269    0.023    1.000    1.000
semPaths(lgmExtra, what = "col", whatLabels = "est", intercepts = T)

with random parcels

lgmExtra <- '

# factor at each time point with same loading
extra1 =~ extraW1S1        + a * extraW1S2 + 
           peer * extraW1P1 + aa * extraW1P2

extra2 =~ extraW2S1        + a * extraW2S2 + 
           peer * extraW2P1 + aa * extraW2P2

extra3 =~ extraW3S1        + a * extraW3S2 + 
           peer * extraW3P1 + aa * extraW3P2
  
extra4 =~ extraW4S1        + a * extraW4S2 + 
           peer * extraW4P1 + aa * extraW4P2

# second order factor for intercept and slope
interc =~ 1*extra1 + 1*extra2 + 1*extra3 + 1*extra4
slope =~ 0*extra1 + 6*extra2 + 13*extra3 + 19*extra4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
extraW1S1 ~ 0*1
extraW2S1 ~ 0*1
extraW3S1 ~ 0*1
extraW4S1 ~ 0*1

# fix equal intercepts
extraW1S2 ~ b*1
extraW2S2 ~ b*1
extraW3S2 ~ b*1
extraW4S2 ~ b*1

extraW1P1 ~ c*1
extraW2P1 ~ c*1
extraW3P1 ~ c*1
extraW4P1 ~ c*1

extraW1P2 ~ d*1
extraW2P2 ~ d*1
extraW3P2 ~ d*1
extraW4P2 ~ d*1

# error covariance - similar parcels across waves
extraW1S1 ~~ extraW2S1 + extraW3S1 + extraW4S1
extraW2S1 ~~ extraW3S1 + extraW4S1
extraW3S1 ~~ extraW4S1

extraW1S2 ~~ extraW2S2 + extraW3S2 + extraW4S2
extraW2S2 ~~ extraW3S2 + extraW4S2
extraW3S2 ~~ extraW4S2

extraW1P1 ~~ extraW2P1 + extraW3P1 + extraW4P1
extraW2P1 ~~ extraW3P1 + extraW4P1
extraW3P1 ~~ extraW4P1

extraW1P2 ~~ extraW2P2 + extraW3P2 + extraW4P2
extraW2P2 ~~ extraW3P2 + extraW4P2
extraW3P2 ~~ extraW4P2

# error covariance - same method at one wave
extraW1S1 ~~ extraW1S2
extraW1P1 ~~ extraW1P2
extraW2S1 ~~ extraW2S2
extraW2P1 ~~ extraW2P2
extraW3S1 ~~ extraW3S2
extraW3P1 ~~ extraW3P2
extraW4S1 ~~ extraW4S2
extraW4P1 ~~ extraW4P2
'
lgmExtra <- sem(lgmExtra, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmExtra, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 390 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   extra1 =~                                                             
##     extW1S1           1.000                               1.522    0.942
##     extW1S2    (a)    0.899       NA                      1.369    0.949
##     extW1P1 (peer)    0.944       NA                      1.437    0.953
##     extW1P2   (aa)    0.903       NA                      1.375    0.982
##   extra2 =~                                                             
##     extW2S1           1.000                               1.356    0.982
##     extW2S2    (a)    0.899       NA                      1.219    0.966
##     extW2P1 (peer)    0.944       NA                      1.280    0.922
##     extW2P2   (aa)    0.903       NA                      1.224    0.938
##   extra3 =~                                                             
##     extW3S1           1.000                               1.332    0.970
##     extW3S2    (a)    0.899       NA                      1.198    0.945
##     extW3P1 (peer)    0.944       NA                      1.258    0.953
##     extW3P2   (aa)    0.903       NA                      1.203    0.942
##   extra4 =~                                                             
##     extW4S1           1.000                               1.363    0.962
##     extW4S2    (a)    0.899       NA                      1.225    0.966
##     extW4P1 (peer)    0.944       NA                      1.287    0.961
##     extW4P2   (aa)    0.903       NA                      1.230    0.943
##   interc =~                                                             
##     extra1            1.000                               0.845    0.845
##     extra2            1.000                               0.949    0.949
##     extra3            1.000                               0.966    0.966
##     extra4            1.000                               0.944    0.944
##   slope =~                                                              
##     extra1            0.000                                  NA       NA
##     extra2            6.000                                  NA       NA
##     extra3           13.000                                  NA       NA
##     extra4           19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.010       NA                      0.304    0.304
##  .extraW1S1 ~~                                                          
##    .extraW2S1         0.018       NA                      0.018    0.132
##    .extraW3S1         0.025       NA                      0.025    0.140
##    .extraW4S1         0.033       NA                      0.033    0.156
##  .extraW2S1 ~~                                                          
##    .extraW3S1         0.029       NA                      0.029    0.343
##    .extraW4S1         0.018       NA                      0.018    0.180
##  .extraW3S1 ~~                                                          
##    .extraW4S1         0.040       NA                      0.040    0.308
##  .extraW1S2 ~~                                                          
##    .extraW2S2         0.030       NA                      0.030    0.198
##    .extraW3S2         0.012       NA                      0.012    0.061
##    .extraW4S2         0.018       NA                      0.018    0.122
##  .extraW2S2 ~~                                                          
##    .extraW3S2        -0.017       NA                     -0.017   -0.124
##    .extraW4S2         0.020       NA                      0.020    0.187
##  .extraW3S2 ~~                                                          
##    .extraW4S2         0.011       NA                      0.011    0.080
##  .extraW1P1 ~~                                                          
##    .extraW2P1         0.074       NA                      0.074    0.305
##    .extraW3P1         0.067       NA                      0.067    0.370
##    .extraW4P1         0.075       NA                      0.075    0.441
##  .extraW2P1 ~~                                                          
##    .extraW3P1         0.158       NA                      0.158    0.739
##    .extraW4P1         0.123       NA                      0.123    0.616
##  .extraW3P1 ~~                                                          
##    .extraW4P1         0.080       NA                      0.080    0.540
##  .extraW1P2 ~~                                                          
##    .extraW2P2         0.161       NA                      0.161    1.365
##    .extraW3P2         0.145       NA                      0.145    1.294
##    .extraW4P2         0.144       NA                      0.144    1.270
##  .extraW2P2 ~~                                                          
##    .extraW3P2         0.194       NA                      0.194    1.005
##    .extraW4P2         0.197       NA                      0.197    1.007
##  .extraW3P2 ~~                                                          
##    .extraW4P2         0.187       NA                      0.187    1.005
##  .extraW1S1 ~~                                                          
##    .extraW1S2         0.187       NA                      0.187    0.757
##  .extraW1P1 ~~                                                          
##    .extraW1P2         0.001       NA                      0.001    0.005
##  .extraW2S1 ~~                                                          
##    .extraW2S2         0.026       NA                      0.026    0.314
##  .extraW2P1 ~~                                                          
##    .extraW2P2         0.000       NA                      0.000    0.000
##  .extraW3S1 ~~                                                          
##    .extraW3S2         0.092       NA                      0.092    0.662
##  .extraW3P1 ~~                                                          
##    .extraW3P2        -0.000       NA                     -0.000   -0.000
##  .extraW4S1 ~~                                                          
##    .extraW4S2         0.058       NA                      0.058    0.454
##  .extraW4P1 ~~                                                          
##    .extraW4P2        -0.000       NA                     -0.000   -0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.599       NA                      2.796    2.796
##     slope            -0.000       NA                         NA       NA
##    .extraW1S1         0.000                               0.000    0.000
##    .extraW2S1         0.000                               0.000    0.000
##    .extraW3S1         0.000                               0.000    0.000
##    .extraW4S1         0.000                               0.000    0.000
##    .extraW1S2  (b)    0.356       NA                      0.356    0.247
##    .extraW2S2  (b)    0.356       NA                      0.356    0.282
##    .extraW3S2  (b)    0.356       NA                      0.356    0.281
##    .extraW4S2  (b)    0.356       NA                      0.356    0.281
##    .extraW1P1  (c)    0.264       NA                      0.264    0.175
##    .extraW2P1  (c)    0.264       NA                      0.264    0.190
##    .extraW3P1  (c)    0.264       NA                      0.264    0.200
##    .extraW4P1  (c)    0.264       NA                      0.264    0.197
##    .extraW1P2  (d)    0.569       NA                      0.569    0.406
##    .extraW2P2  (d)    0.569       NA                      0.569    0.436
##    .extraW3P2  (d)    0.569       NA                      0.569    0.445
##    .extraW4P2  (d)    0.569       NA                      0.569    0.436
##    .extra1            0.000                               0.000    0.000
##    .extra2            0.000                               0.000    0.000
##    .extra3            0.000                               0.000    0.000
##    .extra4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .extraW1S1         0.294       NA                      0.294    0.113
##    .extraW1S2         0.209       NA                      0.209    0.100
##    .extraW1P1         0.207       NA                      0.207    0.091
##    .extraW1P2         0.068       NA                      0.068    0.035
##    .extraW2S1         0.066       NA                      0.066    0.035
##    .extraW2S2         0.106       NA                      0.106    0.067
##    .extraW2P1         0.288       NA                      0.288    0.149
##    .extraW2P2         0.203       NA                      0.203    0.119
##    .extraW3S1         0.110       NA                      0.110    0.059
##    .extraW3S2         0.173       NA                      0.173    0.108
##    .extraW3P1         0.158       NA                      0.158    0.091
##    .extraW3P2         0.183       NA                      0.183    0.112
##    .extraW4S1         0.151       NA                      0.151    0.075
##    .extraW4S2         0.108       NA                      0.108    0.067
##    .extraW4P1         0.138       NA                      0.138    0.077
##    .extraW4P2         0.189       NA                      0.189    0.111
##    .extra1            0.662       NA                      0.285    0.285
##    .extra2            0.084       NA                      0.046    0.046
##    .extra3           -0.031       NA                     -0.018   -0.018
##    .extra4            0.061       NA                      0.033    0.033
##     interc            1.656       NA                      1.000    1.000
##     slope            -0.001       NA                         NA       NA
semPaths(lgmExtra, what = "col", whatLabels = "est", intercepts = T)

LGM Neuroticism

with aspects as parcels

lgmNeuro <- '

# factor at each time point with same loading
neuro1 =~ volatW1S        + a * withdW1S + 
          peer * volatW1P + aa * withdW1P

neuro2 =~ volatW2S        + a * withdW2S + 
          peer * volatW2P + aa * withdW2P

neuro3 =~ volatW3S        + a * withdW3S + 
          peer * volatW3P + aa * withdW3P
  
neuro4 =~ volatW4S        + a * withdW4S + 
          peer * volatW4P + aa * withdW4P

# second order factor for intercept and slope
interc =~ 1*neuro1 + 1*neuro2 + 1*neuro3 + 1*neuro4
slope =~ 0*neuro1 + 6*neuro2 + 13*neuro3 + 19*neuro4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
volatW1S ~ 0*1
volatW2S ~ 0*1
volatW3S ~ 0*1
volatW4S ~ 0*1

# fix equal intercepts
withdW1S ~ b*1
withdW2S ~ b*1
withdW3S ~ b*1
withdW4S ~ b*1

volatW1P ~ c*1
volatW2P ~ c*1
volatW3P ~ c*1
volatW4P ~ c*1

withdW1P ~ d*1
withdW2P ~ d*1
withdW3P ~ d*1
withdW4P ~ d*1

# error covariance - similar aspects across waves and informants
volatW1S ~~ volatW2S + volatW3S + volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW2S ~~ volatW3S + volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW3S ~~ volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW4S ~~ volatW1P + volatW2P + volatW3P + volatW4P

withdW1S ~~ withdW2S + withdW3S + withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW2S ~~ withdW3S + withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW3S ~~ withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW4S ~~ withdW1P + withdW2P + withdW3P + withdW4P

volatW1P ~~ volatW2P + volatW3P + volatW4P
volatW2P ~~ volatW3P + volatW4P
volatW3P ~~ volatW4P

withdW1P ~~ withdW2P + withdW3P + withdW4P
withdW2P ~~ withdW3P + withdW4P
withdW3P ~~ withdW4P
'
lgmNeuro <- sem(lgmNeuro, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_object_post_check(object): lavaan WARNING: the covariance matrix of the residuals of the observed
##                 variables (theta) is not positive definite;
##                 use lavInspect(fit, "theta") to investigate.
summary(lgmNeuro, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 243 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        105
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               218.197
##   Degrees of freedom                                65
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2496.820
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.936
##   Tucker-Lewis Index (TLI)                       0.881
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1658.077
##   Loglikelihood unrestricted model (H1)      -1548.979
##                                                       
##   Akaike (AIC)                                3490.155
##   Bayesian (BIC)                              3799.599
##   Sample-size adjusted Bayesian (BIC)         3523.777
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.095
##   90 Percent confidence interval - lower         0.082
##   90 Percent confidence interval - upper         0.110
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.249
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro1 =~                                                             
##     voltW1S           1.000                               0.364    0.475
##     wthdW1S    (a)    1.226    0.972    1.261    0.207    0.446    0.636
##     voltW1P (peer)   -0.767    0.182   -4.222    0.000   -0.279   -0.370
##     wthdW1P   (aa)   -0.825    0.673   -1.226    0.220   -0.300   -0.457
##   neuro2 =~                                                             
##     voltW2S           1.000                               0.341    0.429
##     wthdW2S    (a)    1.226    0.972    1.261    0.207    0.418    0.607
##     voltW2P (peer)   -0.767    0.182   -4.222    0.000   -0.262   -0.343
##     wthdW2P   (aa)   -0.825    0.673   -1.226    0.220   -0.282   -0.422
##   neuro3 =~                                                             
##     voltW3S           1.000                               0.345    0.461
##     wthdW3S    (a)    1.226    0.972    1.261    0.207    0.423    0.640
##     voltW3P (peer)   -0.767    0.182   -4.222    0.000   -0.265   -0.364
##     wthdW3P   (aa)   -0.825    0.673   -1.226    0.220   -0.285   -0.451
##   neuro4 =~                                                             
##     voltW4S           1.000                               0.383    0.485
##     wthdW4S    (a)    1.226    0.972    1.261    0.207    0.469    0.694
##     voltW4P (peer)   -0.767    0.182   -4.222    0.000   -0.293   -0.381
##     wthdW4P   (aa)   -0.825    0.673   -1.226    0.220   -0.316   -0.494
##   interc =~                                                             
##     neuro1            1.000                               0.867    0.867
##     neuro2            1.000                               0.924    0.924
##     neuro3            1.000                               0.914    0.914
##     neuro4            1.000                               0.824    0.824
##   slope =~                                                              
##     neuro1            0.000                               0.000    0.000
##     neuro2            6.000                               0.173    0.173
##     neuro3           13.000                               0.371    0.371
##     neuro4           19.000                               0.489    0.489
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.000    0.001   -0.495    0.621   -0.135   -0.135
##  .volatW1S ~~                                                           
##    .volatW2S          0.404    0.090    4.510    0.000    0.404    0.836
##    .volatW3S          0.349    0.085    4.101    0.000    0.349    0.781
##    .volatW4S          0.349    0.085    4.092    0.000    0.349    0.750
##    .volatW1P          0.279    0.090    3.090    0.002    0.279    0.590
##    .volatW2P          0.277    0.071    3.876    0.000    0.277    0.574
##    .volatW3P          0.253    0.069    3.647    0.000    0.253    0.555
##    .volatW4P          0.281    0.070    4.026    0.000    0.281    0.586
##  .volatW2S ~~                                                           
##    .volatW3S          0.424    0.092    4.626    0.000    0.424    0.891
##    .volatW4S          0.400    0.094    4.266    0.000    0.400    0.808
##  .volatW1P ~~                                                           
##    .volatW2S          0.275    0.074    3.703    0.000    0.275    0.546
##  .volatW2S ~~                                                           
##    .volatW2P          0.337    0.085    3.992    0.000    0.337    0.656
##    .volatW3P          0.286    0.074    3.863    0.000    0.286    0.590
##    .volatW4P          0.290    0.077    3.768    0.000    0.290    0.569
##  .volatW3S ~~                                                           
##    .volatW4S          0.371    0.099    3.740    0.000    0.371    0.810
##  .volatW1P ~~                                                           
##    .volatW3S          0.256    0.070    3.664    0.000    0.256    0.551
##  .volatW2P ~~                                                           
##    .volatW3S          0.290    0.074    3.922    0.000    0.290    0.611
##  .volatW3S ~~                                                           
##    .volatW3P          0.251    0.083    3.036    0.002    0.251    0.560
##    .volatW4P          0.247    0.081    3.046    0.002    0.247    0.522
##  .volatW1P ~~                                                           
##    .volatW4S          0.248    0.071    3.482    0.000    0.248    0.512
##  .volatW2P ~~                                                           
##    .volatW4S          0.255    0.076    3.358    0.001    0.255    0.515
##  .volatW3P ~~                                                           
##    .volatW4S          0.225    0.079    2.863    0.004    0.225    0.482
##  .volatW4S ~~                                                           
##    .volatW4P          0.223    0.102    2.187    0.029    0.223    0.453
##  .withdW1S ~~                                                           
##    .withdW2S          0.225    0.125    1.802    0.072    0.225    0.760
##    .withdW3S          0.208    0.120    1.729    0.084    0.208    0.758
##    .withdW4S          0.212    0.118    1.792    0.073    0.212    0.807
##    .withdW1P          0.263    0.112    2.360    0.018    0.263    0.834
##    .withdW2P          0.264    0.085    3.109    0.002    0.264    0.809
##    .withdW3P          0.236    0.082    2.874    0.004    0.236    0.775
##    .withdW4P          0.232    0.082    2.831    0.005    0.232    0.773
##  .withdW2S ~~                                                           
##    .withdW3S          0.212    0.127    1.673    0.094    0.212    0.762
##    .withdW4S          0.198    0.128    1.542    0.123    0.198    0.744
##  .withdW1P ~~                                                           
##    .withdW2S          0.220    0.086    2.567    0.010    0.220    0.690
##  .withdW2S ~~                                                           
##    .withdW2P          0.275    0.100    2.739    0.006    0.275    0.832
##    .withdW3P          0.219    0.086    2.541    0.011    0.219    0.712
##    .withdW4P          0.236    0.088    2.683    0.007    0.236    0.776
##  .withdW3S ~~                                                           
##    .withdW4S          0.192    0.139    1.376    0.169    0.192    0.775
##  .withdW1P ~~                                                           
##    .withdW3S          0.199    0.082    2.421    0.015    0.199    0.671
##  .withdW2P ~~                                                           
##    .withdW3S          0.237    0.086    2.756    0.006    0.237    0.773
##  .withdW3S ~~                                                           
##    .withdW3P          0.247    0.101    2.457    0.014    0.247    0.864
##    .withdW4P          0.226    0.095    2.387    0.017    0.226    0.801
##  .withdW1P ~~                                                           
##    .withdW4S          0.194    0.081    2.406    0.016    0.194    0.683
##  .withdW2P ~~                                                           
##    .withdW4S          0.242    0.087    2.788    0.005    0.242    0.824
##  .withdW3P ~~                                                           
##    .withdW4S          0.230    0.094    2.444    0.015    0.230    0.840
##  .withdW4S ~~                                                           
##    .withdW4P          0.274    0.123    2.219    0.026    0.274    1.011
##  .volatW1P ~~                                                           
##    .volatW2P          0.386    0.071    5.425    0.000    0.386    0.769
##    .volatW3P          0.344    0.069    5.017    0.000    0.344    0.726
##    .volatW4P          0.327    0.071    4.620    0.000    0.327    0.656
##  .volatW2P ~~                                                           
##    .volatW3P          0.400    0.074    5.436    0.000    0.400    0.827
##    .volatW4P          0.423    0.079    5.323    0.000    0.423    0.830
##  .volatW3P ~~                                                           
##    .volatW4P          0.376    0.080    4.672    0.000    0.376    0.781
##  .withdW1P ~~                                                           
##    .withdW2P          0.280    0.068    4.113    0.000    0.280    0.793
##    .withdW3P          0.274    0.067    4.110    0.000    0.274    0.832
##    .withdW4P          0.225    0.065    3.456    0.001    0.225    0.693
##  .withdW2P ~~                                                           
##    .withdW3P          0.280    0.070    4.031    0.000    0.280    0.824
##    .withdW4P          0.276    0.071    3.906    0.000    0.276    0.823
##  .withdW3P ~~                                                           
##    .withdW4P          0.264    0.076    3.479    0.001    0.264    0.842
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            2.784    0.047   59.529    0.000    8.831    8.831
##     slope            -0.002    0.002   -1.147    0.251   -0.228   -0.228
##    .volatW1S          0.000                               0.000    0.000
##    .volatW2S          0.000                               0.000    0.000
##    .volatW3S          0.000                               0.000    0.000
##    .volatW4S          0.000                               0.000    0.000
##    .withdW1S   (b)   -0.397    2.690   -0.147    0.883   -0.397   -0.566
##    .withdW2S   (b)   -0.397    2.690   -0.147    0.883   -0.397   -0.576
##    .withdW3S   (b)   -0.397    2.690   -0.147    0.883   -0.397   -0.600
##    .withdW4S   (b)   -0.397    2.690   -0.147    0.883   -0.397   -0.587
##    .volatW1P   (c)    4.725    0.506    9.342    0.000    4.725    6.262
##    .volatW2P   (c)    4.725    0.506    9.342    0.000    4.725    6.198
##    .volatW3P   (c)    4.725    0.506    9.342    0.000    4.725    6.506
##    .volatW4P   (c)    4.725    0.506    9.342    0.000    4.725    6.140
##    .withdW1P   (d)    4.864    1.864    2.610    0.009    4.864    7.405
##    .withdW2P   (d)    4.864    1.864    2.610    0.009    4.864    7.298
##    .withdW3P   (d)    4.864    1.864    2.610    0.009    4.864    7.709
##    .withdW4P   (d)    4.864    1.864    2.610    0.009    4.864    7.609
##    .neuro1            0.000                               0.000    0.000
##    .neuro2            0.000                               0.000    0.000
##    .neuro3            0.000                               0.000    0.000
##    .neuro4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S          0.453    0.115    3.951    0.000    0.453    0.774
##    .withdW1S          0.292    0.166    1.759    0.079    0.292    0.595
##    .volatW1P          0.492    0.088    5.583    0.000    0.492    0.863
##    .withdW1P          0.342    0.087    3.920    0.000    0.342    0.791
##    .volatW2S          0.515    0.107    4.799    0.000    0.515    0.816
##    .withdW2S          0.299    0.149    2.012    0.044    0.299    0.631
##    .volatW2P          0.513    0.085    6.006    0.000    0.513    0.882
##    .withdW2P          0.365    0.080    4.534    0.000    0.365    0.822
##    .volatW3S          0.440    0.106    4.159    0.000    0.440    0.787
##    .withdW3S          0.258    0.150    1.719    0.086    0.258    0.591
##    .volatW3P          0.457    0.083    5.491    0.000    0.457    0.867
##    .withdW3P          0.317    0.082    3.890    0.000    0.317    0.796
##    .volatW4S          0.477    0.128    3.722    0.000    0.477    0.765
##    .withdW4S          0.237    0.185    1.279    0.201    0.237    0.519
##    .volatW4P          0.506    0.105    4.836    0.000    0.506    0.855
##    .withdW4P          0.309    0.097    3.181    0.001    0.309    0.756
##    .neuro1            0.033    0.028    1.169    0.242    0.248    0.248
##    .neuro2            0.018    0.016    1.167    0.243    0.159    0.159
##    .neuro3            0.014    0.013    1.115    0.265    0.118    0.118
##    .neuro4            0.028    0.025    1.135    0.257    0.190    0.190
##     interc            0.099    0.081    1.229    0.219    1.000    1.000
##     slope             0.000    0.000    1.041    0.298    1.000    1.000
semPaths(lgmNeuro, what = "col", whatLabels = "est", intercepts = T)

with random parcels

lgmNeuro <- '

# factor at each time point with same loading
neuro1 =~ neuroW1S1        + a * neuroW1S2 + 
           peer * neuroW1P1 + aa * neuroW1P2

neuro2 =~ neuroW2S1        + a * neuroW2S2 + 
           peer * neuroW2P1 + aa * neuroW2P2

neuro3 =~ neuroW3S1        + a * neuroW3S2 + 
           peer * neuroW3P1 + aa * neuroW3P2
  
neuro4 =~ neuroW4S1        + a * neuroW4S2 + 
           peer * neuroW4P1 + aa * neuroW4P2

# second order factor for intercept and slope
interc =~ 1*neuro1 + 1*neuro2 + 1*neuro3 + 1*neuro4
slope =~ 0*neuro1 + 6*neuro2 + 13*neuro3 + 19*neuro4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
neuroW1S1 ~ 0*1
neuroW2S1 ~ 0*1
neuroW3S1 ~ 0*1
neuroW4S1 ~ 0*1

# fix equal intercepts
neuroW1S2 ~ b*1
neuroW2S2 ~ b*1
neuroW3S2 ~ b*1
neuroW4S2 ~ b*1

neuroW1P1 ~ c*1
neuroW2P1 ~ c*1
neuroW3P1 ~ c*1
neuroW4P1 ~ c*1

neuroW1P2 ~ d*1
neuroW2P2 ~ d*1
neuroW3P2 ~ d*1
neuroW4P2 ~ d*1

# error covariance - similar parcels across waves
neuroW1S1 ~~ neuroW2S1 + neuroW3S1 + neuroW4S1
neuroW2S1 ~~ neuroW3S1 + neuroW4S1
neuroW3S1 ~~ neuroW4S1

neuroW1S2 ~~ neuroW2S2 + neuroW3S2 + neuroW4S2
neuroW2S2 ~~ neuroW3S2 + neuroW4S2
neuroW3S2 ~~ neuroW4S2

neuroW1P1 ~~ neuroW2P1 + neuroW3P1 + neuroW4P1
neuroW2P1 ~~ neuroW3P1 + neuroW4P1
neuroW3P1 ~~ neuroW4P1

neuroW1P2 ~~ neuroW2P2 + neuroW3P2 + neuroW4P2
neuroW2P2 ~~ neuroW3P2 + neuroW4P2
neuroW3P2 ~~ neuroW4P2

# error covariance - same method at one wave
neuroW1S1 ~~ neuroW1S2
neuroW1P1 ~~ neuroW1P2
neuroW2S1 ~~ neuroW2S2
neuroW2P1 ~~ neuroW2P2
neuroW3S1 ~~ neuroW3S2
neuroW3P1 ~~ neuroW3P2
neuroW4S1 ~~ neuroW4S2
neuroW4P1 ~~ neuroW4P2
'
lgmNeuro <- sem(lgmNeuro, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmNeuro, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 318 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro1 =~                                                             
##     nerW1S1           1.000                               0.774    0.844
##     nerW1S2    (a)    0.900       NA                      0.696    0.800
##     nerW1P1 (peer)    0.807       NA                      0.624    0.813
##     nerW1P2   (aa)    0.736       NA                      0.570    0.851
##   neuro2 =~                                                             
##     nerW2S1           1.000                               0.763    0.886
##     nerW2S2    (a)    0.900       NA                      0.686    0.902
##     nerW2P1 (peer)    0.807       NA                      0.616    0.750
##     nerW2P2   (aa)    0.736       NA                      0.562    0.809
##   neuro3 =~                                                             
##     nerW3S1           1.000                               0.761    0.879
##     nerW3S2    (a)    0.900       NA                      0.685    0.874
##     nerW3P1 (peer)    0.807       NA                      0.614    0.690
##     nerW3P2   (aa)    0.736       NA                      0.560    0.812
##   neuro4 =~                                                             
##     nerW4S1           1.000                               0.767    0.859
##     nerW4S2    (a)    0.900       NA                      0.690    0.812
##     nerW4P1 (peer)    0.807       NA                      0.619    0.763
##     nerW4P2   (aa)    0.736       NA                      0.565    0.831
##   interc =~                                                             
##     neuro1            1.000                               0.976    0.976
##     neuro2            1.000                               0.990    0.990
##     neuro3            1.000                               0.992    0.992
##     neuro4            1.000                               0.985    0.985
##   slope =~                                                              
##     neuro1            0.000                                  NA       NA
##     neuro2            6.000                                  NA       NA
##     neuro3           13.000                                  NA       NA
##     neuro4           19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.001       NA                      0.136    0.136
##  .neuroW1S1 ~~                                                          
##    .neuroW2S1        -0.003       NA                     -0.003   -0.016
##    .neuroW3S1         0.078       NA                      0.078    0.383
##    .neuroW4S1         0.044       NA                      0.044    0.194
##  .neuroW2S1 ~~                                                          
##    .neuroW3S1         0.050       NA                      0.050    0.301
##    .neuroW4S1        -0.024       NA                     -0.024   -0.132
##  .neuroW3S1 ~~                                                          
##    .neuroW4S1         0.042       NA                      0.042    0.223
##  .neuroW1S2 ~~                                                          
##    .neuroW2S2         0.055       NA                      0.055    0.319
##    .neuroW3S2         0.022       NA                      0.022    0.111
##    .neuroW4S2         0.045       NA                      0.045    0.175
##  .neuroW2S2 ~~                                                          
##    .neuroW3S2         0.010       NA                      0.010    0.082
##    .neuroW4S2         0.048       NA                      0.048    0.295
##  .neuroW3S2 ~~                                                          
##    .neuroW4S2        -0.001       NA                     -0.001   -0.006
##  .neuroW1P1 ~~                                                          
##    .neuroW2P1         0.117       NA                      0.117    0.482
##    .neuroW3P1         0.069       NA                      0.069    0.240
##    .neuroW4P1         0.046       NA                      0.046    0.197
##  .neuroW2P1 ~~                                                          
##    .neuroW3P1         0.134       NA                      0.134    0.384
##    .neuroW4P1         0.169       NA                      0.169    0.596
##  .neuroW3P1 ~~                                                          
##    .neuroW4P1         0.290       NA                      0.290    0.861
##  .neuroW1P2 ~~                                                          
##    .neuroW2P2         0.149       NA                      0.149    1.035
##    .neuroW3P2         0.144       NA                      0.144    1.021
##    .neuroW4P2         0.137       NA                      0.137    1.031
##  .neuroW2P2 ~~                                                          
##    .neuroW3P2         0.165       NA                      0.165    1.002
##    .neuroW4P2         0.155       NA                      0.155    1.004
##  .neuroW3P2 ~~                                                          
##    .neuroW4P2         0.153       NA                      0.153    1.006
##  .neuroW1S1 ~~                                                          
##    .neuroW1S2         0.166       NA                      0.166    0.644
##  .neuroW1P1 ~~                                                          
##    .neuroW1P2         0.000       NA                      0.000    0.003
##  .neuroW2S1 ~~                                                          
##    .neuroW2S2         0.058       NA                      0.058    0.446
##  .neuroW2P1 ~~                                                          
##    .neuroW2P2         0.000       NA                      0.000    0.000
##  .neuroW3S1 ~~                                                          
##    .neuroW3S2         0.071       NA                      0.071    0.450
##  .neuroW3P1 ~~                                                          
##    .neuroW3P2        -0.000       NA                     -0.000   -0.000
##  .neuroW4S1 ~~                                                          
##    .neuroW4S2         0.116       NA                      0.116    0.512
##  .neuroW4P1 ~~                                                          
##    .neuroW4P2        -0.000       NA                     -0.000   -0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            2.997       NA                      3.970    3.970
##     slope             0.000       NA                         NA       NA
##    .neuroW1S1         0.000                               0.000    0.000
##    .neuroW2S1         0.000                               0.000    0.000
##    .neuroW3S1         0.000                               0.000    0.000
##    .neuroW4S1         0.000                               0.000    0.000
##    .neuroW1S2  (b)    0.271       NA                      0.271    0.311
##    .neuroW2S2  (b)    0.271       NA                      0.271    0.356
##    .neuroW3S2  (b)    0.271       NA                      0.271    0.346
##    .neuroW4S2  (b)    0.271       NA                      0.271    0.319
##    .neuroW1P1  (c)    0.143       NA                      0.143    0.187
##    .neuroW2P1  (c)    0.143       NA                      0.143    0.175
##    .neuroW3P1  (c)    0.143       NA                      0.143    0.161
##    .neuroW4P1  (c)    0.143       NA                      0.143    0.177
##    .neuroW1P2  (d)    0.467       NA                      0.467    0.697
##    .neuroW2P2  (d)    0.467       NA                      0.467    0.672
##    .neuroW3P2  (d)    0.467       NA                      0.467    0.676
##    .neuroW4P2  (d)    0.467       NA                      0.467    0.687
##    .neuro1            0.000                               0.000    0.000
##    .neuro2            0.000                               0.000    0.000
##    .neuro3            0.000                               0.000    0.000
##    .neuro4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .neuroW1S1         0.242       NA                      0.242    0.288
##    .neuroW1S2         0.273       NA                      0.273    0.360
##    .neuroW1P1         0.200       NA                      0.200    0.339
##    .neuroW1P2         0.124       NA                      0.124    0.276
##    .neuroW2S1         0.160       NA                      0.160    0.215
##    .neuroW2S2         0.107       NA                      0.107    0.186
##    .neuroW2P1         0.295       NA                      0.295    0.437
##    .neuroW2P2         0.167       NA                      0.167    0.346
##    .neuroW3S1         0.171       NA                      0.171    0.228
##    .neuroW3S2         0.146       NA                      0.146    0.237
##    .neuroW3P1         0.414       NA                      0.414    0.523
##    .neuroW3P2         0.162       NA                      0.162    0.340
##    .neuroW4S1         0.209       NA                      0.209    0.262
##    .neuroW4S2         0.246       NA                      0.246    0.341
##    .neuroW4P1         0.274       NA                      0.274    0.417
##    .neuroW4P2         0.143       NA                      0.143    0.310
##    .neuro1            0.028       NA                      0.047    0.047
##    .neuro2            0.005       NA                      0.009    0.009
##    .neuro3           -0.001       NA                     -0.002   -0.002
##    .neuro4            0.008       NA                      0.013    0.013
##     interc            0.570       NA                      1.000    1.000
##     slope            -0.000       NA                         NA       NA
semPaths(lgmNeuro, what = "col", whatLabels = "est", intercepts = T)

LGM Openness domain

with aspects as parcels

lgmOpend <- '

# factor at each time point with same loading
opend1 =~ intelW1S        + a * openaW1S + 
          peer * intelW1P + aa * openaW1P

opend2 =~ intelW2S        + a * openaW2S + 
          peer * intelW2P + aa * openaW2P

opend3 =~ intelW3S        + a * openaW3S + 
          peer * intelW3P + aa * openaW3P
  
opend4 =~ intelW4S        + a * openaW4S + 
          peer * intelW4P + aa * openaW4P

# second order factor for intercept and slope
interc =~ 1*opend1 + 1*opend2 + 1*opend3 + 1*opend4
slope =~ 0*opend1 + 6*opend2 + 13*opend3 + 19*opend4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
intelW1S ~ 0*1
intelW2S ~ 0*1
intelW3S ~ 0*1
intelW4S ~ 0*1

# fix equal intercepts
openaW1S ~ b*1
openaW2S ~ b*1
openaW3S ~ b*1
openaW4S ~ b*1

intelW1P ~ c*1
intelW2P ~ c*1
intelW3P ~ c*1
intelW4P ~ c*1

openaW1P ~ d*1
openaW2P ~ d*1
openaW3P ~ d*1
openaW4P ~ d*1

# error covariance - similar aspects across waves and informants
intelW1S ~~ intelW2S + intelW3S + intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW2S ~~ intelW3S + intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW3S ~~ intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW4S ~~ intelW1P + intelW2P + intelW3P + intelW4P

openaW1S ~~ openaW2S + openaW3S + openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW2S ~~ openaW3S + openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW3S ~~ openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW4S ~~ openaW1P + openaW2P + openaW3P + openaW4P

intelW1P ~~ intelW2P + intelW3P + intelW4P
intelW2P ~~ intelW3P + intelW4P
intelW3P ~~ intelW4P

openaW1P ~~ openaW2P + openaW3P + openaW4P
openaW2P ~~ openaW3P + openaW4P
openaW3P ~~ openaW4P
'
lgmOpend <- sem(lgmOpend, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative
summary(lgmOpend, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 1125 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        105
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               137.418
##   Degrees of freedom                                65
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2293.599
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.967
##   Tucker-Lewis Index (TLI)                       0.938
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1055.056
##   Loglikelihood unrestricted model (H1)       -986.347
##                                                       
##   Akaike (AIC)                                2284.111
##   Bayesian (BIC)                              2593.555
##   Sample-size adjusted Bayesian (BIC)         2317.734
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.066
##   90 Percent confidence interval - lower         0.050
##   90 Percent confidence interval - upper         0.081
##   P-value RMSEA <= 0.05                          0.047
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.089
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value    P(>|z|)   Std.lv  Std.all
##   opend1 =~                                                               
##     intlW1S           1.000                                 7.927   14.493
##     openW1S    (a)    0.001    0.000      4.375    0.000    0.005    0.009
##     intlW1P (peer)    1.979    0.000   6819.914    0.000   15.686   28.182
##     openW1P   (aa)    0.001    0.000      5.896    0.000    0.008    0.016
##   opend2 =~                                                               
##     intlW2S           1.000                                 7.860   14.587
##     openW2S    (a)    0.001    0.000      4.631    0.000    0.005    0.008
##     intlW2P (peer)    1.979    0.000   6089.929    0.000   15.552   30.974
##     openW2P   (aa)    0.001    0.000      6.981    0.000    0.008    0.015
##   opend3 =~                                                               
##     intlW3S           1.000                                 7.582   13.888
##     openW3S    (a)    0.001    0.000      4.084    0.000    0.005    0.008
##     intlW3P (peer)    1.979    0.000   7322.770    0.000   15.001   26.138
##     openW3P   (aa)    0.001    0.000      5.966    0.000    0.008    0.014
##   opend4 =~                                                               
##     intlW4S           1.000                                 8.245   15.806
##     openW4S    (a)    0.001    0.000      4.133    0.000    0.006    0.009
##     intlW4P (peer)    1.979    0.000   7802.412    0.000   16.314   28.893
##     openW4P   (aa)    0.001    0.000      6.245    0.000    0.008    0.015
##   interc =~                                                               
##     opend1            1.000                                 0.862    0.862
##     opend2            1.000                                 0.869    0.869
##     opend3            1.000                                 0.901    0.901
##     opend4            1.000                                 0.829    0.829
##   slope =~                                                                
##     opend1            0.000                                 0.000    0.000
##     opend2            6.000                                 0.042    0.042
##     opend3           13.000                                 0.095    0.095
##     opend4           19.000                                 0.128    0.128
## 
## Covariances:
##                    Estimate  Std.Err  z-value    P(>|z|)   Std.lv  Std.all
##   interc ~~                                                               
##     slope             0.339       NA                        0.897    0.897
##  .intelW1S ~~                                                             
##    .intelW2S        -48.505    0.018  -2731.739    0.000  -48.505   -0.782
##    .intelW3S        -50.880    0.018  -2905.535    0.000  -50.880   -0.851
##    .intelW4S        -52.931    0.017  -3066.015    0.000  -52.931   -0.813
##    .intelW1P       -124.251    0.014  -8658.906    0.000 -124.251   -1.002
##    .intelW2P        -96.368    0.017  -5596.464    0.000  -96.368   -0.784
##    .intelW3P       -101.045    0.016  -6138.351    0.000 -101.045   -0.852
##    .intelW4P       -105.114    0.020  -5224.111    0.000 -105.114   -0.815
##  .intelW2S ~~                                                             
##    .intelW3S        -53.145    0.018  -2882.772    0.000  -53.145   -0.896
##    .intelW4S        -55.307    0.018  -3041.130    0.000  -55.307   -0.857
##  .intelW1P ~~                                                             
##    .intelW2S        -96.344    0.012  -8262.344    0.000  -96.344   -0.784
##  .intelW2S ~~                                                             
##    .intelW2P       -122.180    0.022  -5502.392    0.000 -122.180   -1.002
##    .intelW3P       -105.552    0.019  -5455.181    0.000 -105.552   -0.898
##    .intelW4P       -109.836    0.018  -6069.986    0.000 -109.836   -0.859
##  .intelW3S ~~                                                             
##    .intelW4S        -58.076    0.018  -3216.416    0.000  -58.076   -0.933
##  .intelW1P ~~                                                             
##    .intelW3S       -101.014    0.016  -6513.441    0.000 -101.014   -0.852
##  .intelW2P ~~                                                             
##    .intelW3S       -105.554    0.015  -6941.398    0.000 -105.554   -0.898
##  .intelW3S ~~                                                             
##    .intelW3P       -113.654    0.023  -4887.992    0.000 -113.654   -1.003
##    .intelW4P       -115.336    0.015  -7485.934    0.000 -115.336   -0.935
##  .intelW1P ~~                                                             
##    .intelW4S       -105.068    0.016  -6767.585    0.000 -105.068   -0.815
##  .intelW2P ~~                                                             
##    .intelW4S       -109.815    0.012  -9036.228    0.000 -109.815   -0.859
##  .intelW3P ~~                                                             
##    .intelW4S       -115.312    0.023  -5033.405    0.000 -115.312   -0.935
##  .intelW4S ~~                                                             
##    .intelW4P       -134.479    0.021  -6491.536    0.000 -134.479   -1.002
##  .openaW1S ~~                                                             
##    .openaW2S          0.330    0.033     10.130    0.000    0.330    0.818
##    .openaW3S          0.325    0.032     10.224    0.000    0.325    0.840
##    .openaW4S          0.319    0.033      9.727    0.000    0.319    0.809
##    .openaW1P          0.163    0.025      6.612    0.000    0.163    0.505
##    .openaW2P          0.182    0.025      7.280    0.000    0.182    0.535
##    .openaW3P          0.196    0.028      7.109    0.000    0.196    0.557
##    .openaW4P          0.178    0.028      6.343    0.000    0.178    0.512
##  .openaW2S ~~                                                             
##    .openaW3S          0.348    0.034     10.182    0.000    0.348    0.871
##    .openaW4S          0.343    0.035      9.717    0.000    0.343    0.841
##  .openaW1P ~~                                                             
##    .openaW2S          0.158    0.026      6.087    0.000    0.158    0.474
##  .openaW2S ~~                                                             
##    .openaW2P          0.177    0.027      6.494    0.000    0.177    0.506
##    .openaW3P          0.195    0.029      6.709    0.000    0.195    0.537
##    .openaW4P          0.181    0.030      6.056    0.000    0.181    0.505
##  .openaW3S ~~                                                             
##    .openaW4S          0.336    0.035      9.714    0.000    0.336    0.860
##  .openaW1P ~~                                                             
##    .openaW3S          0.150    0.025      6.008    0.000    0.150    0.470
##  .openaW2P ~~                                                             
##    .openaW3S          0.164    0.026      6.315    0.000    0.164    0.488
##  .openaW3S ~~                                                             
##    .openaW3P          0.187    0.028      6.610    0.000    0.187    0.538
##    .openaW4P          0.167    0.029      5.806    0.000    0.167    0.487
##  .openaW1P ~~                                                             
##    .openaW4S          0.158    0.026      5.957    0.000    0.158    0.485
##  .openaW2P ~~                                                             
##    .openaW4S          0.178    0.027      6.501    0.000    0.178    0.519
##  .openaW3P ~~                                                             
##    .openaW4S          0.199    0.030      6.717    0.000    0.199    0.561
##  .openaW4S ~~                                                             
##    .openaW4P          0.198    0.031      6.336    0.000    0.198    0.566
##  .intelW1P ~~                                                             
##    .intelW2P       -190.571    0.021  -9203.643    0.000 -190.571   -0.782
##    .intelW3P       -199.840       NA                     -199.840   -0.850
##    .intelW4P       -207.828    0.015 -13495.314    0.000 -207.828   -0.813
##  .intelW2P ~~                                                             
##    .intelW3P       -208.744    0.025  -8354.334    0.000 -208.744   -0.896
##    .intelW4P       -217.188       NA                     -217.188   -0.857
##  .intelW3P ~~                                                             
##    .intelW4P       -228.037    0.015 -14730.101    0.000 -228.037   -0.933
##  .openaW1P ~~                                                             
##    .openaW2P          0.203    0.025      8.263    0.000    0.203    0.726
##    .openaW3P          0.218    0.026      8.246    0.000    0.218    0.755
##    .openaW4P          0.230    0.027      8.487    0.000    0.230    0.803
##  .openaW2P ~~                                                             
##    .openaW3P          0.246    0.028      8.745    0.000    0.246    0.805
##    .openaW4P          0.236    0.028      8.465    0.000    0.236    0.782
##  .openaW3P ~~                                                             
##    .openaW4P          0.274    0.031      8.853    0.000    0.274    0.878
## 
## Intercepts:
##                    Estimate  Std.Err  z-value    P(>|z|)   Std.lv  Std.all
##     interc            3.657    0.032    112.552    0.000    0.535    0.535
##     slope            -0.001    0.001     -1.866    0.062   -0.026   -0.026
##    .intelW1S          0.000                                 0.000    0.000
##    .intelW2S          0.000                                 0.000    0.000
##    .intelW3S          0.000                                 0.000    0.000
##    .intelW4S          0.000                                 0.000    0.000
##    .openaW1S   (b)    3.800    0.037    102.232    0.000    3.800    6.081
##    .openaW2S   (b)    3.800    0.037    102.232    0.000    3.800    5.886
##    .openaW3S   (b)    3.800    0.037    102.232    0.000    3.800    6.145
##    .openaW4S   (b)    3.800    0.037    102.232    0.000    3.800    6.021
##    .intelW1P   (c)   -3.258    0.066    -49.564    0.000   -3.258   -5.854
##    .intelW2P   (c)   -3.258    0.066    -49.564    0.000   -3.258   -6.489
##    .intelW3P   (c)   -3.258    0.066    -49.564    0.000   -3.258   -5.677
##    .intelW4P   (c)   -3.258    0.066    -49.564    0.000   -3.258   -5.770
##    .openaW1P   (d)    3.592    0.036    100.226    0.000    3.592    6.977
##    .openaW2P   (d)    3.592    0.036    100.226    0.000    3.592    6.609
##    .openaW3P   (d)    3.592    0.036    100.226    0.000    3.592    6.387
##    .openaW4P   (d)    3.592    0.036    100.226    0.000    3.592    6.465
##    .opend1            0.000                                 0.000    0.000
##    .opend2            0.000                                 0.000    0.000
##    .opend3            0.000                                 0.000    0.000
##    .opend4            0.000                                 0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value    P(>|z|)   Std.lv  Std.all
##    .intelW1S        -62.545    0.020  -3061.926    0.000  -62.545 -209.055
##    .openaW1S          0.390    0.034     11.508    0.000    0.390    1.000
##    .intelW1P       -245.728    0.010 -25094.945    0.000 -245.728 -793.202
##    .openaW1P          0.265    0.030      8.869    0.000    0.265    1.000
##    .intelW2S        -61.487    0.026  -2378.583    0.000  -61.487 -211.788
##    .openaW2S          0.417    0.039     10.743    0.000    0.417    1.000
##    .intelW2P       -241.610       NA                     -241.610 -958.390
##    .openaW2P          0.295    0.031      9.416    0.000    0.295    1.000
##    .intelW3S        -57.183    0.025  -2305.401    0.000  -57.183 -191.889
##    .openaW3S          0.382    0.036     10.671    0.000    0.382    1.000
##    .intelW3P       -224.711       NA                     -224.711 -682.198
##    .openaW3P          0.316    0.034      9.232    0.000    0.316    1.000
##    .intelW4S        -67.707    0.020  -3388.325    0.000  -67.707 -248.837
##    .openaW4S          0.398    0.040      9.920    0.000    0.398    1.000
##    .intelW4P       -265.821    0.015 -18176.586    0.000 -265.821 -833.797
##    .openaW4P          0.309    0.036      8.614    0.000    0.309    1.000
##    .opend1           16.148       NA                        0.257    0.257
##    .opend2           10.899    0.015    727.654    0.000    0.176    0.176
##    .opend3            1.445    0.016     91.167    0.000    0.025    0.025
##    .opend4            7.283       NA                        0.107    0.107
##     interc           46.696    0.013   3678.942    0.000    1.000    1.000
##     slope             0.003       NA                        1.000    1.000
semPaths(lgmOpend, what = "col", whatLabels = "est", intercepts = T)

with random parcels

lgmOpend <- '

# factor at each time point with same loading
opend1 =~ opendW1S1        + a * opendW1S2 + 
           peer * opendW1P1 + aa * opendW1P2

opend2 =~ opendW2S1        + a * opendW2S2 + 
           peer * opendW2P1 + aa * opendW2P2

opend3 =~ opendW3S1        + a * opendW3S2 + 
           peer * opendW3P1 + aa * opendW3P2
  
opend4 =~ opendW4S1        + a * opendW4S2 + 
           peer * opendW4P1 + aa * opendW4P2

# second order factor for intercept and slope
interc =~ 1*opend1 + 1*opend2 + 1*opend3 + 1*opend4
slope =~ 0*opend1 + 6*opend2 + 13*opend3 + 19*opend4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
opendW1S1 ~ 0*1
opendW2S1 ~ 0*1
opendW3S1 ~ 0*1
opendW4S1 ~ 0*1

# fix equal intercepts
opendW1S2 ~ b*1
opendW2S2 ~ b*1
opendW3S2 ~ b*1
opendW4S2 ~ b*1

opendW1P1 ~ c*1
opendW2P1 ~ c*1
opendW3P1 ~ c*1
opendW4P1 ~ c*1

opendW1P2 ~ d*1
opendW2P2 ~ d*1
opendW3P2 ~ d*1
opendW4P2 ~ d*1

# error covariance - similar parcels across waves
opendW1S1 ~~ opendW2S1 + opendW3S1 + opendW4S1
opendW2S1 ~~ opendW3S1 + opendW4S1
opendW3S1 ~~ opendW4S1

opendW1S2 ~~ opendW2S2 + opendW3S2 + opendW4S2
opendW2S2 ~~ opendW3S2 + opendW4S2
opendW3S2 ~~ opendW4S2

opendW1P1 ~~ opendW2P1 + opendW3P1 + opendW4P1
opendW2P1 ~~ opendW3P1 + opendW4P1
opendW3P1 ~~ opendW4P1

opendW1P2 ~~ opendW2P2 + opendW3P2 + opendW4P2
opendW2P2 ~~ opendW3P2 + opendW4P2
opendW3P2 ~~ opendW4P2

# error covariance - same method at one wave
opendW1S1 ~~ opendW1S2
opendW1P1 ~~ opendW1P2
opendW2S1 ~~ opendW2S2
opendW2P1 ~~ opendW2P2
opendW3S1 ~~ opendW3S2
opendW3P1 ~~ opendW3P2
opendW4S1 ~~ opendW4S2
opendW4P1 ~~ opendW4P2
'
lgmOpend <- sem(lgmOpend, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lgmOpend, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 524 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opend1 =~                                                             
##     opnW1S1           1.000                               1.300    0.922
##     opnW1S2    (a)    0.908       NA                      1.180    0.935
##     opnW1P1 (peer)    0.952       NA                      1.238    0.971
##     opnW1P2   (aa)    0.935       NA                      1.216    0.994
##   opend2 =~                                                             
##     opnW2S1           1.000                               1.159    0.959
##     opnW2S2    (a)    0.908       NA                      1.052    0.957
##     opnW2P1 (peer)    0.952       NA                      1.103    0.957
##     opnW2P2   (aa)    0.935       NA                      1.084    0.940
##   opend3 =~                                                             
##     opnW3S1           1.000                               1.146    0.965
##     opnW3S2    (a)    0.908       NA                      1.041    0.952
##     opnW3P1 (peer)    0.952       NA                      1.091    0.903
##     opnW3P2   (aa)    0.935       NA                      1.072    0.943
##   opend4 =~                                                             
##     opnW4S1           1.000                               1.148    0.942
##     opnW4S2    (a)    0.908       NA                      1.042    0.952
##     opnW4P1 (peer)    0.952       NA                      1.093    0.924
##     opnW4P2   (aa)    0.935       NA                      1.074    0.944
##   interc =~                                                             
##     opend1            1.000                               0.883    0.883
##     opend2            1.000                               0.990    0.990
##     opend3            1.000                               1.001    1.001
##     opend4            1.000                               1.000    1.000
##   slope =~                                                              
##     opend1            0.000                                  NA       NA
##     opend2            6.000                                  NA       NA
##     opend3           13.000                                  NA       NA
##     opend4           19.000                                  NA       NA
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.001       NA                      0.085    0.085
##  .opendW1S1 ~~                                                          
##    .opendW2S1         0.026       NA                      0.026    0.140
##    .opendW3S1         0.037       NA                      0.037    0.220
##    .opendW4S1         0.042       NA                      0.042    0.190
##  .opendW2S1 ~~                                                          
##    .opendW3S1         0.030       NA                      0.030    0.280
##    .opendW4S1         0.055       NA                      0.055    0.391
##  .opendW3S1 ~~                                                          
##    .opendW4S1         0.051       NA                      0.051    0.399
##  .opendW1S2 ~~                                                          
##    .opendW2S2         0.065       NA                      0.065    0.454
##    .opendW3S2         0.061       NA                      0.061    0.405
##    .opendW4S2         0.021       NA                      0.021    0.143
##  .opendW2S2 ~~                                                          
##    .opendW3S2         0.057       NA                      0.057    0.529
##    .opendW4S2         0.018       NA                      0.018    0.173
##  .opendW3S2 ~~                                                          
##    .opendW4S2         0.027       NA                      0.027    0.239
##  .opendW1P1 ~~                                                          
##    .opendW2P1         0.022       NA                      0.022    0.220
##    .opendW3P1         0.085       NA                      0.085    0.540
##    .opendW4P1         0.053       NA                      0.053    0.388
##  .opendW2P1 ~~                                                          
##    .opendW3P1         0.072       NA                      0.072    0.413
##    .opendW4P1         0.074       NA                      0.074    0.488
##  .opendW3P1 ~~                                                          
##    .opendW4P1         0.153       NA                      0.153    0.655
##  .opendW1P2 ~~                                                          
##    .opendW2P2         0.063       NA                      0.063    1.218
##    .opendW3P2         0.060       NA                      0.060    1.209
##    .opendW4P2         0.059       NA                      0.059    1.206
##  .opendW2P2 ~~                                                          
##    .opendW3P2         0.149       NA                      0.149    0.998
##    .opendW4P2         0.147       NA                      0.147    0.999
##  .opendW3P2 ~~                                                          
##    .opendW4P2         0.141       NA                      0.141    1.000
##  .opendW1S1 ~~                                                          
##    .opendW1S2         0.158       NA                      0.158    0.644
##  .opendW1P1 ~~                                                          
##    .opendW1P2         0.002       NA                      0.002    0.061
##  .opendW2S1 ~~                                                          
##    .opendW2S2         0.012       NA                      0.012    0.107
##  .opendW2P1 ~~                                                          
##    .opendW2P2         0.000       NA                      0.000    0.002
##  .opendW3S1 ~~                                                          
##    .opendW3S2         0.039       NA                      0.039    0.376
##  .opendW3P1 ~~                                                          
##    .opendW3P2        -0.000       NA                     -0.000   -0.000
##  .opendW4S1 ~~                                                          
##    .opendW4S2         0.048       NA                      0.048    0.350
##  .opendW4P1 ~~                                                          
##    .opendW4P2        -0.000       NA                     -0.000   -0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.766       NA                      3.283    3.283
##     slope             0.000       NA                         NA       NA
##    .opendW1S1         0.000                               0.000    0.000
##    .opendW2S1         0.000                               0.000    0.000
##    .opendW3S1         0.000                               0.000    0.000
##    .opendW4S1         0.000                               0.000    0.000
##    .opendW1S2  (b)    0.208       NA                      0.208    0.165
##    .opendW2S2  (b)    0.208       NA                      0.208    0.189
##    .opendW3S2  (b)    0.208       NA                      0.208    0.191
##    .opendW4S2  (b)    0.208       NA                      0.208    0.190
##    .opendW1P1  (c)    0.171       NA                      0.171    0.134
##    .opendW2P1  (c)    0.171       NA                      0.171    0.148
##    .opendW3P1  (c)    0.171       NA                      0.171    0.142
##    .opendW4P1  (c)    0.171       NA                      0.171    0.145
##    .opendW1P2  (d)    0.365       NA                      0.365    0.298
##    .opendW2P2  (d)    0.365       NA                      0.365    0.316
##    .opendW3P2  (d)    0.365       NA                      0.365    0.321
##    .opendW4P2  (d)    0.365       NA                      0.365    0.321
##    .opend1            0.000                               0.000    0.000
##    .opend2            0.000                               0.000    0.000
##    .opend3            0.000                               0.000    0.000
##    .opend4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .opendW1S1         0.299       NA                      0.299    0.150
##    .opendW1S2         0.201       NA                      0.201    0.126
##    .opendW1P1         0.092       NA                      0.092    0.057
##    .opendW1P2         0.017       NA                      0.017    0.012
##    .opendW2S1         0.118       NA                      0.118    0.081
##    .opendW2S2         0.102       NA                      0.102    0.084
##    .opendW2P1         0.112       NA                      0.112    0.084
##    .opendW2P2         0.155       NA                      0.155    0.117
##    .opendW3S1         0.097       NA                      0.097    0.068
##    .opendW3S2         0.112       NA                      0.112    0.094
##    .opendW3P1         0.268       NA                      0.268    0.184
##    .opendW3P2         0.142       NA                      0.142    0.110
##    .opendW4S1         0.166       NA                      0.166    0.112
##    .opendW4S2         0.111       NA                      0.111    0.093
##    .opendW4P1         0.204       NA                      0.204    0.146
##    .opendW4P2         0.140       NA                      0.140    0.108
##    .opend1            0.373       NA                      0.221    0.221
##    .opend2            0.017       NA                      0.012    0.012
##    .opend3           -0.007       NA                     -0.006   -0.006
##    .opend4            0.014       NA                      0.010    0.010
##     interc            1.316       NA                      1.000    1.000
##     slope            -0.000       NA                         NA       NA
semPaths(lgmOpend, what = "col", whatLabels = "est", intercepts = T)

LGM Assertiveness

lgmAssert <- '

# factor at each time point with same loading
assert1 =~ assertW1S1        + a * assertW1S2 + 
           peer * assertW1P1 + aa * assertW1P2

assert2 =~ assertW2S1        + a * assertW2S2 + 
           peer * assertW2P1 + aa * assertW2P2

assert3 =~ assertW3S1        + a * assertW3S2 + 
           peer * assertW3P1 + aa * assertW3P2
  
assert4 =~ assertW4S1        + a * assertW4S2 + 
           peer * assertW4P1 + aa * assertW4P2

# second order factor for intercept and slope
interc =~ 1*assert1 + 1*assert2 + 1*assert3 + 1*assert4
slope =~ 0*assert1 + 6*assert2 + 13*assert3 + 19*assert4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
assertW1S1 ~ 0*1
assertW2S1 ~ 0*1
assertW3S1 ~ 0*1
assertW4S1 ~ 0*1

# fix equal intercepts
assertW1S2 ~ b*1
assertW2S2 ~ b*1
assertW3S2 ~ b*1
assertW4S2 ~ b*1

assertW1P1 ~ c*1
assertW2P1 ~ c*1
assertW3P1 ~ c*1
assertW4P1 ~ c*1

assertW1P2 ~ d*1
assertW2P2 ~ d*1
assertW3P2 ~ d*1
assertW4P2 ~ d*1

# error covariance - similar parcels across waves
assertW1S1 ~~ assertW2S1 + assertW3S1 + assertW4S1
assertW2S1 ~~ assertW3S1 + assertW4S1
assertW3S1 ~~ assertW4S1

assertW1S2 ~~ assertW2S2 + assertW3S2 + assertW4S2
assertW2S2 ~~ assertW3S2 + assertW4S2
assertW3S2 ~~ assertW4S2

assertW1P1 ~~ assertW2P1 + assertW3P1 + assertW4P1
assertW2P1 ~~ assertW3P1 + assertW4P1
assertW3P1 ~~ assertW4P1

assertW1P2 ~~ assertW2P2 + assertW3P2 + assertW4P2
assertW2P2 ~~ assertW3P2 + assertW4P2
assertW3P2 ~~ assertW4P2

# error covariance - same method at one wave
assertW1S1 ~~ assertW1S2
assertW1P1 ~~ assertW1P2
assertW2S1 ~~ assertW2S2
assertW2P1 ~~ assertW2P2
assertW3S1 ~~ assertW3S2
assertW3P1 ~~ assertW3P2
assertW4S1 ~~ assertW4S2
assertW4P1 ~~ assertW4P2
'
lgmAssert <- sem(lgmAssert, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmAssert, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 188 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               299.533
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2668.403
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.917
##   Tucker-Lewis Index (TLI)                       0.889
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1412.291
##   Loglikelihood unrestricted model (H1)      -1262.524
##                                                       
##   Akaike (AIC)                                2950.581
##   Bayesian (BIC)                              3174.662
##   Sample-size adjusted Bayesian (BIC)         2974.929
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.096
##   90 Percent confidence interval - lower         0.084
##   90 Percent confidence interval - upper         0.108
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.181
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   assert1 =~                                                            
##     assW1S1           1.000                               0.570    0.825
##     assW1S2    (a)    1.066    0.067   15.917    0.000    0.608    0.806
##     assW1P1 (peer)    0.377    0.069    5.478    0.000    0.215    0.370
##     assW1P2   (aa)    0.525    0.073    7.213    0.000    0.299    0.476
##   assert2 =~                                                            
##     assW2S1           1.000                               0.570    0.810
##     assW2S2    (a)    1.066    0.067   15.917    0.000    0.608    0.830
##     assW2P1 (peer)    0.377    0.069    5.478    0.000    0.215    0.406
##     assW2P2   (aa)    0.525    0.073    7.213    0.000    0.299    0.483
##   assert3 =~                                                            
##     assW3S1           1.000                               0.576    0.845
##     assW3S2    (a)    1.066    0.067   15.917    0.000    0.614    0.860
##     assW3P1 (peer)    0.377    0.069    5.478    0.000    0.217    0.390
##     assW3P2   (aa)    0.525    0.073    7.213    0.000    0.302    0.441
##   assert4 =~                                                            
##     assW4S1           1.000                               0.618    0.890
##     assW4S2    (a)    1.066    0.067   15.917    0.000    0.659    0.907
##     assW4P1 (peer)    0.377    0.069    5.478    0.000    0.233    0.436
##     assW4P2   (aa)    0.525    0.073    7.213    0.000    0.324    0.507
##   interc =~                                                             
##     assert1           1.000                               1.027    1.027
##     assert2           1.000                               1.027    1.027
##     assert3           1.000                               1.017    1.017
##     assert4           1.000                               0.947    0.947
##   slope =~                                                              
##     assert1           0.000                               0.000    0.000
##     assert2           6.000                               0.137    0.137
##     assert3          13.000                               0.295    0.295
##     assert4          19.000                               0.401    0.401
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.001    0.001   -1.270    0.204   -0.193   -0.193
##  .assertW1S1 ~~                                                         
##    .assertW2S1        0.043    0.021    2.049    0.040    0.043    0.269
##    .assertW3S1        0.035    0.019    1.813    0.070    0.035    0.245
##    .assertW4S1        0.022    0.019    1.156    0.248    0.022    0.178
##  .assertW2S1 ~~                                                         
##    .assertW3S1        0.065    0.021    3.114    0.002    0.065    0.433
##    .assertW4S1        0.055    0.021    2.629    0.009    0.055    0.418
##  .assertW3S1 ~~                                                         
##    .assertW4S1        0.057    0.020    2.853    0.004    0.057    0.494
##  .assertW1S2 ~~                                                         
##    .assertW2S2        0.069    0.024    2.900    0.004    0.069    0.379
##    .assertW3S2        0.059    0.022    2.721    0.007    0.059    0.362
##    .assertW4S2        0.054    0.022    2.443    0.015    0.054    0.396
##  .assertW2S2 ~~                                                         
##    .assertW3S2        0.055    0.022    2.471    0.013    0.055    0.370
##    .assertW4S2        0.070    0.024    2.942    0.003    0.070    0.559
##  .assertW3S2 ~~                                                         
##    .assertW4S2        0.047    0.023    2.105    0.035    0.047    0.425
##  .assertW1P1 ~~                                                         
##    .assertW2P1        0.162    0.028    5.830    0.000    0.162    0.618
##    .assertW3P1        0.171    0.032    5.332    0.000    0.171    0.615
##    .assertW4P1        0.137    0.028    4.891    0.000    0.137    0.525
##  .assertW2P1 ~~                                                         
##    .assertW3P1        0.129    0.029    4.397    0.000    0.129    0.518
##    .assertW4P1        0.133    0.027    4.991    0.000    0.133    0.572
##  .assertW3P1 ~~                                                         
##    .assertW4P1        0.163    0.032    5.115    0.000    0.163    0.660
##  .assertW1P2 ~~                                                         
##    .assertW2P2        0.170    0.032    5.262    0.000    0.170    0.566
##    .assertW3P2        0.243    0.038    6.397    0.000    0.243    0.715
##    .assertW4P2        0.208    0.033    6.207    0.000    0.208    0.681
##  .assertW2P2 ~~                                                         
##    .assertW3P2        0.268    0.040    6.647    0.000    0.268    0.802
##    .assertW4P2        0.219    0.035    6.176    0.000    0.219    0.731
##  .assertW3P2 ~~                                                         
##    .assertW4P2        0.254    0.042    6.050    0.000    0.254    0.747
##  .assertW1S1 ~~                                                         
##    .assertW1S2        0.063    0.027    2.329    0.020    0.063    0.364
##  .assertW1P1 ~~                                                         
##    .assertW1P2        0.071    0.017    4.227    0.000    0.071    0.236
##  .assertW2S1 ~~                                                         
##    .assertW2S2        0.041    0.023    1.813    0.070    0.041    0.245
##  .assertW2P1 ~~                                                         
##    .assertW2P2        0.057    0.015    3.745    0.000    0.057    0.215
##  .assertW3S1 ~~                                                         
##    .assertW3S2        0.014    0.019    0.780    0.435    0.014    0.109
##  .assertW3P1 ~~                                                         
##    .assertW3P2       -0.003    0.018   -0.186    0.853   -0.003   -0.010
##  .assertW4S1 ~~                                                         
##    .assertW4S2       -0.005    0.031   -0.156    0.876   -0.005   -0.050
##  .assertW4P1 ~~                                                         
##    .assertW4P2        0.040    0.016    2.521    0.012    0.040    0.150
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.381    0.042   81.208    0.000    5.774    5.774
##     slope            -0.001    0.002   -0.433    0.665   -0.053   -0.053
##    .assertW1S1        0.000                               0.000    0.000
##    .assertW2S1        0.000                               0.000    0.000
##    .assertW3S1        0.000                               0.000    0.000
##    .assertW4S1        0.000                               0.000    0.000
##    .assertW1S2 (b)   -0.104    0.227   -0.458    0.647   -0.104   -0.138
##    .assertW2S2 (b)   -0.104    0.227   -0.458    0.647   -0.104   -0.142
##    .assertW3S2 (b)   -0.104    0.227   -0.458    0.647   -0.104   -0.146
##    .assertW4S2 (b)   -0.104    0.227   -0.458    0.647   -0.104   -0.143
##    .assertW1P1 (c)    2.429    0.233   10.431    0.000    2.429    4.175
##    .assertW2P1 (c)    2.429    0.233   10.431    0.000    2.429    4.583
##    .assertW3P1 (c)    2.429    0.233   10.431    0.000    2.429    4.361
##    .assertW4P1 (c)    2.429    0.233   10.431    0.000    2.429    4.544
##    .assertW1P2 (d)    1.753    0.248    7.066    0.000    1.753    2.787
##    .assertW2P2 (d)    1.753    0.248    7.066    0.000    1.753    2.826
##    .assertW3P2 (d)    1.753    0.248    7.066    0.000    1.753    2.557
##    .assertW4P2 (d)    1.753    0.248    7.066    0.000    1.753    2.738
##    .assert1           0.000                               0.000    0.000
##    .assert2           0.000                               0.000    0.000
##    .assert3           0.000                               0.000    0.000
##    .assert4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S1        0.152    0.031    4.922    0.000    0.152    0.319
##    .assertW1S2        0.199    0.040    4.921    0.000    0.199    0.350
##    .assertW1P1        0.292    0.034    8.565    0.000    0.292    0.863
##    .assertW1P2        0.306    0.036    8.524    0.000    0.306    0.774
##    .assertW2S1        0.171    0.033    5.253    0.000    0.171    0.345
##    .assertW2S2        0.167    0.035    4.814    0.000    0.167    0.311
##    .assertW2P1        0.235    0.030    7.894    0.000    0.235    0.835
##    .assertW2P2        0.295    0.037    7.979    0.000    0.295    0.767
##    .assertW3S1        0.133    0.027    4.927    0.000    0.133    0.287
##    .assertW3S2        0.133    0.031    4.287    0.000    0.133    0.261
##    .assertW3P1        0.263    0.037    7.183    0.000    0.263    0.848
##    .assertW3P2        0.378    0.051    7.421    0.000    0.378    0.806
##    .assertW4S1        0.101    0.038    2.649    0.008    0.101    0.209
##    .assertW4S2        0.094    0.042    2.206    0.027    0.094    0.177
##    .assertW4P1        0.231    0.033    6.973    0.000    0.231    0.810
##    .assertW4P2        0.305    0.044    6.956    0.000    0.305    0.743
##    .assert1          -0.018    0.024   -0.727    0.467   -0.055   -0.055
##    .assert2          -0.006    0.020   -0.304    0.761   -0.018   -0.018
##    .assert3          -0.002    0.016   -0.118    0.906   -0.006   -0.006
##    .assert4           0.034    0.029    1.156    0.248    0.089    0.089
##     interc            0.343    0.043    7.945    0.000    1.000    1.000
##     slope             0.000    0.000    2.488    0.013    1.000    1.000
semPaths(lgmAssert, what = "col", whatLabels = "est", intercepts = T)

LGM Compassion

lgmCompa <- '

# factor at each time point with same loading
compa1 =~ compaW1S1        + a * compaW1S2 + 
           peer * compaW1P1 + aa * compaW1P2

compa2 =~ compaW2S1        + a * compaW2S2 + 
           peer * compaW2P1 + aa * compaW2P2

compa3 =~ compaW3S1        + a * compaW3S2 + 
           peer * compaW3P1 + aa * compaW3P2
  
compa4 =~ compaW4S1        + a * compaW4S2 + 
           peer * compaW4P1 + aa * compaW4P2

# second order factor for intercept and slope
interc =~ 1*compa1 + 1*compa2 + 1*compa3 + 1*compa4
slope =~ 0*compa1 + 6*compa2 + 13*compa3 + 19*compa4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
compaW1S1 ~ 0*1
compaW2S1 ~ 0*1
compaW3S1 ~ 0*1
compaW4S1 ~ 0*1

# fix equal intercepts
compaW1S2 ~ b*1
compaW2S2 ~ b*1
compaW3S2 ~ b*1
compaW4S2 ~ b*1

compaW1P1 ~ c*1
compaW2P1 ~ c*1
compaW3P1 ~ c*1
compaW4P1 ~ c*1

compaW1P2 ~ d*1
compaW2P2 ~ d*1
compaW3P2 ~ d*1
compaW4P2 ~ d*1

# error covariance - similar parcels across waves
compaW1S1 ~~ compaW2S1 + compaW3S1 + compaW4S1
compaW2S1 ~~ compaW3S1 + compaW4S1
compaW3S1 ~~ compaW4S1

compaW1S2 ~~ compaW2S2 + compaW3S2 + compaW4S2
compaW2S2 ~~ compaW3S2 + compaW4S2
compaW3S2 ~~ compaW4S2

compaW1P1 ~~ compaW2P1 + compaW3P1 + compaW4P1
compaW2P1 ~~ compaW3P1 + compaW4P1
compaW3P1 ~~ compaW4P1

compaW1P2 ~~ compaW2P2 + compaW3P2 + compaW4P2
compaW2P2 ~~ compaW3P2 + compaW4P2
compaW3P2 ~~ compaW4P2

# error covariance - same method at one wave
compaW1S1 ~~ compaW1S2
compaW1P1 ~~ compaW1P2
compaW2S1 ~~ compaW2S2
compaW2P1 ~~ compaW2P2
compaW3S1 ~~ compaW3S2
compaW3P1 ~~ compaW3P2
compaW4S1 ~~ compaW4S2
compaW4P1 ~~ compaW4P2
'
lgmCompa <- sem(lgmCompa, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmCompa, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 180 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               302.256
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2272.548
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.901
##   Tucker-Lewis Index (TLI)                       0.866
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1038.587
##   Loglikelihood unrestricted model (H1)       -887.459
##                                                       
##   Akaike (AIC)                                2203.174
##   Bayesian (BIC)                              2427.254
##   Sample-size adjusted Bayesian (BIC)         2227.521
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.096
##   90 Percent confidence interval - lower         0.084
##   90 Percent confidence interval - upper         0.108
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.180
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   compa1 =~                                                             
##     cmpW1S1           1.000                               0.258    0.524
##     cmpW1S2    (a)    1.092    0.057   19.068    0.000    0.281    0.530
##     cmpW1P1 (peer)    1.014    0.136    7.451    0.000    0.261    0.426
##     cmpW1P2   (aa)    0.977    0.133    7.369    0.000    0.252    0.452
##   compa2 =~                                                             
##     cmpW2S1           1.000                               0.280    0.581
##     cmpW2S2    (a)    1.092    0.057   19.068    0.000    0.305    0.594
##     cmpW2P1 (peer)    1.014    0.136    7.451    0.000    0.284    0.502
##     cmpW2P2   (aa)    0.977    0.133    7.369    0.000    0.273    0.460
##   compa3 =~                                                             
##     cmpW3S1           1.000                               0.304    0.620
##     cmpW3S2    (a)    1.092    0.057   19.068    0.000    0.333    0.635
##     cmpW3P1 (peer)    1.014    0.136    7.451    0.000    0.309    0.537
##     cmpW3P2   (aa)    0.977    0.133    7.369    0.000    0.298    0.559
##   compa4 =~                                                             
##     cmpW4S1           1.000                               0.305    0.628
##     cmpW4S2    (a)    1.092    0.057   19.068    0.000    0.333    0.626
##     cmpW4P1 (peer)    1.014    0.136    7.451    0.000    0.309    0.500
##     cmpW4P2   (aa)    0.977    0.133    7.369    0.000    0.298    0.492
##   interc =~                                                             
##     compa1            1.000                               1.302    1.302
##     compa2            1.000                               1.199    1.199
##     compa3            1.000                               1.102    1.102
##     compa4            1.000                               1.101    1.101
##   slope =~                                                              
##     compa1            0.000                               0.000    0.000
##     compa2            6.000                               0.209    0.209
##     compa3           13.000                               0.417    0.417
##     compa4           19.000                               0.608    0.608
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.000    0.001    0.571    0.568    0.104    0.104
##  .compaW1S1 ~~                                                          
##    .compaW2S1        -0.004    0.009   -0.472    0.637   -0.004   -0.025
##    .compaW3S1         0.006    0.008    0.698    0.485    0.006    0.036
##    .compaW4S1         0.008    0.008    1.127    0.260    0.008    0.054
##  .compaW2S1 ~~                                                          
##    .compaW3S1         0.026    0.009    2.812    0.005    0.026    0.172
##    .compaW4S1         0.020    0.008    2.414    0.016    0.020    0.133
##  .compaW3S1 ~~                                                          
##    .compaW4S1         0.022    0.008    2.657    0.008    0.022    0.152
##  .compaW1S2 ~~                                                          
##    .compaW2S2         0.022    0.010    2.253    0.024    0.022    0.117
##    .compaW3S2         0.016    0.009    1.720    0.086    0.016    0.085
##    .compaW4S2        -0.003    0.008   -0.335    0.738   -0.003   -0.015
##  .compaW2S2 ~~                                                          
##    .compaW3S2         0.031    0.010    3.101    0.002    0.031    0.186
##    .compaW4S2         0.026    0.009    2.899    0.004    0.026    0.152
##  .compaW3S2 ~~                                                          
##    .compaW4S2         0.017    0.009    1.871    0.061    0.017    0.099
##  .compaW1P1 ~~                                                          
##    .compaW2P1         0.000    0.013    0.003    0.997    0.000    0.000
##    .compaW3P1         0.000    0.016    0.018    0.986    0.000    0.001
##    .compaW4P1         0.010    0.015    0.684    0.494    0.010    0.035
##  .compaW2P1 ~~                                                          
##    .compaW3P1         0.024    0.013    1.899    0.058    0.024    0.103
##    .compaW4P1         0.021    0.013    1.576    0.115    0.021    0.080
##  .compaW3P1 ~~                                                          
##    .compaW4P1         0.005    0.017    0.313    0.754    0.005    0.021
##  .compaW1P2 ~~                                                          
##    .compaW2P2         0.025    0.013    1.880    0.060    0.025    0.094
##    .compaW3P2         0.036    0.012    2.948    0.003    0.036    0.164
##    .compaW4P2         0.019    0.015    1.256    0.209    0.019    0.074
##  .compaW2P2 ~~                                                          
##    .compaW3P2         0.001    0.012    0.052    0.959    0.001    0.003
##    .compaW4P2        -0.005    0.014   -0.319    0.750   -0.005   -0.016
##  .compaW3P2 ~~                                                          
##    .compaW4P2         0.025    0.013    1.978    0.048    0.025    0.108
##  .compaW1S1 ~~                                                          
##    .compaW1S2         0.125    0.021    5.867    0.000    0.125    0.663
##  .compaW1P1 ~~                                                          
##    .compaW1P2         0.201    0.033    6.110    0.000    0.201    0.727
##  .compaW2S1 ~~                                                          
##    .compaW2S2         0.088    0.018    4.830    0.000    0.088    0.541
##  .compaW2P1 ~~                                                          
##    .compaW2P2         0.209    0.033    6.417    0.000    0.209    0.810
##  .compaW3S1 ~~                                                          
##    .compaW3S2         0.089    0.017    5.351    0.000    0.089    0.572
##  .compaW3P1 ~~                                                          
##    .compaW3P2         0.143    0.027    5.334    0.000    0.143    0.669
##  .compaW4S1 ~~                                                          
##    .compaW4S2         0.116    0.024    4.833    0.000    0.116    0.742
##  .compaW4P1 ~~                                                          
##    .compaW4P2         0.242    0.043    5.608    0.000    0.242    0.859
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            4.191    0.027  157.851    0.000   12.500   12.500
##     slope             0.001    0.001    0.782    0.434    0.106    0.106
##    .compaW1S1         0.000                               0.000    0.000
##    .compaW2S1         0.000                               0.000    0.000
##    .compaW3S1         0.000                               0.000    0.000
##    .compaW4S1         0.000                               0.000    0.000
##    .compaW1S2  (b)   -0.486    0.241   -2.016    0.044   -0.486   -0.915
##    .compaW2S2  (b)   -0.486    0.241   -2.016    0.044   -0.486   -0.944
##    .compaW3S2  (b)   -0.486    0.241   -2.016    0.044   -0.486   -0.928
##    .compaW4S2  (b)   -0.486    0.241   -2.016    0.044   -0.486   -0.914
##    .compaW1P1  (c)   -0.330    0.575   -0.574    0.566   -0.330   -0.537
##    .compaW2P1  (c)   -0.330    0.575   -0.574    0.566   -0.330   -0.584
##    .compaW3P1  (c)   -0.330    0.575   -0.574    0.566   -0.330   -0.574
##    .compaW4P1  (c)   -0.330    0.575   -0.574    0.566   -0.330   -0.534
##    .compaW1P2  (d)   -0.116    0.560   -0.207    0.836   -0.116   -0.208
##    .compaW2P2  (d)   -0.116    0.560   -0.207    0.836   -0.116   -0.195
##    .compaW3P2  (d)   -0.116    0.560   -0.207    0.836   -0.116   -0.218
##    .compaW4P2  (d)   -0.116    0.560   -0.207    0.836   -0.116   -0.191
##    .compa1            0.000                               0.000    0.000
##    .compa2            0.000                               0.000    0.000
##    .compa3            0.000                               0.000    0.000
##    .compa4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .compaW1S1         0.176    0.022    7.992    0.000    0.176    0.726
##    .compaW1S2         0.203    0.024    8.349    0.000    0.203    0.719
##    .compaW1P1         0.309    0.041    7.552    0.000    0.309    0.819
##    .compaW1P2         0.247    0.031    8.062    0.000    0.247    0.796
##    .compaW2S1         0.153    0.019    7.987    0.000    0.153    0.663
##    .compaW2S2         0.171    0.021    8.044    0.000    0.171    0.648
##    .compaW2P1         0.239    0.032    7.377    0.000    0.239    0.748
##    .compaW2P2         0.279    0.037    7.559    0.000    0.279    0.789
##    .compaW3S1         0.148    0.018    8.390    0.000    0.148    0.615
##    .compaW3S2         0.163    0.020    8.336    0.000    0.163    0.596
##    .compaW3P1         0.235    0.032    7.294    0.000    0.235    0.711
##    .compaW3P2         0.195    0.026    7.426    0.000    0.195    0.688
##    .compaW4S1         0.142    0.023    6.280    0.000    0.142    0.606
##    .compaW4S2         0.172    0.028    6.240    0.000    0.172    0.608
##    .compaW4P1         0.286    0.046    6.180    0.000    0.286    0.750
##    .compaW4P2         0.277    0.043    6.422    0.000    0.277    0.758
##    .compa1           -0.046    0.016   -2.916    0.004   -0.694   -0.694
##    .compa2           -0.042    0.013   -3.284    0.001   -0.535   -0.535
##    .compa3           -0.045    0.011   -3.995    0.000   -0.482   -0.482
##    .compa4           -0.067    0.019   -3.570    0.000   -0.721   -0.721
##     interc            0.112    0.017    6.487    0.000    1.000    1.000
##     slope             0.000    0.000    1.890    0.059    1.000    1.000
semPaths(lgmCompa, what = "col", whatLabels = "est", intercepts = T)

LGM Enthusiasm

lgmEnthu <- '

# factor at each time point with same loading
enthu1 =~ enthuW1S1        + a * enthuW1S2 + 
           peer * enthuW1P1 + aa * enthuW1P2

enthu2 =~ enthuW2S1        + a * enthuW2S2 + 
           peer * enthuW2P1 + aa * enthuW2P2

enthu3 =~ enthuW3S1        + a * enthuW3S2 + 
           peer * enthuW3P1 + aa * enthuW3P2
  
enthu4 =~ enthuW4S1        + a * enthuW4S2 + 
           peer * enthuW4P1 + aa * enthuW4P2

# second order factor for intercept and slope
interc =~ 1*enthu1 + 1*enthu2 + 1*enthu3 + 1*enthu4
slope =~ 0*enthu1 + 6*enthu2 + 13*enthu3 + 19*enthu4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
enthuW1S1 ~ 0*1
enthuW2S1 ~ 0*1
enthuW3S1 ~ 0*1
enthuW4S1 ~ 0*1

# fix equal intercepts
enthuW1S2 ~ b*1
enthuW2S2 ~ b*1
enthuW3S2 ~ b*1
enthuW4S2 ~ b*1

enthuW1P1 ~ c*1
enthuW2P1 ~ c*1
enthuW3P1 ~ c*1
enthuW4P1 ~ c*1

enthuW1P2 ~ d*1
enthuW2P2 ~ d*1
enthuW3P2 ~ d*1
enthuW4P2 ~ d*1

# error covariance - similar parcels across waves
enthuW1S1 ~~ enthuW2S1 + enthuW3S1 + enthuW4S1
enthuW2S1 ~~ enthuW3S1 + enthuW4S1
enthuW3S1 ~~ enthuW4S1

enthuW1S2 ~~ enthuW2S2 + enthuW3S2 + enthuW4S2
enthuW2S2 ~~ enthuW3S2 + enthuW4S2
enthuW3S2 ~~ enthuW4S2

enthuW1P1 ~~ enthuW2P1 + enthuW3P1 + enthuW4P1
enthuW2P1 ~~ enthuW3P1 + enthuW4P1
enthuW3P1 ~~ enthuW4P1

enthuW1P2 ~~ enthuW2P2 + enthuW3P2 + enthuW4P2
enthuW2P2 ~~ enthuW3P2 + enthuW4P2
enthuW3P2 ~~ enthuW4P2

# error covariance - same method at one wave
enthuW1S1 ~~ enthuW1S2
enthuW1P1 ~~ enthuW1P2
enthuW2S1 ~~ enthuW2S2
enthuW2P1 ~~ enthuW2P2
enthuW3S1 ~~ enthuW3S2
enthuW3P1 ~~ enthuW3P2
enthuW4S1 ~~ enthuW4S2
enthuW4P1 ~~ enthuW4P2
'
lgmEnthu <- sem(lgmEnthu, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, : lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
##                   but not all elements of the gradient are (near) zero;
##                   the optimizer may not have found a local solution
##                   use check.gradient = FALSE to skip this check.
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmEnthu, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 246 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               244.983
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2328.338
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.929
##   Tucker-Lewis Index (TLI)                       0.905
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1513.362
##   Loglikelihood unrestricted model (H1)      -1390.870
##                                                       
##   Akaike (AIC)                                3152.724
##   Bayesian (BIC)                              3376.804
##   Sample-size adjusted Bayesian (BIC)         3177.071
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.082
##   90 Percent confidence interval - lower         0.070
##   90 Percent confidence interval - upper         0.095
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.146
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   enthu1 =~                                                             
##     entW1S1           1.000                               0.380    0.590
##     entW1S2    (a)    1.194    0.141    8.494    0.000    0.454    0.617
##     entW1P1 (peer)    1.461    0.252    5.795    0.000    0.555    0.813
##     entW1P2   (aa)    1.244    0.216    5.754    0.000    0.473    0.762
##   enthu2 =~                                                             
##     entW2S1           1.000                               0.347    0.552
##     entW2S2    (a)    1.194    0.141    8.494    0.000    0.414    0.575
##     entW2P1 (peer)    1.461    0.252    5.795    0.000    0.506    0.776
##     entW2P2   (aa)    1.244    0.216    5.754    0.000    0.431    0.741
##   enthu3 =~                                                             
##     entW3S1           1.000                               0.325    0.532
##     entW3S2    (a)    1.194    0.141    8.494    0.000    0.387    0.539
##     entW3P1 (peer)    1.461    0.252    5.795    0.000    0.474    0.776
##     entW3P2   (aa)    1.244    0.216    5.754    0.000    0.404    0.717
##   enthu4 =~                                                             
##     entW4S1           1.000                               0.315    0.523
##     entW4S2    (a)    1.194    0.141    8.494    0.000    0.376    0.524
##     entW4P1 (peer)    1.461    0.252    5.795    0.000    0.460    0.747
##     entW4P2   (aa)    1.244    0.216    5.754    0.000    0.392    0.700
##   interc =~                                                             
##     enthu1            1.000                               1.020    1.020
##     enthu2            1.000                               1.118    1.118
##     enthu3            1.000                               1.194    1.194
##     enthu4            1.000                               1.231    1.231
##   slope =~                                                              
##     enthu1            0.000                               0.000    0.000
##     enthu2            6.000                               0.156    0.156
##     enthu3           13.000                               0.362    0.362
##     enthu4           19.000                               0.545    0.545
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.002    0.001   -2.625    0.009   -0.509   -0.509
##  .enthuW1S1 ~~                                                          
##    .enthuW2S1         0.156    0.028    5.572    0.000    0.156    0.573
##    .enthuW3S1         0.142    0.028    5.140    0.000    0.142    0.529
##    .enthuW4S1         0.128    0.027    4.722    0.000    0.128    0.479
##  .enthuW2S1 ~~                                                          
##    .enthuW3S1         0.146    0.032    4.580    0.000    0.146    0.541
##    .enthuW4S1         0.162    0.032    5.025    0.000    0.162    0.604
##  .enthuW3S1 ~~                                                          
##    .enthuW4S1         0.157    0.034    4.615    0.000    0.157    0.589
##  .enthuW1S2 ~~                                                          
##    .enthuW2S2         0.173    0.035    4.875    0.000    0.173    0.507
##    .enthuW3S2         0.149    0.036    4.192    0.000    0.149    0.426
##    .enthuW4S2         0.166    0.036    4.648    0.000    0.166    0.468
##  .enthuW2S2 ~~                                                          
##    .enthuW3S2         0.223    0.042    5.256    0.000    0.223    0.625
##    .enthuW4S2         0.232    0.042    5.513    0.000    0.232    0.646
##  .enthuW3S2 ~~                                                          
##    .enthuW4S2         0.239    0.043    5.519    0.000    0.239    0.645
##  .enthuW1P1 ~~                                                          
##    .enthuW2P1         0.046    0.022    2.080    0.038    0.046    0.281
##    .enthuW3P1         0.036    0.022    1.658    0.097    0.036    0.233
##    .enthuW4P1         0.043    0.021    2.074    0.038    0.043    0.267
##  .enthuW2P1 ~~                                                          
##    .enthuW3P1         0.051    0.022    2.324    0.020    0.051    0.323
##    .enthuW4P1         0.030    0.025    1.196    0.232    0.030    0.176
##  .enthuW3P1 ~~                                                          
##    .enthuW4P1         0.040    0.023    1.755    0.079    0.040    0.256
##  .enthuW1P2 ~~                                                          
##    .enthuW2P2         0.054    0.017    3.186    0.001    0.054    0.343
##    .enthuW3P2         0.067    0.017    3.991    0.000    0.067    0.427
##    .enthuW4P2         0.037    0.018    2.034    0.042    0.037    0.233
##  .enthuW2P2 ~~                                                          
##    .enthuW3P2         0.046    0.018    2.479    0.013    0.046    0.297
##    .enthuW4P2         0.025    0.018    1.352    0.176    0.025    0.160
##  .enthuW3P2 ~~                                                          
##    .enthuW4P2         0.044    0.020    2.254    0.024    0.044    0.280
##  .enthuW1S1 ~~                                                          
##    .enthuW1S2         0.088    0.018    4.862    0.000    0.088    0.292
##  .enthuW1P1 ~~                                                          
##    .enthuW1P2         0.053    0.022    2.367    0.018    0.053    0.332
##  .enthuW2S1 ~~                                                          
##    .enthuW2S2         0.044    0.017    2.658    0.008    0.044    0.144
##  .enthuW2P1 ~~                                                          
##    .enthuW2P2         0.060    0.021    2.853    0.004    0.060    0.374
##  .enthuW3S1 ~~                                                          
##    .enthuW3S2         0.055    0.019    2.824    0.005    0.055    0.175
##  .enthuW3P1 ~~                                                          
##    .enthuW3P2         0.060    0.023    2.537    0.011    0.060    0.394
##  .enthuW4S1 ~~                                                          
##    .enthuW4S2         0.064    0.019    3.366    0.001    0.064    0.205
##  .enthuW4P1 ~~                                                          
##    .enthuW4P2         0.074    0.030    2.511    0.012    0.074    0.454
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.891    0.038  103.250    0.000   10.042   10.042
##     slope            -0.000    0.001   -0.257    0.797   -0.034   -0.034
##    .enthuW1S1         0.000                               0.000    0.000
##    .enthuW2S1         0.000                               0.000    0.000
##    .enthuW3S1         0.000                               0.000    0.000
##    .enthuW4S1         0.000                               0.000    0.000
##    .enthuW1S2  (b)   -1.125    0.549   -2.047    0.041   -1.125   -1.528
##    .enthuW2S2  (b)   -1.125    0.549   -2.047    0.041   -1.125   -1.563
##    .enthuW3S2  (b)   -1.125    0.549   -2.047    0.041   -1.125   -1.564
##    .enthuW4S2  (b)   -1.125    0.549   -2.047    0.041   -1.125   -1.569
##    .enthuW1P1  (c)   -1.977    0.984   -2.009    0.045   -1.977   -2.896
##    .enthuW2P1  (c)   -1.977    0.984   -2.009    0.045   -1.977   -3.029
##    .enthuW3P1  (c)   -1.977    0.984   -2.009    0.045   -1.977   -3.237
##    .enthuW4P1  (c)   -1.977    0.984   -2.009    0.045   -1.977   -3.214
##    .enthuW1P2  (d)   -0.880    0.844   -1.044    0.297   -0.880   -1.419
##    .enthuW2P2  (d)   -0.880    0.844   -1.044    0.297   -0.880   -1.513
##    .enthuW3P2  (d)   -0.880    0.844   -1.044    0.297   -0.880   -1.563
##    .enthuW4P2  (d)   -0.880    0.844   -1.044    0.297   -0.880   -1.574
##    .enthu1            0.000                               0.000    0.000
##    .enthu2            0.000                               0.000    0.000
##    .enthu3            0.000                               0.000    0.000
##    .enthu4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .enthuW1S1         0.270    0.027    9.927    0.000    0.270    0.651
##    .enthuW1S2         0.336    0.038    8.874    0.000    0.336    0.620
##    .enthuW1P1         0.158    0.036    4.346    0.000    0.158    0.339
##    .enthuW1P2         0.161    0.027    5.948    0.000    0.161    0.419
##    .enthuW2S1         0.274    0.033    8.414    0.000    0.274    0.695
##    .enthuW2S2         0.347    0.042    8.242    0.000    0.347    0.669
##    .enthuW2P1         0.170    0.033    5.201    0.000    0.170    0.398
##    .enthuW2P2         0.153    0.027    5.688    0.000    0.153    0.451
##    .enthuW3S1         0.267    0.033    8.059    0.000    0.267    0.717
##    .enthuW3S2         0.367    0.042    8.712    0.000    0.367    0.710
##    .enthuW3P1         0.148    0.036    4.107    0.000    0.148    0.397
##    .enthuW3P2         0.154    0.027    5.765    0.000    0.154    0.486
##    .enthuW4S1         0.264    0.035    7.501    0.000    0.264    0.727
##    .enthuW4S2         0.373    0.046    8.038    0.000    0.373    0.725
##    .enthuW4P1         0.167    0.037    4.547    0.000    0.167    0.441
##    .enthuW4P2         0.160    0.036    4.493    0.000    0.160    0.510
##    .enthu1           -0.006    0.009   -0.623    0.533   -0.040   -0.040
##    .enthu2           -0.012    0.008   -1.362    0.173   -0.096   -0.096
##    .enthu3           -0.012    0.011   -1.162    0.245   -0.117   -0.117
##    .enthu4           -0.013    0.010   -1.276    0.202   -0.130   -0.130
##     interc            0.150    0.039    3.878    0.000    1.000    1.000
##     slope             0.000    0.000    1.994    0.046    1.000    1.000
semPaths(lgmEnthu, what = "col", whatLabels = "est", intercepts = T)

LGM Industriousness

lgmIndus <- '

# factor at each time point with same loading
indus1 =~ indusW1S1        + a * indusW1S2 + 
           peer * indusW1P1 + aa * indusW1P2

indus2 =~ indusW2S1        + a * indusW2S2 + 
           peer * indusW2P1 + aa * indusW2P2

indus3 =~ indusW3S1        + a * indusW3S2 + 
           peer * indusW3P1 + aa * indusW3P2
  
indus4 =~ indusW4S1        + a * indusW4S2 + 
           peer * indusW4P1 + aa * indusW4P2

# second order factor for intercept and slope
interc =~ 1*indus1 + 1*indus2 + 1*indus3 + 1*indus4
slope =~ 0*indus1 + 6*indus2 + 13*indus3 + 19*indus4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
indusW1S1 ~ 0*1
indusW2S1 ~ 0*1
indusW3S1 ~ 0*1
indusW4S1 ~ 0*1

# fix equal intercepts
indusW1S2 ~ b*1
indusW2S2 ~ b*1
indusW3S2 ~ b*1
indusW4S2 ~ b*1

indusW1P1 ~ c*1
indusW2P1 ~ c*1
indusW3P1 ~ c*1
indusW4P1 ~ c*1

indusW1P2 ~ d*1
indusW2P2 ~ d*1
indusW3P2 ~ d*1
indusW4P2 ~ d*1

# error covariance - similar parcels across waves
indusW1S1 ~~ indusW2S1 + indusW3S1 + indusW4S1
indusW2S1 ~~ indusW3S1 + indusW4S1
indusW3S1 ~~ indusW4S1

indusW1S2 ~~ indusW2S2 + indusW3S2 + indusW4S2
indusW2S2 ~~ indusW3S2 + indusW4S2
indusW3S2 ~~ indusW4S2

indusW1P1 ~~ indusW2P1 + indusW3P1 + indusW4P1
indusW2P1 ~~ indusW3P1 + indusW4P1
indusW3P1 ~~ indusW4P1

indusW1P2 ~~ indusW2P2 + indusW3P2 + indusW4P2
indusW2P2 ~~ indusW3P2 + indusW4P2
indusW3P2 ~~ indusW4P2

# error covariance - same method at one wave
indusW1S1 ~~ indusW1S2
indusW1P1 ~~ indusW1P2
indusW2S1 ~~ indusW2S2
indusW2P1 ~~ indusW2P2
indusW3S1 ~~ indusW3S2
indusW3P1 ~~ indusW3P2
indusW4S1 ~~ indusW4S2
indusW4P1 ~~ indusW4P2
'
lgmIndus <- sem(lgmIndus, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmIndus, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 197 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               245.959
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1960.526
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.915
##   Tucker-Lewis Index (TLI)                       0.885
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1638.292
##   Loglikelihood unrestricted model (H1)      -1515.313
##                                                       
##   Akaike (AIC)                                3402.585
##   Bayesian (BIC)                              3626.665
##   Sample-size adjusted Bayesian (BIC)         3426.932
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.083
##   90 Percent confidence interval - lower         0.070
##   90 Percent confidence interval - upper         0.095
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.173
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   indus1 =~                                                             
##     indW1S1           1.000                               0.425    0.707
##     indW1S2    (a)    1.393    0.125   11.148    0.000    0.592    0.790
##     indW1P1 (peer)    0.695    0.121    5.766    0.000    0.295    0.465
##     indW1P2   (aa)    0.515    0.140    3.676    0.000    0.219    0.342
##   indus2 =~                                                             
##     indW2S1           1.000                               0.420    0.719
##     indW2S2    (a)    1.393    0.125   11.148    0.000    0.585    0.826
##     indW2P1 (peer)    0.695    0.121    5.766    0.000    0.292    0.491
##     indW2P2   (aa)    0.515    0.140    3.676    0.000    0.216    0.353
##   indus3 =~                                                             
##     indW3S1           1.000                               0.420    0.683
##     indW3S2    (a)    1.393    0.125   11.148    0.000    0.585    0.801
##     indW3P1 (peer)    0.695    0.121    5.766    0.000    0.292    0.469
##     indW3P2   (aa)    0.515    0.140    3.676    0.000    0.217    0.370
##   indus4 =~                                                             
##     indW4S1           1.000                               0.423    0.742
##     indW4S2    (a)    1.393    0.125   11.148    0.000    0.589    0.834
##     indW4P1 (peer)    0.695    0.121    5.766    0.000    0.294    0.444
##     indW4P2   (aa)    0.515    0.140    3.676    0.000    0.218    0.376
##   interc =~                                                             
##     indus1            1.000                               0.937    0.937
##     indus2            1.000                               0.948    0.948
##     indus3            1.000                               0.947    0.947
##     indus4            1.000                               0.941    0.941
##   slope =~                                                              
##     indus1            0.000                               0.000    0.000
##     indus2            6.000                               0.089    0.089
##     indus3           13.000                               0.193    0.193
##     indus4           19.000                               0.280    0.280
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.000    0.001    0.582    0.561    0.193    0.193
##  .indusW1S1 ~~                                                          
##    .indusW2S1         0.079    0.017    4.570    0.000    0.079    0.456
##    .indusW3S1         0.075    0.018    4.176    0.000    0.075    0.396
##    .indusW4S1         0.057    0.017    3.340    0.001    0.057    0.352
##  .indusW2S1 ~~                                                          
##    .indusW3S1         0.081    0.019    4.221    0.000    0.081    0.446
##    .indusW4S1         0.057    0.018    3.163    0.002    0.057    0.367
##  .indusW3S1 ~~                                                          
##    .indusW4S1         0.089    0.020    4.530    0.000    0.089    0.519
##  .indusW1S2 ~~                                                          
##    .indusW2S2         0.072    0.032    2.279    0.023    0.072    0.392
##    .indusW3S2         0.045    0.031    1.463    0.143    0.045    0.224
##    .indusW4S2         0.024    0.032    0.745    0.456    0.024    0.131
##  .indusW2S2 ~~                                                          
##    .indusW3S2         0.051    0.032    1.589    0.112    0.051    0.294
##    .indusW4S2         0.017    0.033    0.528    0.597    0.017    0.112
##  .indusW3S2 ~~                                                          
##    .indusW4S2         0.051    0.036    1.425    0.154    0.051    0.298
##  .indusW1P1 ~~                                                          
##    .indusW2P1         0.141    0.032    4.353    0.000    0.141    0.485
##    .indusW3P1         0.133    0.034    3.902    0.000    0.133    0.430
##    .indusW4P1         0.175    0.038    4.631    0.000    0.175    0.525
##  .indusW2P1 ~~                                                          
##    .indusW3P1         0.178    0.037    4.767    0.000    0.178    0.627
##    .indusW4P1         0.186    0.039    4.838    0.000    0.186    0.606
##  .indusW3P1 ~~                                                          
##    .indusW4P1         0.233    0.044    5.296    0.000    0.233    0.713
##  .indusW1P2 ~~                                                          
##    .indusW2P2         0.167    0.037    4.516    0.000    0.167    0.484
##    .indusW3P2         0.163    0.036    4.480    0.000    0.163    0.499
##    .indusW4P2         0.162    0.042    3.851    0.000    0.162    0.501
##  .indusW2P2 ~~                                                          
##    .indusW3P2         0.178    0.041    4.326    0.000    0.178    0.569
##    .indusW4P2         0.194    0.040    4.858    0.000    0.194    0.629
##  .indusW3P2 ~~                                                          
##    .indusW4P2         0.189    0.039    4.815    0.000    0.189    0.646
##  .indusW1S1 ~~                                                          
##    .indusW1S2         0.042    0.034    1.235    0.217    0.042    0.216
##  .indusW1P1 ~~                                                          
##    .indusW1P2         0.118    0.026    4.538    0.000    0.118    0.350
##  .indusW2S1 ~~                                                          
##    .indusW2S2         0.008    0.026    0.299    0.765    0.008    0.049
##  .indusW2P1 ~~                                                          
##    .indusW2P2         0.070    0.022    3.205    0.001    0.070    0.235
##  .indusW3S1 ~~                                                          
##    .indusW3S2         0.020    0.025    0.792    0.428    0.020    0.100
##  .indusW3P1 ~~                                                          
##    .indusW3P2         0.073    0.024    3.069    0.002    0.073    0.243
##  .indusW4S1 ~~                                                          
##    .indusW4S2         0.026    0.026    1.022    0.307    0.026    0.175
##  .indusW4P1 ~~                                                          
##    .indusW4P2         0.031    0.023    1.356    0.175    0.031    0.098
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.325    0.035   96.267    0.000    8.358    8.358
##     slope             0.000    0.001    0.092    0.927    0.020    0.020
##    .indusW1S1         0.000                               0.000    0.000
##    .indusW2S1         0.000                               0.000    0.000
##    .indusW3S1         0.000                               0.000    0.000
##    .indusW4S1         0.000                               0.000    0.000
##    .indusW1S2  (b)   -1.615    0.418   -3.868    0.000   -1.615   -2.157
##    .indusW2S2  (b)   -1.615    0.418   -3.868    0.000   -1.615   -2.281
##    .indusW3S2  (b)   -1.615    0.418   -3.868    0.000   -1.615   -2.211
##    .indusW4S2  (b)   -1.615    0.418   -3.868    0.000   -1.615   -2.287
##    .indusW1P1  (c)    1.432    0.402    3.566    0.000    1.432    2.256
##    .indusW2P1  (c)    1.432    0.402    3.566    0.000    1.432    2.410
##    .indusW3P1  (c)    1.432    0.402    3.566    0.000    1.432    2.303
##    .indusW4P1  (c)    1.432    0.402    3.566    0.000    1.432    2.162
##    .indusW1P2  (d)    1.888    0.466    4.052    0.000    1.888    2.953
##    .indusW2P2  (d)    1.888    0.466    4.052    0.000    1.888    3.081
##    .indusW3P2  (d)    1.888    0.466    4.052    0.000    1.888    3.223
##    .indusW4P2  (d)    1.888    0.466    4.052    0.000    1.888    3.255
##    .indus1            0.000                               0.000    0.000
##    .indus2            0.000                               0.000    0.000
##    .indus3            0.000                               0.000    0.000
##    .indus4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S1         0.180    0.031    5.761    0.000    0.180    0.500
##    .indusW1S2         0.211    0.060    3.540    0.000    0.211    0.376
##    .indusW1P1         0.316    0.038    8.253    0.000    0.316    0.784
##    .indusW1P2         0.361    0.042    8.623    0.000    0.361    0.883
##    .indusW2S1         0.165    0.027    6.073    0.000    0.165    0.483
##    .indusW2S2         0.160    0.054    2.956    0.003    0.160    0.318
##    .indusW2P1         0.268    0.034    7.839    0.000    0.268    0.759
##    .indusW2P2         0.329    0.046    7.199    0.000    0.329    0.875
##    .indusW3S1         0.202    0.030    6.666    0.000    0.202    0.533
##    .indusW3S2         0.191    0.048    3.952    0.000    0.191    0.358
##    .indusW3P1         0.302    0.041    7.431    0.000    0.302    0.780
##    .indusW3P2         0.296    0.038    7.743    0.000    0.296    0.863
##    .indusW4S1         0.146    0.027    5.486    0.000    0.146    0.450
##    .indusW4S2         0.152    0.050    3.019    0.003    0.152    0.304
##    .indusW4P1         0.353    0.051    6.952    0.000    0.353    0.803
##    .indusW4P2         0.289    0.041    6.961    0.000    0.289    0.859
##    .indus1            0.022    0.023    0.944    0.345    0.122    0.122
##    .indus2            0.011    0.018    0.603    0.546    0.061    0.061
##    .indus3           -0.001    0.016   -0.044    0.965   -0.004   -0.004
##    .indus4           -0.012    0.018   -0.647    0.518   -0.065   -0.065
##     interc            0.158    0.027    5.806    0.000    1.000    1.000
##     slope             0.000    0.000    0.617    0.537    1.000    1.000
semPaths(lgmIndus, what = "col", whatLabels = "est", intercepts = T)

LGM Intellect

lgmIntel <- '

# factor at each time point with same loading
intel1 =~ intelW1S1        + a * intelW1S2 + 
           peer * intelW1P1 + aa * intelW1P2

intel2 =~ intelW2S1        + a * intelW2S2 + 
           peer * intelW2P1 + aa * intelW2P2

intel3 =~ intelW3S1        + a * intelW3S2 + 
           peer * intelW3P1 + aa * intelW3P2
  
intel4 =~ intelW4S1        + a * intelW4S2 + 
           peer * intelW4P1 + aa * intelW4P2

# second order factor for intercept and slope
interc =~ 1*intel1 + 1*intel2 + 1*intel3 + 1*intel4
slope =~ 0*intel1 + 6*intel2 + 13*intel3 + 19*intel4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
intelW1S1 ~ 0*1
intelW2S1 ~ 0*1
intelW3S1 ~ 0*1
intelW4S1 ~ 0*1

# fix equal intercepts
intelW1S2 ~ b*1
intelW2S2 ~ b*1
intelW3S2 ~ b*1
intelW4S2 ~ b*1

intelW1P1 ~ c*1
intelW2P1 ~ c*1
intelW3P1 ~ c*1
intelW4P1 ~ c*1

intelW1P2 ~ d*1
intelW2P2 ~ d*1
intelW3P2 ~ d*1
intelW4P2 ~ d*1

# error covariance - similar parcels across waves
intelW1S1 ~~ intelW2S1 + intelW3S1 + intelW4S1
intelW2S1 ~~ intelW3S1 + intelW4S1
intelW3S1 ~~ intelW4S1

intelW1S2 ~~ intelW2S2 + intelW3S2 + intelW4S2
intelW2S2 ~~ intelW3S2 + intelW4S2
intelW3S2 ~~ intelW4S2

intelW1P1 ~~ intelW2P1 + intelW3P1 + intelW4P1
intelW2P1 ~~ intelW3P1 + intelW4P1
intelW3P1 ~~ intelW4P1

intelW1P2 ~~ intelW2P2 + intelW3P2 + intelW4P2
intelW2P2 ~~ intelW3P2 + intelW4P2
intelW3P2 ~~ intelW4P2

# error covariance - same method at one wave
intelW1S1 ~~ intelW1S2
intelW1P1 ~~ intelW1P2
intelW2S1 ~~ intelW2S2
intelW2P1 ~~ intelW2P2
intelW3S1 ~~ intelW3S2
intelW3P1 ~~ intelW3P2
intelW4S1 ~~ intelW4S2
intelW4P1 ~~ intelW4P2
'
lgmIntel <- sem(lgmIntel, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmIntel, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 186 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               238.564
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2029.552
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.922
##   Tucker-Lewis Index (TLI)                       0.894
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1330.312
##   Loglikelihood unrestricted model (H1)      -1211.030
##                                                       
##   Akaike (AIC)                                2786.624
##   Bayesian (BIC)                              3010.704
##   Sample-size adjusted Bayesian (BIC)         2810.971
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.081
##   90 Percent confidence interval - lower         0.068
##   90 Percent confidence interval - upper         0.093
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.172
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   intel1 =~                                                             
##     intW1S1           1.000                               0.437    0.757
##     intW1S2    (a)    1.096    0.108   10.165    0.000    0.479    0.747
##     intW1P1 (peer)    0.576    0.110    5.227    0.000    0.252    0.457
##     intW1P2   (aa)    0.416    0.108    3.856    0.000    0.182    0.332
##   intel2 =~                                                             
##     intW2S1           1.000                               0.407    0.721
##     intW2S2    (a)    1.096    0.108   10.165    0.000    0.446    0.708
##     intW2P1 (peer)    0.576    0.110    5.227    0.000    0.234    0.425
##     intW2P2   (aa)    0.416    0.108    3.856    0.000    0.169    0.356
##   intel3 =~                                                             
##     intW3S1           1.000                               0.406    0.700
##     intW3S2    (a)    1.096    0.108   10.165    0.000    0.446    0.718
##     intW3P1 (peer)    0.576    0.110    5.227    0.000    0.234    0.393
##     intW3P2   (aa)    0.416    0.108    3.856    0.000    0.169    0.292
##   intel4 =~                                                             
##     intW4S1           1.000                               0.365    0.646
##     intW4S2    (a)    1.096    0.108   10.165    0.000    0.400    0.680
##     intW4P1 (peer)    0.576    0.110    5.227    0.000    0.210    0.328
##     intW4P2   (aa)    0.416    0.108    3.856    0.000    0.152    0.297
##   interc =~                                                             
##     intel1            1.000                               0.967    0.967
##     intel2            1.000                               1.039    1.039
##     intel3            1.000                               1.040    1.040
##     intel4            1.000                               1.158    1.158
##   slope =~                                                              
##     intel1            0.000                               0.000    0.000
##     intel2            6.000                               0.014    0.014
##     intel3           13.000                               0.030    0.030
##     intel4           19.000                               0.049    0.049
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.000    0.001   -0.050    0.960   -0.103   -0.103
##  .intelW1S1 ~~                                                          
##    .intelW2S1         0.061    0.019    3.251    0.001    0.061    0.411
##    .intelW3S1         0.060    0.019    3.088    0.002    0.060    0.382
##    .intelW4S1         0.041    0.018    2.244    0.025    0.041    0.255
##  .intelW2S1 ~~                                                          
##    .intelW3S1         0.072    0.020    3.514    0.000    0.072    0.442
##    .intelW4S1         0.043    0.019    2.244    0.025    0.043    0.257
##  .intelW3S1 ~~                                                          
##    .intelW4S1         0.053    0.021    2.585    0.010    0.053    0.297
##  .intelW1S2 ~~                                                          
##    .intelW2S2         0.069    0.023    3.050    0.002    0.069    0.362
##    .intelW3S2         0.049    0.023    2.176    0.030    0.049    0.267
##    .intelW4S2         0.051    0.022    2.322    0.020    0.051    0.278
##  .intelW2S2 ~~                                                          
##    .intelW3S2         0.087    0.025    3.482    0.000    0.087    0.453
##    .intelW4S2         0.075    0.024    3.143    0.002    0.075    0.391
##  .intelW3S2 ~~                                                          
##    .intelW4S2         0.062    0.024    2.599    0.009    0.062    0.335
##  .intelW1P1 ~~                                                          
##    .intelW2P1         0.132    0.029    4.522    0.000    0.132    0.541
##    .intelW3P1         0.187    0.032    5.807    0.000    0.187    0.699
##    .intelW4P1         0.150    0.031    4.784    0.000    0.150    0.505
##  .intelW2P1 ~~                                                          
##    .intelW3P1         0.189    0.035    5.398    0.000    0.189    0.692
##    .intelW4P1         0.153    0.036    4.275    0.000    0.153    0.507
##  .intelW3P1 ~~                                                          
##    .intelW4P1         0.172    0.041    4.192    0.000    0.172    0.520
##  .intelW1P2 ~~                                                          
##    .intelW2P2         0.166    0.025    6.529    0.000    0.166    0.720
##    .intelW3P2         0.181    0.033    5.445    0.000    0.181    0.634
##    .intelW4P2         0.135    0.028    4.798    0.000    0.135    0.535
##  .intelW2P2 ~~                                                          
##    .intelW3P2         0.158    0.030    5.325    0.000    0.158    0.639
##    .intelW4P2         0.126    0.024    5.266    0.000    0.126    0.579
##  .intelW3P2 ~~                                                          
##    .intelW4P2         0.155    0.034    4.620    0.000    0.155    0.576
##  .intelW1S1 ~~                                                          
##    .intelW1S2         0.035    0.023    1.497    0.135    0.035    0.217
##  .intelW1P1 ~~                                                          
##    .intelW1P2         0.058    0.014    4.250    0.000    0.058    0.228
##  .intelW2S1 ~~                                                          
##    .intelW2S2         0.043    0.019    2.345    0.019    0.043    0.250
##  .intelW2P1 ~~                                                          
##    .intelW2P2         0.030    0.013    2.206    0.027    0.030    0.133
##  .intelW3S1 ~~                                                          
##    .intelW3S2         0.028    0.021    1.311    0.190    0.028    0.154
##  .intelW3P1 ~~                                                          
##    .intelW3P2         0.029    0.019    1.522    0.128    0.029    0.096
##  .intelW4S1 ~~                                                          
##    .intelW4S2         0.070    0.033    2.145    0.032    0.070    0.377
##  .intelW4P1 ~~                                                          
##    .intelW4P2         0.123    0.029    4.232    0.000    0.123    0.417
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.686    0.034  107.977    0.000    8.723    8.723
##     slope            -0.001    0.001   -0.475    0.635   -0.650   -0.650
##    .intelW1S1         0.000                               0.000    0.000
##    .intelW2S1         0.000                               0.000    0.000
##    .intelW3S1         0.000                               0.000    0.000
##    .intelW4S1         0.000                               0.000    0.000
##    .intelW1S2  (b)   -0.414    0.398   -1.042    0.298   -0.414   -0.647
##    .intelW2S2  (b)   -0.414    0.398   -1.042    0.298   -0.414   -0.658
##    .intelW3S2  (b)   -0.414    0.398   -1.042    0.298   -0.414   -0.668
##    .intelW4S2  (b)   -0.414    0.398   -1.042    0.298   -0.414   -0.705
##    .intelW1P1  (c)    1.841    0.404    4.552    0.000    1.841    3.346
##    .intelW2P1  (c)    1.841    0.404    4.552    0.000    1.841    3.336
##    .intelW3P1  (c)    1.841    0.404    4.552    0.000    1.841    3.092
##    .intelW4P1  (c)    1.841    0.404    4.552    0.000    1.841    2.873
##    .intelW1P2  (d)    2.461    0.398    6.185    0.000    2.461    4.491
##    .intelW2P2  (d)    2.461    0.398    6.185    0.000    2.461    5.168
##    .intelW3P2  (d)    2.461    0.398    6.185    0.000    2.461    4.252
##    .intelW4P2  (d)    2.461    0.398    6.185    0.000    2.461    4.820
##    .intel1            0.000                               0.000    0.000
##    .intel2            0.000                               0.000    0.000
##    .intel3            0.000                               0.000    0.000
##    .intel4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .intelW1S1         0.142    0.030    4.739    0.000    0.142    0.427
##    .intelW1S2         0.181    0.034    5.281    0.000    0.181    0.442
##    .intelW1P1         0.239    0.030    7.890    0.000    0.239    0.791
##    .intelW1P2         0.267    0.032    8.383    0.000    0.267    0.890
##    .intelW2S1         0.153    0.025    6.206    0.000    0.153    0.480
##    .intelW2S2         0.198    0.034    5.781    0.000    0.198    0.499
##    .intelW2P1         0.250    0.033    7.452    0.000    0.250    0.820
##    .intelW2P2         0.198    0.025    7.998    0.000    0.198    0.874
##    .intelW3S1         0.172    0.031    5.587    0.000    0.172    0.510
##    .intelW3S2         0.186    0.032    5.804    0.000    0.186    0.484
##    .intelW3P1         0.300    0.040    7.412    0.000    0.300    0.845
##    .intelW3P2         0.306    0.041    7.444    0.000    0.306    0.915
##    .intelW4S1         0.186    0.037    5.033    0.000    0.186    0.583
##    .intelW4S2         0.186    0.039    4.770    0.000    0.186    0.537
##    .intelW4P1         0.367    0.048    7.683    0.000    0.367    0.892
##    .intelW4P2         0.238    0.030    8.005    0.000    0.238    0.912
##    .intel1            0.012    0.019    0.634    0.526    0.065    0.065
##    .intel2           -0.013    0.015   -0.862    0.388   -0.076   -0.076
##    .intel3           -0.012    0.017   -0.754    0.451   -0.075   -0.075
##    .intel4           -0.044    0.027   -1.646    0.100   -0.332   -0.332
##     interc            0.179    0.031    5.770    0.000    1.000    1.000
##     slope             0.000    0.000    0.017    0.987    1.000    1.000
semPaths(lgmIntel, what = "col", whatLabels = "est", intercepts = T)

LGM Openness aspect

lgmOpena <- '

# factor at each time point with same loading
opena1 =~ openaW1S1        + a * openaW1S2 + 
           peer * openaW1P1 + aa * openaW1P2

opena2 =~ openaW2S1        + a * openaW2S2 + 
           peer * openaW2P1 + aa * openaW2P2

opena3 =~ openaW3S1        + a * openaW3S2 + 
           peer * openaW3P1 + aa * openaW3P2
  
opena4 =~ openaW4S1        + a * openaW4S2 + 
           peer * openaW4P1 + aa * openaW4P2

# second order factor for intercept and slope
interc =~ 1*opena1 + 1*opena2 + 1*opena3 + 1*opena4
slope =~ 0*opena1 + 6*opena2 + 13*opena3 + 19*opena4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
openaW1S1 ~ 0*1
openaW2S1 ~ 0*1
openaW3S1 ~ 0*1
openaW4S1 ~ 0*1

# fix equal intercepts
openaW1S2 ~ b*1
openaW2S2 ~ b*1
openaW3S2 ~ b*1
openaW4S2 ~ b*1

openaW1P1 ~ c*1
openaW2P1 ~ c*1
openaW3P1 ~ c*1
openaW4P1 ~ c*1

openaW1P2 ~ d*1
openaW2P2 ~ d*1
openaW3P2 ~ d*1
openaW4P2 ~ d*1

# error covariance - similar parcels across waves
openaW1S1 ~~ openaW2S1 + openaW3S1 + openaW4S1
openaW2S1 ~~ openaW3S1 + openaW4S1
openaW3S1 ~~ openaW4S1

openaW1S2 ~~ openaW2S2 + openaW3S2 + openaW4S2
openaW2S2 ~~ openaW3S2 + openaW4S2
openaW3S2 ~~ openaW4S2

openaW1P1 ~~ openaW2P1 + openaW3P1 + openaW4P1
openaW2P1 ~~ openaW3P1 + openaW4P1
openaW3P1 ~~ openaW4P1

openaW1P2 ~~ openaW2P2 + openaW3P2 + openaW4P2
openaW2P2 ~~ openaW3P2 + openaW4P2
openaW3P2 ~~ openaW4P2

# error covariance - same method at one wave
openaW1S1 ~~ openaW1S2
openaW1P1 ~~ openaW1P2
openaW2S1 ~~ openaW2S2
openaW2P1 ~~ openaW2P2
openaW3S1 ~~ openaW3S2
openaW3P1 ~~ openaW3P2
openaW4S1 ~~ openaW4S2
openaW4P1 ~~ openaW4P2
'
lgmOpena <- sem(lgmOpena, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmOpena, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 172 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               170.483
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2368.492
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.964
##   Tucker-Lewis Index (TLI)                       0.951
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1152.281
##   Loglikelihood unrestricted model (H1)      -1067.039
##                                                       
##   Akaike (AIC)                                2430.561
##   Bayesian (BIC)                              2654.642
##   Sample-size adjusted Bayesian (BIC)         2454.909
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.059
##   90 Percent confidence interval - lower         0.046
##   90 Percent confidence interval - upper         0.073
##   P-value RMSEA <= 0.05                          0.122
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.118
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opena1 =~                                                             
##     opnW1S1           1.000                               0.501    0.751
##     opnW1S2    (a)    0.913    0.064   14.259    0.000    0.457    0.780
##     opnW1P1 (peer)    0.632    0.079    8.028    0.000    0.316    0.573
##     opnW1P2   (aa)    0.505    0.078    6.505    0.000    0.253    0.514
##   opena2 =~                                                             
##     opnW2S1           1.000                               0.506    0.770
##     opnW2S2    (a)    0.913    0.064   14.259    0.000    0.462    0.781
##     opnW2P1 (peer)    0.632    0.079    8.028    0.000    0.320    0.577
##     opnW2P2   (aa)    0.505    0.078    6.505    0.000    0.256    0.462
##   opena3 =~                                                             
##     opnW3S1           1.000                               0.499    0.782
##     opnW3S2    (a)    0.913    0.064   14.259    0.000    0.455    0.818
##     opnW3P1 (peer)    0.632    0.079    8.028    0.000    0.315    0.590
##     opnW3P2   (aa)    0.505    0.078    6.505    0.000    0.252    0.487
##   opena4 =~                                                             
##     opnW4S1           1.000                               0.502    0.732
##     opnW4S2    (a)    0.913    0.064   14.259    0.000    0.458    0.759
##     opnW4P1 (peer)    0.632    0.079    8.028    0.000    0.317    0.567
##     opnW4P2   (aa)    0.505    0.078    6.505    0.000    0.254    0.506
##   interc =~                                                             
##     opena1            1.000                               1.004    1.004
##     opena2            1.000                               0.993    0.993
##     opena3            1.000                               1.007    1.007
##     opena4            1.000                               1.001    1.001
##   slope =~                                                              
##     opena1            0.000                               0.000    0.000
##     opena2            6.000                               0.079    0.079
##     opena3           13.000                               0.173    0.173
##     opena4           19.000                               0.252    0.252
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.000    0.001    0.363    0.717    0.097    0.097
##  .openaW1S1 ~~                                                          
##    .openaW2S1         0.108    0.019    5.606    0.000    0.108    0.586
##    .openaW3S1         0.086    0.018    4.880    0.000    0.086    0.491
##    .openaW4S1         0.102    0.020    5.082    0.000    0.102    0.494
##  .openaW2S1 ~~                                                          
##    .openaW3S1         0.086    0.018    4.711    0.000    0.086    0.518
##    .openaW4S1         0.096    0.020    4.684    0.000    0.096    0.489
##  .openaW3S1 ~~                                                          
##    .openaW4S1         0.085    0.020    4.328    0.000    0.085    0.455
##  .openaW1S2 ~~                                                          
##    .openaW2S2         0.035    0.015    2.297    0.022    0.035    0.258
##    .openaW3S2         0.038    0.014    2.681    0.007    0.038    0.320
##    .openaW4S2         0.040    0.016    2.442    0.015    0.040    0.274
##  .openaW2S2 ~~                                                          
##    .openaW3S2         0.052    0.015    3.507    0.000    0.052    0.442
##    .openaW4S2         0.051    0.017    2.983    0.003    0.051    0.352
##  .openaW3S2 ~~                                                          
##    .openaW4S2         0.051    0.016    3.204    0.001    0.051    0.409
##  .openaW1P1 ~~                                                          
##    .openaW2P1         0.092    0.022    4.274    0.000    0.092    0.451
##    .openaW3P1         0.094    0.022    4.263    0.000    0.094    0.479
##    .openaW4P1         0.022    0.027    0.813    0.416    0.022    0.105
##  .openaW2P1 ~~                                                          
##    .openaW3P1         0.128    0.025    5.102    0.000    0.128    0.656
##    .openaW4P1         0.075    0.029    2.579    0.010    0.075    0.358
##  .openaW3P1 ~~                                                          
##    .openaW4P1         0.101    0.030    3.335    0.001    0.101    0.508
##  .openaW1P2 ~~                                                          
##    .openaW2P2         0.122    0.022    5.598    0.000    0.122    0.588
##    .openaW3P2         0.089    0.022    4.030    0.000    0.089    0.469
##    .openaW4P2         0.106    0.021    5.018    0.000    0.106    0.582
##  .openaW2P2 ~~                                                          
##    .openaW3P2         0.138    0.027    5.140    0.000    0.138    0.620
##    .openaW4P2         0.126    0.027    4.719    0.000    0.126    0.594
##  .openaW3P2 ~~                                                          
##    .openaW4P2         0.130    0.029    4.415    0.000    0.130    0.663
##  .openaW1S1 ~~                                                          
##    .openaW1S2         0.040    0.017    2.430    0.015    0.040    0.250
##  .openaW1P1 ~~                                                          
##    .openaW1P2         0.050    0.013    3.714    0.000    0.050    0.260
##  .openaW2S1 ~~                                                          
##    .openaW2S2         0.036    0.016    2.213    0.027    0.036    0.234
##  .openaW2P1 ~~                                                          
##    .openaW2P2         0.033    0.014    2.301    0.021    0.033    0.148
##  .openaW3S1 ~~                                                          
##    .openaW3S2         0.031    0.013    2.384    0.017    0.031    0.241
##  .openaW3P1 ~~                                                          
##    .openaW3P2         0.027    0.012    2.156    0.031    0.027    0.137
##  .openaW4S1 ~~                                                          
##    .openaW4S2         0.062    0.023    2.693    0.007    0.062    0.338
##  .openaW4P1 ~~                                                          
##    .openaW4P2         0.047    0.022    2.111    0.035    0.047    0.237
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.840    0.040   96.496    0.000    7.643    7.643
##     slope             0.000    0.001    0.165    0.869    0.033    0.033
##    .openaW1S1         0.000                               0.000    0.000
##    .openaW2S1         0.000                               0.000    0.000
##    .openaW3S1         0.000                               0.000    0.000
##    .openaW4S1         0.000                               0.000    0.000
##    .openaW1S2  (b)    0.401    0.247    1.619    0.105    0.401    0.684
##    .openaW2S2  (b)    0.401    0.247    1.619    0.105    0.401    0.678
##    .openaW3S2  (b)    0.401    0.247    1.619    0.105    0.401    0.720
##    .openaW4S2  (b)    0.401    0.247    1.619    0.105    0.401    0.664
##    .openaW1P1  (c)    1.386    0.305    4.545    0.000    1.386    2.509
##    .openaW2P1  (c)    1.386    0.305    4.545    0.000    1.386    2.501
##    .openaW3P1  (c)    1.386    0.305    4.545    0.000    1.386    2.593
##    .openaW4P1  (c)    1.386    0.305    4.545    0.000    1.386    2.476
##    .openaW1P2  (d)    1.707    0.300    5.686    0.000    1.707    3.467
##    .openaW2P2  (d)    1.707    0.300    5.686    0.000    1.707    3.082
##    .openaW3P2  (d)    1.707    0.300    5.686    0.000    1.707    3.300
##    .openaW4P2  (d)    1.707    0.300    5.686    0.000    1.707    3.405
##    .opena1            0.000                               0.000    0.000
##    .opena2            0.000                               0.000    0.000
##    .opena3            0.000                               0.000    0.000
##    .opena4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .openaW1S1         0.194    0.027    7.288    0.000    0.194    0.436
##    .openaW1S2         0.135    0.023    5.893    0.000    0.135    0.392
##    .openaW1P1         0.205    0.026    7.919    0.000    0.205    0.672
##    .openaW1P2         0.178    0.021    8.310    0.000    0.178    0.736
##    .openaW2S1         0.175    0.027    6.407    0.000    0.175    0.407
##    .openaW2S2         0.136    0.024    5.787    0.000    0.136    0.390
##    .openaW2P1         0.205    0.028    7.249    0.000    0.205    0.667
##    .openaW2P2         0.241    0.030    8.065    0.000    0.241    0.787
##    .openaW3S1         0.158    0.023    6.832    0.000    0.158    0.388
##    .openaW3S2         0.103    0.018    5.569    0.000    0.103    0.331
##    .openaW3P1         0.186    0.027    7.002    0.000    0.186    0.652
##    .openaW3P2         0.204    0.030    6.795    0.000    0.204    0.763
##    .openaW4S1         0.218    0.035    6.166    0.000    0.218    0.464
##    .openaW4S2         0.154    0.028    5.556    0.000    0.154    0.424
##    .openaW4P1         0.213    0.033    6.491    0.000    0.213    0.679
##    .openaW4P2         0.187    0.027    6.885    0.000    0.187    0.744
##    .opena1           -0.002    0.017   -0.103    0.918   -0.007   -0.007
##    .opena2           -0.002    0.015   -0.125    0.901   -0.008   -0.008
##    .opena3           -0.019    0.012   -1.649    0.099   -0.078   -0.078
##    .opena4           -0.029    0.022   -1.321    0.187   -0.115   -0.115
##     interc            0.252    0.037    6.759    0.000    1.000    1.000
##     slope             0.000    0.000    0.880    0.379    1.000    1.000
semPaths(lgmOpena, what = "col", whatLabels = "est", intercepts = T)

LGM Orderliness

lgmOrder <- '

# factor at each time point with same loading
order1 =~ orderW1S1        + a * orderW1S2 + 
           peer * orderW1P1 + aa * orderW1P2

order2 =~ orderW2S1        + a * orderW2S2 + 
           peer * orderW2P1 + aa * orderW2P2

order3 =~ orderW3S1        + a * orderW3S2 + 
           peer * orderW3P1 + aa * orderW3P2
  
order4 =~ orderW4S1        + a * orderW4S2 + 
           peer * orderW4P1 + aa * orderW4P2

# second order factor for intercept and slope
interc =~ 1*order1 + 1*order2 + 1*order3 + 1*order4
slope =~ 0*order1 + 6*order2 + 13*order3 + 19*order4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
orderW1S1 ~ 0*1
orderW2S1 ~ 0*1
orderW3S1 ~ 0*1
orderW4S1 ~ 0*1

# fix equal intercepts
orderW1S2 ~ b*1
orderW2S2 ~ b*1
orderW3S2 ~ b*1
orderW4S2 ~ b*1

orderW1P1 ~ c*1
orderW2P1 ~ c*1
orderW3P1 ~ c*1
orderW4P1 ~ c*1

orderW1P2 ~ d*1
orderW2P2 ~ d*1
orderW3P2 ~ d*1
orderW4P2 ~ d*1

# error covariance - similar parcels across waves
orderW1S1 ~~ orderW2S1 + orderW3S1 + orderW4S1
orderW2S1 ~~ orderW3S1 + orderW4S1
orderW3S1 ~~ orderW4S1

orderW1S2 ~~ orderW2S2 + orderW3S2 + orderW4S2
orderW2S2 ~~ orderW3S2 + orderW4S2
orderW3S2 ~~ orderW4S2

orderW1P1 ~~ orderW2P1 + orderW3P1 + orderW4P1
orderW2P1 ~~ orderW3P1 + orderW4P1
orderW3P1 ~~ orderW4P1

orderW1P2 ~~ orderW2P2 + orderW3P2 + orderW4P2
orderW2P2 ~~ orderW3P2 + orderW4P2
orderW3P2 ~~ orderW4P2

# error covariance - same method at one wave
orderW1S1 ~~ orderW1S2
orderW1P1 ~~ orderW1P2
orderW2S1 ~~ orderW2S2
orderW2P1 ~~ orderW2P2
orderW3S1 ~~ orderW3S2
orderW3P1 ~~ orderW3P2
orderW4S1 ~~ orderW4S2
orderW4P1 ~~ orderW4P2
'
lgmOrder <- sem(lgmOrder, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmOrder, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 149 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               177.467
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2131.446
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.956
##   Tucker-Lewis Index (TLI)                       0.941
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1607.660
##   Loglikelihood unrestricted model (H1)      -1518.927
##                                                       
##   Akaike (AIC)                                3341.321
##   Bayesian (BIC)                              3565.401
##   Sample-size adjusted Bayesian (BIC)         3365.668
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.062
##   90 Percent confidence interval - lower         0.049
##   90 Percent confidence interval - upper         0.075
##   P-value RMSEA <= 0.05                          0.070
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.110
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   order1 =~                                                             
##     ordW1S1           1.000                               0.534    0.761
##     ordW1S2    (a)    0.782    0.053   14.783    0.000    0.417    0.656
##     ordW1P1 (peer)    0.788    0.096    8.206    0.000    0.421    0.577
##     ordW1P2   (aa)    0.565    0.076    7.407    0.000    0.301    0.494
##   order2 =~                                                             
##     ordW2S1           1.000                               0.538    0.799
##     ordW2S2    (a)    0.782    0.053   14.783    0.000    0.421    0.691
##     ordW2P1 (peer)    0.788    0.096    8.206    0.000    0.424    0.624
##     ordW2P2   (aa)    0.565    0.076    7.407    0.000    0.304    0.558
##   order3 =~                                                             
##     ordW3S1           1.000                               0.524    0.777
##     ordW3S2    (a)    0.782    0.053   14.783    0.000    0.410    0.693
##     ordW3P1 (peer)    0.788    0.096    8.206    0.000    0.413    0.545
##     ordW3P2   (aa)    0.565    0.076    7.407    0.000    0.296    0.527
##   order4 =~                                                             
##     ordW4S1           1.000                               0.587    0.822
##     ordW4S2    (a)    0.782    0.053   14.783    0.000    0.459    0.732
##     ordW4P1 (peer)    0.788    0.096    8.206    0.000    0.463    0.606
##     ordW4P2   (aa)    0.565    0.076    7.407    0.000    0.332    0.565
##   interc =~                                                             
##     order1            1.000                               1.013    1.013
##     order2            1.000                               1.005    1.005
##     order3            1.000                               1.031    1.031
##     order4            1.000                               0.920    0.920
##   slope =~                                                              
##     order1            0.000                               0.000    0.000
##     order2            6.000                               0.101    0.101
##     order3           13.000                               0.225    0.225
##     order4           19.000                               0.294    0.294
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.000    0.001    0.336    0.737    0.089    0.089
##  .orderW1S1 ~~                                                          
##    .orderW2S1         0.001    0.022    0.049    0.961    0.001    0.006
##    .orderW3S1         0.029    0.021    1.353    0.176    0.029    0.149
##    .orderW4S1         0.006    0.023    0.260    0.795    0.006    0.032
##  .orderW2S1 ~~                                                          
##    .orderW3S1         0.032    0.023    1.379    0.168    0.032    0.183
##    .orderW4S1        -0.003    0.023   -0.122    0.903   -0.003   -0.017
##  .orderW3S1 ~~                                                          
##    .orderW4S1         0.037    0.024    1.540    0.124    0.037    0.216
##  .orderW1S2 ~~                                                          
##    .orderW2S2         0.089    0.016    5.399    0.000    0.089    0.420
##    .orderW3S2         0.060    0.015    3.892    0.000    0.060    0.291
##    .orderW4S2         0.061    0.017    3.617    0.000    0.061    0.296
##  .orderW2S2 ~~                                                          
##    .orderW3S2         0.073    0.016    4.432    0.000    0.073    0.388
##    .orderW4S2         0.075    0.018    4.275    0.000    0.075    0.402
##  .orderW3S2 ~~                                                          
##    .orderW4S2         0.081    0.016    4.917    0.000    0.081    0.444
##  .orderW1P1 ~~                                                          
##    .orderW2P1         0.150    0.037    4.091    0.000    0.150    0.473
##    .orderW3P1         0.176    0.045    3.924    0.000    0.176    0.464
##    .orderW4P1         0.182    0.042    4.353    0.000    0.182    0.504
##  .orderW2P1 ~~                                                          
##    .orderW3P1         0.205    0.041    5.024    0.000    0.205    0.607
##    .orderW4P1         0.203    0.038    5.325    0.000    0.203    0.628
##  .orderW3P1 ~~                                                          
##    .orderW4P1         0.262    0.047    5.576    0.000    0.262    0.680
##  .orderW1P2 ~~                                                          
##    .orderW2P2         0.124    0.027    4.628    0.000    0.124    0.520
##    .orderW3P2         0.123    0.029    4.239    0.000    0.123    0.485
##    .orderW4P2         0.087    0.028    3.129    0.002    0.087    0.340
##  .orderW2P2 ~~                                                          
##    .orderW3P2         0.124    0.026    4.802    0.000    0.124    0.575
##    .orderW4P2         0.102    0.025    4.015    0.000    0.102    0.467
##  .orderW3P2 ~~                                                          
##    .orderW4P2         0.080    0.030    2.707    0.007    0.080    0.347
##  .orderW1S1 ~~                                                          
##    .orderW1S2         0.088    0.023    3.767    0.000    0.088    0.404
##  .orderW1P1 ~~                                                          
##    .orderW1P2         0.088    0.026    3.428    0.001    0.088    0.278
##  .orderW2S1 ~~                                                          
##    .orderW2S2         0.010    0.016    0.604    0.546    0.010    0.055
##  .orderW2P1 ~~                                                          
##    .orderW2P2         0.036    0.016    2.340    0.019    0.036    0.152
##  .orderW3S1 ~~                                                          
##    .orderW3S2         0.043    0.017    2.554    0.011    0.043    0.240
##  .orderW3P1 ~~                                                          
##    .orderW3P2         0.071    0.023    3.130    0.002    0.071    0.233
##  .orderW4S1 ~~                                                          
##    .orderW4S2         0.056    0.030    1.861    0.063    0.056    0.320
##  .orderW4P1 ~~                                                          
##    .orderW4P2         0.103    0.029    3.536    0.000    0.103    0.351
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.450    0.040   85.745    0.000    6.383    6.383
##     slope             0.002    0.002    0.959    0.338    0.195    0.195
##    .orderW1S1         0.000                               0.000    0.000
##    .orderW2S1         0.000                               0.000    0.000
##    .orderW3S1         0.000                               0.000    0.000
##    .orderW4S1         0.000                               0.000    0.000
##    .orderW1S2  (b)    1.053    0.185    5.697    0.000    1.053    1.656
##    .orderW2S2  (b)    1.053    0.185    5.697    0.000    1.053    1.730
##    .orderW3S2  (b)    1.053    0.185    5.697    0.000    1.053    1.780
##    .orderW4S2  (b)    1.053    0.185    5.697    0.000    1.053    1.679
##    .orderW1P1  (c)    0.552    0.336    1.643    0.100    0.552    0.756
##    .orderW2P1  (c)    0.552    0.336    1.643    0.100    0.552    0.811
##    .orderW3P1  (c)    0.552    0.336    1.643    0.100    0.552    0.727
##    .orderW4P1  (c)    0.552    0.336    1.643    0.100    0.552    0.722
##    .orderW1P2  (d)    1.553    0.266    5.839    0.000    1.553    2.546
##    .orderW2P2  (d)    1.553    0.266    5.839    0.000    1.553    2.853
##    .orderW3P2  (d)    1.553    0.266    5.839    0.000    1.553    2.765
##    .orderW4P2  (d)    1.553    0.266    5.839    0.000    1.553    2.643
##    .order1            0.000                               0.000    0.000
##    .order2            0.000                               0.000    0.000
##    .order3            0.000                               0.000    0.000
##    .order4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .orderW1S1         0.208    0.036    5.689    0.000    0.208    0.421
##    .orderW1S2         0.230    0.026    8.886    0.000    0.230    0.570
##    .orderW1P1         0.355    0.044    8.141    0.000    0.355    0.667
##    .orderW1P2         0.281    0.033    8.400    0.000    0.281    0.756
##    .orderW2S1         0.164    0.031    5.357    0.000    0.164    0.362
##    .orderW2S2         0.193    0.023    8.255    0.000    0.193    0.522
##    .orderW2P1         0.282    0.039    7.326    0.000    0.282    0.611
##    .orderW2P2         0.204    0.028    7.201    0.000    0.204    0.688
##    .orderW3S1         0.181    0.030    6.062    0.000    0.181    0.396
##    .orderW3S2         0.182    0.022    8.392    0.000    0.182    0.520
##    .orderW3P1         0.404    0.052    7.767    0.000    0.404    0.703
##    .orderW3P2         0.228    0.030    7.653    0.000    0.228    0.722
##    .orderW4S1         0.166    0.047    3.528    0.000    0.166    0.325
##    .orderW4S2         0.182    0.031    5.966    0.000    0.182    0.464
##    .orderW4P1         0.369    0.051    7.276    0.000    0.369    0.632
##    .orderW4P2         0.235    0.034    6.890    0.000    0.235    0.681
##    .order1           -0.007    0.024   -0.298    0.765   -0.025   -0.025
##    .order2           -0.011    0.015   -0.734    0.463   -0.037   -0.037
##    .order3           -0.042    0.016   -2.580    0.010   -0.154   -0.154
##    .order4            0.006    0.034    0.190    0.849    0.019    0.019
##     interc            0.292    0.040    7.253    0.000    1.000    1.000
##     slope             0.000    0.000    0.913    0.361    1.000    1.000
semPaths(lgmOrder, what = "col", whatLabels = "est", intercepts = T)

LGM Politeness

lgmPolit <- '

# factor at each time point with same loading
polit1 =~ politW1S1        + a * politW1S2 + 
           peer * politW1P1 + aa * politW1P2

polit2 =~ politW2S1        + a * politW2S2 + 
           peer * politW2P1 + aa * politW2P2

polit3 =~ politW3S1        + a * politW3S2 + 
           peer * politW3P1 + aa * politW3P2
  
polit4 =~ politW4S1        + a * politW4S2 + 
           peer * politW4P1 + aa * politW4P2

# second polit factor for intercept and slope
interc =~ 1*polit1 + 1*polit2 + 1*polit3 + 1*polit4
slope =~ 0*polit1 + 6*polit2 + 13*polit3 + 19*polit4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
politW1S1 ~ 0*1
politW2S1 ~ 0*1
politW3S1 ~ 0*1
politW4S1 ~ 0*1

# fix equal intercepts
politW1S2 ~ b*1
politW2S2 ~ b*1
politW3S2 ~ b*1
politW4S2 ~ b*1

politW1P1 ~ c*1
politW2P1 ~ c*1
politW3P1 ~ c*1
politW4P1 ~ c*1

politW1P2 ~ d*1
politW2P2 ~ d*1
politW3P2 ~ d*1
politW4P2 ~ d*1

# error covariance - similar parcels across waves
politW1S1 ~~ politW2S1 + politW3S1 + politW4S1
politW2S1 ~~ politW3S1 + politW4S1
politW3S1 ~~ politW4S1

politW1S2 ~~ politW2S2 + politW3S2 + politW4S2
politW2S2 ~~ politW3S2 + politW4S2
politW3S2 ~~ politW4S2

politW1P1 ~~ politW2P1 + politW3P1 + politW4P1
politW2P1 ~~ politW3P1 + politW4P1
politW3P1 ~~ politW4P1

politW1P2 ~~ politW2P2 + politW3P2 + politW4P2
politW2P2 ~~ politW3P2 + politW4P2
politW3P2 ~~ politW4P2

# error covariance - same method at one wave
politW1S1 ~~ politW1S2
politW1P1 ~~ politW1P2
politW2S1 ~~ politW2S2
politW2P1 ~~ politW2P2
politW3S1 ~~ politW3S2
politW3P1 ~~ politW3P2
politW4S1 ~~ politW4S2
politW4P1 ~~ politW4P2
'
lgmPolit <- sem(lgmPolit, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmPolit, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 158 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               170.613
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1979.092
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.956
##   Tucker-Lewis Index (TLI)                       0.941
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1509.512
##   Loglikelihood unrestricted model (H1)      -1424.206
##                                                       
##   Akaike (AIC)                                3145.025
##   Bayesian (BIC)                              3369.105
##   Sample-size adjusted Bayesian (BIC)         3169.372
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.060
##   90 Percent confidence interval - lower         0.046
##   90 Percent confidence interval - upper         0.073
##   P-value RMSEA <= 0.05                          0.120
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.095
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   polit1 =~                                                             
##     pltW1S1           1.000                               0.392    0.603
##     pltW1S2    (a)    0.851    0.093    9.178    0.000    0.334    0.584
##     pltW1P1 (peer)    1.110    0.126    8.807    0.000    0.435    0.699
##     pltW1P2   (aa)    1.273    0.142    8.980    0.000    0.500    0.786
##   polit2 =~                                                             
##     pltW2S1           1.000                               0.391    0.587
##     pltW2S2    (a)    0.851    0.093    9.178    0.000    0.333    0.581
##     pltW2P1 (peer)    1.110    0.126    8.807    0.000    0.434    0.707
##     pltW2P2   (aa)    1.273    0.142    8.980    0.000    0.498    0.774
##   polit3 =~                                                             
##     pltW3S1           1.000                               0.411    0.622
##     pltW3S2    (a)    0.851    0.093    9.178    0.000    0.350    0.580
##     pltW3P1 (peer)    1.110    0.126    8.807    0.000    0.456    0.697
##     pltW3P2   (aa)    1.273    0.142    8.980    0.000    0.524    0.783
##   polit4 =~                                                             
##     pltW4S1           1.000                               0.441    0.702
##     pltW4S2    (a)    0.851    0.093    9.178    0.000    0.375    0.593
##     pltW4P1 (peer)    1.110    0.126    8.807    0.000    0.489    0.792
##     pltW4P2   (aa)    1.273    0.142    8.980    0.000    0.561    0.758
##   interc =~                                                             
##     polit1            1.000                               0.980    0.980
##     polit2            1.000                               0.983    0.983
##     polit3            1.000                               0.935    0.935
##     polit4            1.000                               0.873    0.873
##   slope =~                                                              
##     polit1            0.000                               0.000    0.000
##     polit2            6.000                               0.172    0.172
##     polit3           13.000                               0.354    0.354
##     polit4           19.000                               0.484    0.484
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope             0.000    0.001    0.492    0.623    0.086    0.086
##  .politW1S1 ~~                                                          
##    .politW2S1         0.189    0.027    7.088    0.000    0.189    0.676
##    .politW3S1         0.160    0.025    6.338    0.000    0.160    0.594
##    .politW4S1         0.137    0.024    5.779    0.000    0.137    0.590
##  .politW2S1 ~~                                                          
##    .politW3S1         0.194    0.029    6.661    0.000    0.194    0.692
##    .politW4S1         0.144    0.027    5.340    0.000    0.144    0.596
##  .politW3S1 ~~                                                          
##    .politW4S1         0.142    0.028    5.102    0.000    0.142    0.614
##  .politW1S2 ~~                                                          
##    .politW2S2         0.089    0.020    4.405    0.000    0.089    0.409
##    .politW3S2         0.102    0.020    5.029    0.000    0.102    0.449
##    .politW4S2         0.093    0.023    4.051    0.000    0.093    0.392
##  .politW2S2 ~~                                                          
##    .politW3S2         0.127    0.023    5.525    0.000    0.127    0.554
##    .politW4S2         0.131    0.025    5.236    0.000    0.131    0.550
##  .politW3S2 ~~                                                          
##    .politW4S2         0.158    0.028    5.743    0.000    0.158    0.633
##  .politW1P1 ~~                                                          
##    .politW2P1         0.077    0.019    4.071    0.000    0.077    0.399
##    .politW3P1         0.064    0.018    3.545    0.000    0.064    0.306
##    .politW4P1         0.069    0.021    3.326    0.001    0.069    0.408
##  .politW2P1 ~~                                                          
##    .politW3P1         0.051    0.018    2.816    0.005    0.051    0.250
##    .politW4P1         0.063    0.022    2.843    0.004    0.063    0.387
##  .politW3P1 ~~                                                          
##    .politW4P1         0.041    0.020    2.003    0.045    0.041    0.230
##  .politW1P2 ~~                                                          
##    .politW2P2         0.005    0.021    0.254    0.799    0.005    0.033
##    .politW3P2        -0.005    0.018   -0.282    0.778   -0.005   -0.031
##    .politW4P2        -0.004    0.032   -0.135    0.893   -0.004   -0.023
##  .politW2P2 ~~                                                          
##    .politW3P2         0.032    0.020    1.594    0.111    0.032    0.189
##    .politW4P2         0.049    0.027    1.829    0.067    0.049    0.247
##  .politW3P2 ~~                                                          
##    .politW4P2         0.075    0.026    2.906    0.004    0.075    0.374
##  .politW1S1 ~~                                                          
##    .politW1S2         0.043    0.014    3.064    0.002    0.043    0.178
##  .politW1P1 ~~                                                          
##    .politW1P2         0.069    0.023    3.007    0.003    0.069    0.392
##  .politW2S1 ~~                                                          
##    .politW2S2         0.023    0.013    1.832    0.067    0.023    0.091
##  .politW2P1 ~~                                                          
##    .politW2P2         0.043    0.022    1.966    0.049    0.043    0.241
##  .politW3S1 ~~                                                          
##    .politW3S2         0.034    0.013    2.563    0.010    0.034    0.135
##  .politW3P1 ~~                                                          
##    .politW3P2         0.098    0.027    3.702    0.000    0.098    0.502
##  .politW4S1 ~~                                                          
##    .politW4S2         0.008    0.016    0.505    0.613    0.008    0.036
##  .politW4P1 ~~                                                          
##    .politW4P2         0.041    0.029    1.416    0.157    0.041    0.225
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.829    0.039   98.639    0.000    9.955    9.955
##     slope             0.001    0.001    0.491    0.623    0.062    0.062
##    .politW1S1         0.000                               0.000    0.000
##    .politW2S1         0.000                               0.000    0.000
##    .politW3S1         0.000                               0.000    0.000
##    .politW4S1         0.000                               0.000    0.000
##    .politW1S2  (b)    0.362    0.357    1.013    0.311    0.362    0.633
##    .politW2S2  (b)    0.362    0.357    1.013    0.311    0.362    0.631
##    .politW3S2  (b)    0.362    0.357    1.013    0.311    0.362    0.599
##    .politW4S2  (b)    0.362    0.357    1.013    0.311    0.362    0.572
##    .politW1P1  (c)   -0.638    0.486   -1.312    0.189   -0.638   -1.024
##    .politW2P1  (c)   -0.638    0.486   -1.312    0.189   -0.638   -1.040
##    .politW3P1  (c)   -0.638    0.486   -1.312    0.189   -0.638   -0.974
##    .politW4P1  (c)   -0.638    0.486   -1.312    0.189   -0.638   -1.034
##    .politW1P2  (d)   -0.905    0.546   -1.656    0.098   -0.905   -1.425
##    .politW2P2  (d)   -0.905    0.546   -1.656    0.098   -0.905   -1.407
##    .politW3P2  (d)   -0.905    0.546   -1.656    0.098   -0.905   -1.354
##    .politW4P2  (d)   -0.905    0.546   -1.656    0.098   -0.905   -1.223
##    .polit1            0.000                               0.000    0.000
##    .polit2            0.000                               0.000    0.000
##    .polit3            0.000                               0.000    0.000
##    .polit4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .politW1S1         0.270    0.029    9.363    0.000    0.270    0.636
##    .politW1S2         0.215    0.024    9.072    0.000    0.215    0.658
##    .politW1P1         0.199    0.030    6.669    0.000    0.199    0.512
##    .politW1P2         0.154    0.032    4.883    0.000    0.154    0.381
##    .politW2S1         0.292    0.034    8.664    0.000    0.292    0.656
##    .politW2S2         0.218    0.026    8.444    0.000    0.218    0.663
##    .politW2P1         0.188    0.029    6.520    0.000    0.188    0.500
##    .politW2P2         0.166    0.032    5.217    0.000    0.166    0.401
##    .politW3S1         0.268    0.032    8.426    0.000    0.268    0.613
##    .politW3S2         0.242    0.028    8.631    0.000    0.242    0.664
##    .politW3P1         0.221    0.033    6.662    0.000    0.221    0.515
##    .politW3P2         0.173    0.033    5.164    0.000    0.173    0.386
##    .politW4S1         0.200    0.031    6.428    0.000    0.200    0.507
##    .politW4S2         0.259    0.034    7.546    0.000    0.259    0.649
##    .politW4P1         0.142    0.032    4.434    0.000    0.142    0.372
##    .politW4P2         0.233    0.050    4.629    0.000    0.233    0.426
##    .polit1            0.006    0.012    0.511    0.609    0.039    0.039
##    .polit2           -0.004    0.010   -0.406    0.685   -0.025   -0.025
##    .polit3           -0.010    0.010   -0.911    0.362   -0.056   -0.056
##    .polit4           -0.013    0.016   -0.819    0.413   -0.068   -0.068
##     interc            0.148    0.030    4.912    0.000    1.000    1.000
##     slope             0.000    0.000    2.219    0.026    1.000    1.000
semPaths(lgmPolit, what = "col", whatLabels = "est", intercepts = T)

LGM Volatility

lgmVolat <- '

# factor at each time point with same loading
volat1 =~ volatW1S1        + a * volatW1S2 + 
           peer * volatW1P1 + aa * volatW1P2

volat2 =~ volatW2S1        + a * volatW2S2 + 
           peer * volatW2P1 + aa * volatW2P2

volat3 =~ volatW3S1        + a * volatW3S2 + 
           peer * volatW3P1 + aa * volatW3P2
  
volat4 =~ volatW4S1        + a * volatW4S2 + 
           peer * volatW4P1 + aa * volatW4P2

# second volat factor for intercept and slope
interc =~ 1*volat1 + 1*volat2 + 1*volat3 + 1*volat4
slope =~ 0*volat1 + 6*volat2 + 13*volat3 + 19*volat4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
volatW1S1 ~ 0*1
volatW2S1 ~ 0*1
volatW3S1 ~ 0*1
volatW4S1 ~ 0*1

# fix equal intercepts
volatW1S2 ~ b*1
volatW2S2 ~ b*1
volatW3S2 ~ b*1
volatW4S2 ~ b*1

volatW1P1 ~ c*1
volatW2P1 ~ c*1
volatW3P1 ~ c*1
volatW4P1 ~ c*1

volatW1P2 ~ d*1
volatW2P2 ~ d*1
volatW3P2 ~ d*1
volatW4P2 ~ d*1

# error covariance - similar parcels across waves
volatW1S1 ~~ volatW2S1 + volatW3S1 + volatW4S1
volatW2S1 ~~ volatW3S1 + volatW4S1
volatW3S1 ~~ volatW4S1

volatW1S2 ~~ volatW2S2 + volatW3S2 + volatW4S2
volatW2S2 ~~ volatW3S2 + volatW4S2
volatW3S2 ~~ volatW4S2

volatW1P1 ~~ volatW2P1 + volatW3P1 + volatW4P1
volatW2P1 ~~ volatW3P1 + volatW4P1
volatW3P1 ~~ volatW4P1

volatW1P2 ~~ volatW2P2 + volatW3P2 + volatW4P2
volatW2P2 ~~ volatW3P2 + volatW4P2
volatW3P2 ~~ volatW4P2

# error covariance - same method at one wave
volatW1S1 ~~ volatW1S2
volatW1P1 ~~ volatW1P2
volatW2S1 ~~ volatW2S2
volatW2P1 ~~ volatW2P2
volatW3S1 ~~ volatW3S2
volatW3P1 ~~ volatW3P2
volatW4S1 ~~ volatW4S2
volatW4P1 ~~ volatW4P2
'
lgmVolat <- sem(lgmVolat, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmVolat, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 143 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               342.462
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2829.311
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.906
##   Tucker-Lewis Index (TLI)                       0.874
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1825.531
##   Loglikelihood unrestricted model (H1)      -1654.300
##                                                       
##   Akaike (AIC)                                3777.062
##   Bayesian (BIC)                              4001.142
##   Sample-size adjusted Bayesian (BIC)         3801.409
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.105
##   90 Percent confidence interval - lower         0.093
##   90 Percent confidence interval - upper         0.117
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.192
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   volat1 =~                                                             
##     vltW1S1           1.000                               0.656    0.754
##     vltW1S2    (a)    0.877    0.039   22.529    0.000    0.575    0.732
##     vltW1P1 (peer)    0.621    0.062   10.084    0.000    0.407    0.502
##     vltW1P2   (aa)    0.622    0.062   10.033    0.000    0.408    0.503
##   volat2 =~                                                             
##     vltW2S1           1.000                               0.672    0.806
##     vltW2S2    (a)    0.877    0.039   22.529    0.000    0.589    0.800
##     vltW2P1 (peer)    0.621    0.062   10.084    0.000    0.417    0.576
##     vltW2P2   (aa)    0.622    0.062   10.033    0.000    0.418    0.573
##   volat3 =~                                                             
##     vltW3S1           1.000                               0.592    0.758
##     vltW3S2    (a)    0.877    0.039   22.529    0.000    0.519    0.695
##     vltW3P1 (peer)    0.621    0.062   10.084    0.000    0.367    0.433
##     vltW3P2   (aa)    0.622    0.062   10.033    0.000    0.368    0.481
##   volat4 =~                                                             
##     vltW4S1           1.000                               0.565    0.643
##     vltW4S2    (a)    0.877    0.039   22.529    0.000    0.495    0.643
##     vltW4P1 (peer)    0.621    0.062   10.084    0.000    0.350    0.468
##     vltW4P2   (aa)    0.622    0.062   10.033    0.000    0.351    0.471
##   interc =~                                                             
##     volat1            1.000                               1.102    1.102
##     volat2            1.000                               1.076    1.076
##     volat3            1.000                               1.220    1.220
##     volat4            1.000                               1.280    1.280
##   slope =~                                                              
##     volat1            0.000                               0.000    0.000
##     volat2            6.000                               0.114    0.114
##     volat3           13.000                               0.280    0.280
##     volat4           19.000                               0.429    0.429
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.002    0.002   -1.321    0.186   -0.258   -0.258
##  .volatW1S1 ~~                                                          
##    .volatW2S1         0.032    0.021    1.517    0.129    0.032    0.113
##    .volatW3S1         0.000    0.018    0.025    0.980    0.000    0.002
##    .volatW4S1         0.039    0.024    1.632    0.103    0.039    0.101
##  .volatW2S1 ~~                                                          
##    .volatW3S1         0.033    0.019    1.744    0.081    0.033    0.129
##    .volatW4S1         0.018    0.024    0.759    0.448    0.018    0.054
##  .volatW3S1 ~~                                                          
##    .volatW4S1         0.024    0.021    1.119    0.263    0.024    0.070
##  .volatW1S2 ~~                                                          
##    .volatW2S2         0.043    0.017    2.614    0.009    0.043    0.183
##    .volatW3S2         0.059    0.017    3.566    0.000    0.059    0.205
##    .volatW4S2         0.033    0.019    1.774    0.076    0.033    0.106
##  .volatW2S2 ~~                                                          
##    .volatW3S2         0.059    0.016    3.625    0.000    0.059    0.247
##    .volatW4S2         0.033    0.017    1.945    0.052    0.033    0.128
##  .volatW3S2 ~~                                                          
##    .volatW4S2         0.040    0.017    2.339    0.019    0.040    0.125
##  .volatW1P1 ~~                                                          
##    .volatW2P1         0.029    0.022    1.276    0.202    0.029    0.069
##    .volatW3P1        -0.038    0.025   -1.499    0.134   -0.038   -0.070
##    .volatW4P1         0.028    0.025    1.136    0.256    0.028    0.060
##  .volatW2P1 ~~                                                          
##    .volatW3P1         0.027    0.025    1.100    0.271    0.027    0.060
##    .volatW4P1         0.052    0.025    2.087    0.037    0.052    0.132
##  .volatW3P1 ~~                                                          
##    .volatW4P1        -0.051    0.030   -1.690    0.091   -0.051   -0.101
##  .volatW1P2 ~~                                                          
##    .volatW2P2         0.048    0.021    2.341    0.019    0.048    0.115
##    .volatW3P2         0.069    0.020    3.385    0.001    0.069    0.147
##    .volatW4P2         0.048    0.024    2.001    0.045    0.048    0.104
##  .volatW2P2 ~~                                                          
##    .volatW3P2         0.019    0.021    0.904    0.366    0.019    0.048
##    .volatW4P2         0.046    0.024    1.903    0.057    0.046    0.116
##  .volatW3P2 ~~                                                          
##    .volatW4P2         0.096    0.022    4.281    0.000    0.096    0.216
##  .volatW1S1 ~~                                                          
##    .volatW1S2         0.172    0.046    3.742    0.000    0.172    0.561
##  .volatW1P1 ~~                                                          
##    .volatW1P2         0.398    0.057    6.941    0.000    0.398    0.808
##  .volatW2S1 ~~                                                          
##    .volatW2S2         0.087    0.040    2.196    0.028    0.087    0.399
##  .volatW2P1 ~~                                                          
##    .volatW2P2         0.247    0.045    5.531    0.000    0.247    0.698
##  .volatW3S1 ~~                                                          
##    .volatW3S2         0.176    0.040    4.361    0.000    0.176    0.643
##  .volatW3P1 ~~                                                          
##    .volatW3P2         0.428    0.066    6.480    0.000    0.428    0.832
##  .volatW4S1 ~~                                                          
##    .volatW4S2         0.274    0.064    4.294    0.000    0.274    0.690
##  .volatW4P1 ~~                                                          
##    .volatW4P2         0.342    0.062    5.552    0.000    0.342    0.785
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            2.842    0.051   56.127    0.000    3.933    3.933
##     slope             0.000    0.002    0.100    0.920    0.016    0.016
##    .volatW1S1         0.000                               0.000    0.000
##    .volatW2S1         0.000                               0.000    0.000
##    .volatW3S1         0.000                               0.000    0.000
##    .volatW4S1         0.000                               0.000    0.000
##    .volatW1S2  (b)    0.213    0.113    1.891    0.059    0.213    0.271
##    .volatW2S2  (b)    0.213    0.113    1.891    0.059    0.213    0.289
##    .volatW3S2  (b)    0.213    0.113    1.891    0.059    0.213    0.285
##    .volatW4S2  (b)    0.213    0.113    1.891    0.059    0.213    0.277
##    .volatW1P1  (c)    0.849    0.179    4.741    0.000    0.849    1.048
##    .volatW2P1  (c)    0.849    0.179    4.741    0.000    0.849    1.174
##    .volatW3P1  (c)    0.849    0.179    4.741    0.000    0.849    1.000
##    .volatW4P1  (c)    0.849    0.179    4.741    0.000    0.849    1.135
##    .volatW1P2  (d)    0.800    0.181    4.422    0.000    0.800    0.985
##    .volatW2P2  (d)    0.800    0.181    4.422    0.000    0.800    1.096
##    .volatW3P2  (d)    0.800    0.181    4.422    0.000    0.800    1.045
##    .volatW4P2  (d)    0.800    0.181    4.422    0.000    0.800    1.072
##    .volat1            0.000                               0.000    0.000
##    .volat2            0.000                               0.000    0.000
##    .volat3            0.000                               0.000    0.000
##    .volat4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S1         0.327    0.055    5.971    0.000    0.327    0.432
##    .volatW1S2         0.287    0.045    6.313    0.000    0.287    0.464
##    .volatW1P1         0.491    0.063    7.845    0.000    0.491    0.748
##    .volatW1P2         0.493    0.059    8.315    0.000    0.493    0.747
##    .volatW2S1         0.243    0.049    4.984    0.000    0.243    0.350
##    .volatW2S2         0.195    0.039    5.047    0.000    0.195    0.360
##    .volatW2P1         0.350    0.047    7.436    0.000    0.350    0.668
##    .volatW2P2         0.358    0.047    7.644    0.000    0.358    0.672
##    .volatW3S1         0.260    0.047    5.501    0.000    0.260    0.426
##    .volatW3S2         0.290    0.040    7.232    0.000    0.290    0.518
##    .volatW3P1         0.586    0.084    7.005    0.000    0.586    0.813
##    .volatW3P2         0.450    0.059    7.591    0.000    0.450    0.768
##    .volatW4S1         0.452    0.076    5.927    0.000    0.452    0.586
##    .volatW4S2         0.347    0.059    5.848    0.000    0.347    0.586
##    .volatW4P1         0.437    0.067    6.517    0.000    0.437    0.781
##    .volatW4P2         0.433    0.061    7.076    0.000    0.433    0.778
##    .volat1           -0.092    0.047   -1.954    0.051   -0.214   -0.214
##    .volat2           -0.048    0.039   -1.225    0.220   -0.107   -0.107
##    .volat3           -0.137    0.040   -3.439    0.001   -0.391   -0.391
##    .volat4           -0.172    0.060   -2.874    0.004   -0.538   -0.538
##     interc            0.522    0.060    8.693    0.000    1.000    1.000
##     slope             0.000    0.000    1.406    0.160    1.000    1.000
semPaths(lgmVolat, what = "col", whatLabels = "est", intercepts = T)

LGM Withdrawal

lgmWithd <- '

# factor at each time point with same loading
withd1 =~ withdW1S1        + a * withdW1S2 + 
           peer * withdW1P1 + aa * withdW1P2

withd2 =~ withdW2S1        + a * withdW2S2 + 
           peer * withdW2P1 + aa * withdW2P2

withd3 =~ withdW3S1        + a * withdW3S2 + 
           peer * withdW3P1 + aa * withdW3P2
  
withd4 =~ withdW4S1        + a * withdW4S2 + 
           peer * withdW4P1 + aa * withdW4P2

# second withd factor for intercept and slope
interc =~ 1*withd1 + 1*withd2 + 1*withd3 + 1*withd4
slope =~ 0*withd1 + 6*withd2 + 13*withd3 + 19*withd4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
withdW1S1 ~ 0*1
withdW2S1 ~ 0*1
withdW3S1 ~ 0*1
withdW4S1 ~ 0*1

# fix equal intercepts
withdW1S2 ~ b*1
withdW2S2 ~ b*1
withdW3S2 ~ b*1
withdW4S2 ~ b*1

withdW1P1 ~ c*1
withdW2P1 ~ c*1
withdW3P1 ~ c*1
withdW4P1 ~ c*1

withdW1P2 ~ d*1
withdW2P2 ~ d*1
withdW3P2 ~ d*1
withdW4P2 ~ d*1

# error covariance - similar parcels across waves
withdW1S1 ~~ withdW2S1 + withdW3S1 + withdW4S1
withdW2S1 ~~ withdW3S1 + withdW4S1
withdW3S1 ~~ withdW4S1

withdW1S2 ~~ withdW2S2 + withdW3S2 + withdW4S2
withdW2S2 ~~ withdW3S2 + withdW4S2
withdW3S2 ~~ withdW4S2

withdW1P1 ~~ withdW2P1 + withdW3P1 + withdW4P1
withdW2P1 ~~ withdW3P1 + withdW4P1
withdW3P1 ~~ withdW4P1

withdW1P2 ~~ withdW2P2 + withdW3P2 + withdW4P2
withdW2P2 ~~ withdW3P2 + withdW4P2
withdW3P2 ~~ withdW4P2

# error covariance - same method at one wave
withdW1S1 ~~ withdW1S2
withdW1P1 ~~ withdW1P2
withdW2S1 ~~ withdW2S2
withdW2P1 ~~ withdW2P2
withdW3S1 ~~ withdW3S2
withdW3P1 ~~ withdW3P2
withdW4S1 ~~ withdW4S2
withdW4P1 ~~ withdW4P2
'
lgmWithd <- sem(lgmWithd, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmWithd, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 160 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               322.713
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2333.668
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.894
##   Tucker-Lewis Index (TLI)                       0.858
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1793.040
##   Loglikelihood unrestricted model (H1)      -1631.683
##                                                       
##   Akaike (AIC)                                3712.080
##   Bayesian (BIC)                              3936.160
##   Sample-size adjusted Bayesian (BIC)         3736.427
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.101
##   90 Percent confidence interval - lower         0.089
##   90 Percent confidence interval - upper         0.113
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.167
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   withd1 =~                                                             
##     wthW1S1           1.000                               0.559    0.732
##     wthW1S2    (a)    0.926    0.067   13.863    0.000    0.518    0.710
##     wthW1P1 (peer)    0.684    0.139    4.924    0.000    0.382    0.565
##     wthW1P2   (aa)    0.648    0.141    4.598    0.000    0.362    0.508
##   withd2 =~                                                             
##     wthW2S1           1.000                               0.578    0.766
##     wthW2S2    (a)    0.926    0.067   13.863    0.000    0.535    0.751
##     wthW2P1 (peer)    0.684    0.139    4.924    0.000    0.395    0.592
##     wthW2P2   (aa)    0.648    0.141    4.598    0.000    0.374    0.572
##   withd3 =~                                                             
##     wthW3S1           1.000                               0.566    0.745
##     wthW3S2    (a)    0.926    0.067   13.863    0.000    0.524    0.757
##     wthW3P1 (peer)    0.684    0.139    4.924    0.000    0.387    0.546
##     wthW3P2   (aa)    0.648    0.141    4.598    0.000    0.366    0.546
##   withd4 =~                                                             
##     wthW4S1           1.000                               0.549    0.724
##     wthW4S2    (a)    0.926    0.067   13.863    0.000    0.508    0.754
##     wthW4P1 (peer)    0.684    0.139    4.924    0.000    0.375    0.553
##     wthW4P2   (aa)    0.648    0.141    4.598    0.000    0.355    0.550
##   interc =~                                                             
##     withd1            1.000                               1.053    1.053
##     withd2            1.000                               1.019    1.019
##     withd3            1.000                               1.041    1.041
##     withd4            1.000                               1.073    1.073
##   slope =~                                                              
##     withd1            0.000                               0.000    0.000
##     withd2            6.000                               0.131    0.131
##     withd3           13.000                               0.291    0.291
##     withd4           19.000                               0.438    0.438
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.003    0.002   -1.711    0.087   -0.354   -0.354
##  .withdW1S1 ~~                                                          
##    .withdW2S1         0.058    0.027    2.154    0.031    0.058    0.231
##    .withdW3S1         0.067    0.029    2.294    0.022    0.067    0.254
##    .withdW4S1         0.078    0.029    2.646    0.008    0.078    0.285
##  .withdW2S1 ~~                                                          
##    .withdW3S1         0.092    0.035    2.633    0.008    0.092    0.374
##    .withdW4S1         0.075    0.033    2.261    0.024    0.075    0.295
##  .withdW3S1 ~~                                                          
##    .withdW4S1         0.101    0.038    2.660    0.008    0.101    0.381
##  .withdW1S2 ~~                                                          
##    .withdW2S2         0.097    0.025    3.818    0.000    0.097    0.401
##    .withdW3S2         0.106    0.024    4.342    0.000    0.106    0.459
##    .withdW4S2         0.085    0.025    3.404    0.001    0.085    0.373
##  .withdW2S2 ~~                                                          
##    .withdW3S2         0.100    0.025    3.934    0.000    0.100    0.468
##    .withdW4S2         0.091    0.026    3.503    0.000    0.091    0.436
##  .withdW3S2 ~~                                                          
##    .withdW4S2         0.108    0.027    4.027    0.000    0.108    0.539
##  .withdW1P1 ~~                                                          
##    .withdW2P1         0.143    0.052    2.756    0.006    0.143    0.477
##    .withdW3P1         0.187    0.063    2.950    0.003    0.187    0.566
##    .withdW4P1         0.165    0.052    3.162    0.002    0.165    0.525
##  .withdW2P1 ~~                                                          
##    .withdW3P1         0.209    0.057    3.631    0.000    0.209    0.652
##    .withdW4P1         0.189    0.053    3.563    0.000    0.189    0.620
##  .withdW3P1 ~~                                                          
##    .withdW4P1         0.206    0.066    3.116    0.002    0.206    0.615
##  .withdW1P2 ~~                                                          
##    .withdW2P2         0.193    0.052    3.719    0.000    0.193    0.586
##    .withdW3P2         0.217    0.061    3.582    0.000    0.217    0.632
##    .withdW4P2         0.158    0.056    2.800    0.005    0.158    0.478
##  .withdW2P2 ~~                                                          
##    .withdW3P2         0.211    0.055    3.809    0.000    0.211    0.699
##    .withdW4P2         0.126    0.050    2.507    0.012    0.126    0.436
##  .withdW3P2 ~~                                                          
##    .withdW4P2         0.197    0.059    3.343    0.001    0.197    0.649
##  .withdW1S1 ~~                                                          
##    .withdW1S2         0.108    0.033    3.232    0.001    0.108    0.404
##  .withdW1P1 ~~                                                          
##    .withdW1P2         0.096    0.027    3.590    0.000    0.096    0.281
##  .withdW2S1 ~~                                                          
##    .withdW2S2         0.060    0.026    2.346    0.019    0.060    0.263
##  .withdW2P1 ~~                                                          
##    .withdW2P2         0.032    0.020    1.565    0.118    0.032    0.109
##  .withdW3S1 ~~                                                          
##    .withdW3S2         0.034    0.022    1.538    0.124    0.034    0.151
##  .withdW3P1 ~~                                                          
##    .withdW3P2         0.021    0.027    0.803    0.422    0.021    0.064
##  .withdW4S1 ~~                                                          
##    .withdW4S2         0.045    0.031    1.446    0.148    0.045    0.192
##  .withdW4P1 ~~                                                          
##    .withdW4P2         0.093    0.031    3.041    0.002    0.093    0.306
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            2.973    0.045   66.207    0.000    5.050    5.050
##     slope            -0.000    0.002   -0.034    0.973   -0.005   -0.005
##    .withdW1S1         0.000                               0.000    0.000
##    .withdW2S1         0.000                               0.000    0.000
##    .withdW3S1         0.000                               0.000    0.000
##    .withdW4S1         0.000                               0.000    0.000
##    .withdW1S2  (b)    0.265    0.201    1.316    0.188    0.265    0.363
##    .withdW2S2  (b)    0.265    0.201    1.316    0.188    0.265    0.371
##    .withdW3S2  (b)    0.265    0.201    1.316    0.188    0.265    0.382
##    .withdW4S2  (b)    0.265    0.201    1.316    0.188    0.265    0.392
##    .withdW1P1  (c)    0.580    0.417    1.392    0.164    0.580    0.858
##    .withdW2P1  (c)    0.580    0.417    1.392    0.164    0.580    0.868
##    .withdW3P1  (c)    0.580    0.417    1.392    0.164    0.580    0.819
##    .withdW4P1  (c)    0.580    0.417    1.392    0.164    0.580    0.855
##    .withdW1P2  (d)    0.620    0.421    1.473    0.141    0.620    0.871
##    .withdW2P2  (d)    0.620    0.421    1.473    0.141    0.620    0.947
##    .withdW3P2  (d)    0.620    0.421    1.473    0.141    0.620    0.925
##    .withdW4P2  (d)    0.620    0.421    1.473    0.141    0.620    0.960
##    .withd1            0.000                               0.000    0.000
##    .withd2            0.000                               0.000    0.000
##    .withd3            0.000                               0.000    0.000
##    .withd4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .withdW1S1         0.271    0.047    5.748    0.000    0.271    0.464
##    .withdW1S2         0.263    0.042    6.232    0.000    0.263    0.495
##    .withdW1P1         0.311    0.048    6.452    0.000    0.311    0.680
##    .withdW1P2         0.376    0.056    6.720    0.000    0.376    0.742
##    .withdW2S1         0.235    0.046    5.128    0.000    0.235    0.412
##    .withdW2S2         0.222    0.039    5.619    0.000    0.222    0.436
##    .withdW2P1         0.290    0.054    5.420    0.000    0.290    0.650
##    .withdW2P2         0.289    0.055    5.289    0.000    0.289    0.673
##    .withdW3S1         0.256    0.053    4.871    0.000    0.256    0.445
##    .withdW3S2         0.204    0.036    5.701    0.000    0.204    0.427
##    .withdW3P1         0.352    0.067    5.270    0.000    0.352    0.702
##    .withdW3P2         0.315    0.061    5.194    0.000    0.315    0.701
##    .withdW4S1         0.273    0.055    4.943    0.000    0.273    0.476
##    .withdW4S2         0.197    0.041    4.852    0.000    0.197    0.432
##    .withdW4P1         0.319    0.055    5.787    0.000    0.319    0.694
##    .withdW4P2         0.291    0.050    5.771    0.000    0.291    0.697
##    .withd1           -0.034    0.028   -1.202    0.229   -0.109   -0.109
##    .withd2            0.013    0.022    0.612    0.540    0.040    0.040
##    .withd3            0.015    0.019    0.784    0.433    0.045    0.045
##    .withd4           -0.003    0.031   -0.102    0.919   -0.010   -0.010
##     interc            0.347    0.057    6.128    0.000    1.000    1.000
##     slope             0.000    0.000    1.601    0.109    1.000    1.000
semPaths(lgmWithd, what = "col", whatLabels = "est", intercepts = T)

LGM Confusion

lgmConfu <- '

# factor at each time point with same loading
confu1 =~ confuW1S1        + a * confuW1S2 + 
           peer * confuW1P1 + aa * confuW1P2

confu2 =~ confuW2S1        + a * confuW2S2 + 
           peer * confuW2P1 + aa * confuW2P2

confu3 =~ confuW3S1        + a * confuW3S2 + 
           peer * confuW3P1 + aa * confuW3P2
  
confu4 =~ confuW4S1        + a * confuW4S2 + 
           peer * confuW4P1 + aa * confuW4P2

# second confu factor for intercept and slope
interc =~ 1*confu1 + 1*confu2 + 1*confu3 + 1*confu4
slope =~ 0*confu1 + 6*confu2 + 13*confu3 + 19*confu4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
confuW1S1 ~ 0*1
confuW2S1 ~ 0*1
confuW3S1 ~ 0*1
confuW4S1 ~ 0*1

# fix equal intercepts
confuW1S2 ~ b*1
confuW2S2 ~ b*1
confuW3S2 ~ b*1
confuW4S2 ~ b*1

confuW1P1 ~ c*1
confuW2P1 ~ c*1
confuW3P1 ~ c*1
confuW4P1 ~ c*1

confuW1P2 ~ d*1
confuW2P2 ~ d*1
confuW3P2 ~ d*1
confuW4P2 ~ d*1

# error covariance - similar parcels across waves
confuW1S1 ~~ confuW2S1 + confuW3S1 + confuW4S1
confuW2S1 ~~ confuW3S1 + confuW4S1
confuW3S1 ~~ confuW4S1

confuW1S2 ~~ confuW2S2 + confuW3S2 + confuW4S2
confuW2S2 ~~ confuW3S2 + confuW4S2
confuW3S2 ~~ confuW4S2

confuW1P1 ~~ confuW2P1 + confuW3P1 + confuW4P1
confuW2P1 ~~ confuW3P1 + confuW4P1
confuW3P1 ~~ confuW4P1

confuW1P2 ~~ confuW2P2 + confuW3P2 + confuW4P2
confuW2P2 ~~ confuW3P2 + confuW4P2
confuW3P2 ~~ confuW4P2

# error covariance - same method at one wave
confuW1S1 ~~ confuW1S2
confuW1P1 ~~ confuW1P2
confuW2S1 ~~ confuW2S2
confuW2P1 ~~ confuW2P2
confuW3S1 ~~ confuW3S2
confuW3P1 ~~ confuW3P2
confuW4S1 ~~ confuW4S2
confuW4P1 ~~ confuW4P2
'
lgmConfu <- sem(lgmConfu, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmConfu, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 135 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        55
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               181.006
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1406.278
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.928
##   Tucker-Lewis Index (TLI)                       0.904
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -2233.611
##   Loglikelihood unrestricted model (H1)      -2143.108
##                                                       
##   Akaike (AIC)                                4593.222
##   Bayesian (BIC)                              4817.302
##   Sample-size adjusted Bayesian (BIC)         4617.570
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.063
##   90 Percent confidence interval - lower         0.050
##   90 Percent confidence interval - upper         0.076
##   P-value RMSEA <= 0.05                          0.051
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.108
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   confu1 =~                                                             
##     cnfW1S1           1.000                               0.409    0.526
##     cnfW1S2    (a)    1.092    0.114    9.607    0.000    0.446    0.574
##     cnfW1P1 (peer)    0.997    0.171    5.813    0.000    0.407    0.482
##     cnfW1P2   (aa)    0.777    0.149    5.223    0.000    0.317    0.490
##   confu2 =~                                                             
##     cnfW2S1           1.000                               0.440    0.590
##     cnfW2S2    (a)    1.092    0.114    9.607    0.000    0.480    0.609
##     cnfW2P1 (peer)    0.997    0.171    5.813    0.000    0.438    0.604
##     cnfW2P2   (aa)    0.777    0.149    5.223    0.000    0.341    0.512
##   confu3 =~                                                             
##     cnfW3S1           1.000                               0.450    0.577
##     cnfW3S2    (a)    1.092    0.114    9.607    0.000    0.491    0.593
##     cnfW3P1 (peer)    0.997    0.171    5.813    0.000    0.448    0.631
##     cnfW3P2   (aa)    0.777    0.149    5.223    0.000    0.349    0.521
##   confu4 =~                                                             
##     cnfW4S1           1.000                               0.448    0.587
##     cnfW4S2    (a)    1.092    0.114    9.607    0.000    0.489    0.615
##     cnfW4P1 (peer)    0.997    0.171    5.813    0.000    0.447    0.597
##     cnfW4P2   (aa)    0.777    0.149    5.223    0.000    0.348    0.474
##   interc =~                                                             
##     confu1            1.000                               1.186    1.186
##     confu2            1.000                               1.103    1.103
##     confu3            1.000                               1.078    1.078
##     confu4            1.000                               1.082    1.082
##   slope =~                                                              
##     confu1            0.000                               0.000    0.000
##     confu2            6.000                               0.222    0.222
##     confu3           13.000                               0.470    0.470
##     confu4           19.000                               0.689    0.689
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.003    0.002   -1.739    0.082   -0.356   -0.356
##  .confuW1S1 ~~                                                          
##    .confuW2S1         0.087    0.032    2.730    0.006    0.087    0.221
##    .confuW3S1         0.088    0.032    2.778    0.005    0.088    0.210
##    .confuW4S1         0.130    0.034    3.776    0.000    0.130    0.320
##  .confuW2S1 ~~                                                          
##    .confuW3S1         0.102    0.034    2.985    0.003    0.102    0.268
##    .confuW4S1         0.115    0.035    3.267    0.001    0.115    0.311
##  .confuW3S1 ~~                                                          
##    .confuW4S1         0.126    0.037    3.449    0.001    0.126    0.322
##  .confuW1S2 ~~                                                          
##    .confuW2S2         0.077    0.036    2.120    0.034    0.077    0.193
##    .confuW3S2         0.065    0.034    1.934    0.053    0.065    0.153
##    .confuW4S2         0.037    0.037    1.019    0.308    0.037    0.094
##  .confuW2S2 ~~                                                          
##    .confuW3S2         0.157    0.040    3.951    0.000    0.157    0.378
##    .confuW4S2         0.101    0.043    2.321    0.020    0.101    0.257
##  .confuW3S2 ~~                                                          
##    .confuW4S2         0.141    0.046    3.064    0.002    0.141    0.337
##  .confuW1P1 ~~                                                          
##    .confuW2P1         0.166    0.054    3.067    0.002    0.166    0.388
##    .confuW3P1         0.195    0.052    3.723    0.000    0.195    0.477
##    .confuW4P1         0.161    0.061    2.624    0.009    0.161    0.363
##  .confuW2P1 ~~                                                          
##    .confuW3P1         0.124    0.051    2.413    0.016    0.124    0.388
##    .confuW4P1         0.138    0.057    2.428    0.015    0.138    0.397
##  .confuW3P1 ~~                                                          
##    .confuW4P1         0.160    0.056    2.865    0.004    0.160    0.485
##  .confuW1P2 ~~                                                          
##    .confuW2P2         0.148    0.039    3.751    0.000    0.148    0.455
##    .confuW3P2         0.114    0.038    2.993    0.003    0.114    0.353
##    .confuW4P2         0.220    0.047    4.709    0.000    0.220    0.603
##  .confuW2P2 ~~                                                          
##    .confuW3P2         0.181    0.043    4.215    0.000    0.181    0.552
##    .confuW4P2         0.215    0.048    4.502    0.000    0.215    0.579
##  .confuW3P2 ~~                                                          
##    .confuW4P2         0.184    0.048    3.825    0.000    0.184    0.497
##  .confuW1S1 ~~                                                          
##    .confuW1S2         0.157    0.039    3.989    0.000    0.157    0.375
##  .confuW1P1 ~~                                                          
##    .confuW1P2         0.116    0.035    3.293    0.001    0.116    0.278
##  .confuW2S1 ~~                                                          
##    .confuW2S2         0.083    0.035    2.414    0.016    0.083    0.222
##  .confuW2P1 ~~                                                          
##    .confuW2P2         0.059    0.029    2.010    0.044    0.059    0.179
##  .confuW3S1 ~~                                                          
##    .confuW3S2         0.154    0.040    3.831    0.000    0.154    0.364
##  .confuW3P1 ~~                                                          
##    .confuW3P2         0.068    0.032    2.127    0.033    0.068    0.216
##  .confuW4S1 ~~                                                          
##    .confuW4S2         0.093    0.048    1.940    0.052    0.093    0.239
##  .confuW4P1 ~~                                                          
##    .confuW4P2         0.066    0.041    1.612    0.107    0.066    0.169
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            2.852    0.043   65.956    0.000    5.884    5.884
##     slope            -0.004    0.002   -1.728    0.084   -0.232   -0.232
##    .confuW1S1         0.000                               0.000    0.000
##    .confuW2S1         0.000                               0.000    0.000
##    .confuW3S1         0.000                               0.000    0.000
##    .confuW4S1         0.000                               0.000    0.000
##    .confuW1S2  (b)   -0.207    0.323   -0.641    0.522   -0.207   -0.266
##    .confuW2S2  (b)   -0.207    0.323   -0.641    0.522   -0.207   -0.262
##    .confuW3S2  (b)   -0.207    0.323   -0.641    0.522   -0.207   -0.250
##    .confuW4S2  (b)   -0.207    0.323   -0.641    0.522   -0.207   -0.260
##    .confuW1P1  (c)   -0.378    0.489   -0.773    0.439   -0.378   -0.447
##    .confuW2P1  (c)   -0.378    0.489   -0.773    0.439   -0.378   -0.521
##    .confuW3P1  (c)   -0.378    0.489   -0.773    0.439   -0.378   -0.532
##    .confuW4P1  (c)   -0.378    0.489   -0.773    0.439   -0.378   -0.505
##    .confuW1P2  (d)    0.294    0.423    0.697    0.486    0.294    0.454
##    .confuW2P2  (d)    0.294    0.423    0.697    0.486    0.294    0.441
##    .confuW3P2  (d)    0.294    0.423    0.697    0.486    0.294    0.440
##    .confuW4P2  (d)    0.294    0.423    0.697    0.486    0.294    0.401
##    .confu1            0.000                               0.000    0.000
##    .confu2            0.000                               0.000    0.000
##    .confu3            0.000                               0.000    0.000
##    .confu4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .confuW1S1         0.436    0.050    8.710    0.000    0.436    0.723
##    .confuW1S2         0.404    0.051    7.906    0.000    0.404    0.670
##    .confuW1P1         0.549    0.075    7.368    0.000    0.549    0.768
##    .confuW1P2         0.320    0.043    7.435    0.000    0.320    0.760
##    .confuW2S1         0.361    0.047    7.678    0.000    0.361    0.651
##    .confuW2S2         0.390    0.053    7.300    0.000    0.390    0.629
##    .confuW2P1         0.334    0.056    5.961    0.000    0.334    0.635
##    .confuW2P2         0.328    0.046    7.214    0.000    0.328    0.738
##    .confuW3S1         0.404    0.055    7.409    0.000    0.404    0.667
##    .confuW3S2         0.445    0.058    7.646    0.000    0.445    0.649
##    .confuW3P1         0.304    0.054    5.583    0.000    0.304    0.602
##    .confuW3P2         0.327    0.049    6.636    0.000    0.327    0.728
##    .confuW4S1         0.381    0.056    6.851    0.000    0.381    0.655
##    .confuW4S2         0.394    0.080    4.935    0.000    0.394    0.622
##    .confuW4P1         0.360    0.069    5.188    0.000    0.360    0.643
##    .confuW4P2         0.418    0.069    6.085    0.000    0.418    0.776
##    .confu1           -0.068    0.028   -2.434    0.015   -0.407   -0.407
##    .confu2           -0.018    0.021   -0.835    0.403   -0.091   -0.091
##    .confu3           -0.005    0.024   -0.186    0.852   -0.022   -0.022
##    .confu4           -0.023    0.036   -0.642    0.521   -0.114   -0.114
##     interc            0.235    0.048    4.846    0.000    1.000    1.000
##     slope             0.000    0.000    2.098    0.036    1.000    1.000
semPaths(lgmConfu, what = "col", whatLabels = "est", intercepts = T)

LGM Coherence

lgmCoher <- '

# factor at each time point with same loading
coher1 =~ coherW1S1        + a * coherW1S2 + 
           peer * coherW1P1 + aa * coherW1P2

coher2 =~ coherW2S1        + a * coherW2S2 + 
           peer * coherW2P1 + aa * coherW2P2

coher3 =~ coherW3S1        + a * coherW3S2 + 
           peer * coherW3P1 + aa * coherW3P2
  
coher4 =~ coherW4S1        + a * coherW4S2 + 
           peer * coherW4P1 + aa * coherW4P2

# second coher factor for intercept and slope
interc =~ 1*coher1 + 1*coher2 + 1*coher3 + 1*coher4
slope =~ 0*coher1 + 6*coher2 + 13*coher3 + 19*coher4
interc ~~ slope
interc ~ 1
slope ~ 1

# fix zero intercepts
coherW1S1 ~ 0*1
coherW2S1 ~ 0*1
coherW3S1 ~ 0*1
coherW4S1 ~ 0*1

# fix equal intercepts
coherW1S2 ~ b*1
coherW2S2 ~ b*1
coherW3S2 ~ b*1
coherW4S2 ~ b*1

coherW1P1 ~ c*1
coherW2P1 ~ c*1
coherW3P1 ~ c*1
coherW4P1 ~ c*1

coherW1P2 ~ d*1
coherW2P2 ~ d*1
coherW3P2 ~ d*1
coherW4P2 ~ d*1

# error covariance - similar parcels across waves
coherW1S1 ~~ coherW2S1 + coherW3S1 + coherW4S1
coherW2S1 ~~ coherW3S1 + coherW4S1
coherW3S1 ~~ coherW4S1

coherW1S2 ~~ coherW2S2 + coherW3S2 + coherW4S2
coherW2S2 ~~ coherW3S2 + coherW4S2
coherW3S2 ~~ coherW4S2

coherW1P1 ~~ coherW2P1 + coherW3P1 + coherW4P1
coherW2P1 ~~ coherW3P1 + coherW4P1
coherW3P1 ~~ coherW4P1

coherW1P2 ~~ coherW2P2 + coherW3P2 + coherW4P2
coherW2P2 ~~ coherW3P2 + coherW4P2
coherW3P2 ~~ coherW4P2

# error covariance - same method at one wave
coherW1S1 ~~ coherW1S2
coherW1P1 ~~ coherW1P2
coherW2S1 ~~ coherW2S2
coherW2P1 ~~ coherW2P2
coherW3S1 ~~ coherW3S2
coherW3P1 ~~ coherW3P2
coherW4S1 ~~ coherW4S2
coherW4P1 ~~ coherW4P2
'
lgmCoher <- sem(lgmCoher, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lgmCoher, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 189 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##   Number of equality constraints                    18
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        55
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               192.352
##   Degrees of freedom                                89
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1489.355
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.925
##   Tucker-Lewis Index (TLI)                       0.898
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1727.529
##   Loglikelihood unrestricted model (H1)      -1631.353
##                                                       
##   Akaike (AIC)                                3581.058
##   Bayesian (BIC)                              3805.138
##   Sample-size adjusted Bayesian (BIC)         3605.405
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.067
##   90 Percent confidence interval - lower         0.054
##   90 Percent confidence interval - upper         0.080
##   P-value RMSEA <= 0.05                          0.017
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.134
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   coher1 =~                                                             
##     chrW1S1           1.000                               0.222    0.330
##     chrW1S2    (a)    0.914    0.174    5.247    0.000    0.203    0.365
##     chrW1P1 (peer)    1.822    0.431    4.225    0.000    0.405    0.581
##     chrW1P2   (aa)    1.965    0.495    3.972    0.000    0.436    0.682
##   coher2 =~                                                             
##     chrW2S1           1.000                               0.221    0.329
##     chrW2S2    (a)    0.914    0.174    5.247    0.000    0.202    0.354
##     chrW2P1 (peer)    1.822    0.431    4.225    0.000    0.403    0.637
##     chrW2P2   (aa)    1.965    0.495    3.972    0.000    0.434    0.693
##   coher3 =~                                                             
##     chrW3S1           1.000                               0.238    0.325
##     chrW3S2    (a)    0.914    0.174    5.247    0.000    0.217    0.379
##     chrW3P1 (peer)    1.822    0.431    4.225    0.000    0.433    0.684
##     chrW3P2   (aa)    1.965    0.495    3.972    0.000    0.467    0.752
##   coher4 =~                                                             
##     chrW4S1           1.000                               0.222    0.342
##     chrW4S2    (a)    0.914    0.174    5.247    0.000    0.202    0.354
##     chrW4P1 (peer)    1.822    0.431    4.225    0.000    0.404    0.641
##     chrW4P2   (aa)    1.965    0.495    3.972    0.000    0.435    0.707
##   interc =~                                                             
##     coher1            1.000                               1.080    1.080
##     coher2            1.000                               1.085    1.085
##     coher3            1.000                               1.009    1.009
##     coher4            1.000                               1.082    1.082
##   slope =~                                                              
##     coher1            0.000                               0.000    0.000
##     coher2            6.000                               0.201    0.201
##     coher3           13.000                               0.406    0.406
##     coher4           19.000                               0.636    0.636
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   interc ~~                                                             
##     slope            -0.000    0.000   -0.279    0.780   -0.076   -0.076
##  .coherW1S1 ~~                                                          
##    .coherW2S1         0.190    0.035    5.495    0.000    0.190    0.470
##    .coherW3S1         0.160    0.036    4.388    0.000    0.160    0.365
##    .coherW4S1         0.147    0.034    4.333    0.000    0.147    0.379
##  .coherW2S1 ~~                                                          
##    .coherW3S1         0.205    0.039    5.226    0.000    0.205    0.467
##    .coherW4S1         0.170    0.036    4.709    0.000    0.170    0.440
##  .coherW3S1 ~~                                                          
##    .coherW4S1         0.191    0.041    4.706    0.000    0.191    0.454
##  .coherW1S2 ~~                                                          
##    .coherW2S2         0.145    0.025    5.830    0.000    0.145    0.524
##    .coherW3S2         0.140    0.024    5.736    0.000    0.140    0.508
##    .coherW4S2         0.126    0.026    4.894    0.000    0.126    0.456
##  .coherW2S2 ~~                                                          
##    .coherW3S2         0.140    0.027    5.279    0.000    0.140    0.495
##    .coherW4S2         0.139    0.027    5.201    0.000    0.139    0.488
##  .coherW3S2 ~~                                                          
##    .coherW4S2         0.151    0.029    5.165    0.000    0.151    0.532
##  .coherW1P1 ~~                                                          
##    .coherW2P1         0.068    0.024    2.820    0.005    0.068    0.246
##    .coherW3P1         0.044    0.026    1.697    0.090    0.044    0.168
##    .coherW4P1         0.086    0.027    3.228    0.001    0.086    0.315
##  .coherW2P1 ~~                                                          
##    .coherW3P1         0.056    0.022    2.570    0.010    0.056    0.248
##    .coherW4P1         0.074    0.023    3.220    0.001    0.074    0.316
##  .coherW3P1 ~~                                                          
##    .coherW4P1         0.069    0.025    2.771    0.006    0.069    0.310
##  .coherW1P2 ~~                                                          
##    .coherW2P2         0.008    0.024    0.316    0.752    0.008    0.035
##    .coherW3P2         0.025    0.024    1.012    0.311    0.025    0.128
##    .coherW4P2         0.030    0.027    1.123    0.261    0.030    0.149
##  .coherW2P2 ~~                                                          
##    .coherW3P2         0.017    0.024    0.718    0.473    0.017    0.093
##    .coherW4P2         0.003    0.028    0.108    0.914    0.003    0.015
##  .coherW3P2 ~~                                                          
##    .coherW4P2         0.018    0.030    0.606    0.545    0.018    0.100
##  .coherW1S1 ~~                                                          
##    .coherW1S2         0.053    0.019    2.848    0.004    0.053    0.161
##  .coherW1P1 ~~                                                          
##    .coherW1P2         0.153    0.042    3.636    0.000    0.153    0.578
##  .coherW2S1 ~~                                                          
##    .coherW2S2         0.064    0.020    3.220    0.001    0.064    0.188
##  .coherW2P1 ~~                                                          
##    .coherW2P2         0.135    0.045    3.029    0.002    0.135    0.612
##  .coherW3S1 ~~                                                          
##    .coherW3S2         0.078    0.022    3.556    0.000    0.078    0.213
##  .coherW3P1 ~~                                                          
##    .coherW3P2         0.095    0.042    2.292    0.022    0.095    0.505
##  .coherW4S1 ~~                                                          
##    .coherW4S2         0.076    0.023    3.266    0.001    0.076    0.235
##  .coherW4P1 ~~                                                          
##    .coherW4P2         0.109    0.050    2.170    0.030    0.109    0.518
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     interc            3.493    0.036   96.775    0.000   14.569   14.569
##     slope            -0.000    0.001   -0.294    0.768   -0.047   -0.047
##    .coherW1S1         0.000                               0.000    0.000
##    .coherW2S1         0.000                               0.000    0.000
##    .coherW3S1         0.000                               0.000    0.000
##    .coherW4S1         0.000                               0.000    0.000
##    .coherW1S2  (b)    0.767    0.609    1.259    0.208    0.767    1.377
##    .coherW2S2  (b)    0.767    0.609    1.259    0.208    0.767    1.345
##    .coherW3S2  (b)    0.767    0.609    1.259    0.208    0.767    1.338
##    .coherW4S2  (b)    0.767    0.609    1.259    0.208    0.767    1.342
##    .coherW1P1  (c)   -2.366    1.505   -1.571    0.116   -2.366   -3.396
##    .coherW2P1  (c)   -2.366    1.505   -1.571    0.116   -2.366   -3.741
##    .coherW3P1  (c)   -2.366    1.505   -1.571    0.116   -2.366   -3.740
##    .coherW4P1  (c)   -2.366    1.505   -1.571    0.116   -2.366   -3.757
##    .coherW1P2  (d)   -2.889    1.727   -1.673    0.094   -2.889   -4.515
##    .coherW2P2  (d)   -2.889    1.727   -1.673    0.094   -2.889   -4.607
##    .coherW3P2  (d)   -2.889    1.727   -1.673    0.094   -2.889   -4.652
##    .coherW4P2  (d)   -2.889    1.727   -1.673    0.094   -2.889   -4.691
##    .coher1            0.000                               0.000    0.000
##    .coher2            0.000                               0.000    0.000
##    .coher3            0.000                               0.000    0.000
##    .coher4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .coherW1S1         0.404    0.038   10.546    0.000    0.404    0.891
##    .coherW1S2         0.269    0.026   10.226    0.000    0.269    0.867
##    .coherW1P1         0.322    0.055    5.801    0.000    0.322    0.663
##    .coherW1P2         0.219    0.046    4.717    0.000    0.219    0.535
##    .coherW2S1         0.403    0.042    9.699    0.000    0.403    0.892
##    .coherW2S2         0.284    0.030    9.440    0.000    0.284    0.874
##    .coherW2P1         0.238    0.044    5.461    0.000    0.238    0.595
##    .coherW2P2         0.205    0.057    3.574    0.000    0.205    0.520
##    .coherW3S1         0.476    0.051    9.400    0.000    0.476    0.894
##    .coherW3S2         0.281    0.030    9.338    0.000    0.281    0.856
##    .coherW3P1         0.213    0.047    4.555    0.000    0.213    0.532
##    .coherW3P2         0.168    0.049    3.441    0.001    0.168    0.435
##    .coherW4S1         0.370    0.044    8.412    0.000    0.370    0.883
##    .coherW4S2         0.286    0.034    8.439    0.000    0.286    0.874
##    .coherW4P1         0.234    0.052    4.461    0.000    0.234    0.589
##    .coherW4P2         0.190    0.062    3.065    0.002    0.190    0.500
##    .coher1           -0.008    0.011   -0.746    0.456   -0.166   -0.166
##    .coher2           -0.009    0.010   -0.870    0.384   -0.184   -0.184
##    .coher3           -0.007    0.009   -0.773    0.440   -0.121   -0.121
##    .coher4           -0.023    0.015   -1.498    0.134   -0.470   -0.470
##     interc            0.057    0.025    2.283    0.022    1.000    1.000
##     slope             0.000    0.000    1.198    0.231    1.000    1.000
semPaths(lgmCoher, what = "col", whatLabels = "est", intercepts = T)

Latent stability model

LSM Agreeableness

with aspects as parcels

lsmAgree <- '

# factor at each time point with same loading
agree1 =~ compaW1S        + a * politW1S + 
          peer * compaW1P + aa * politW1P

agree2 =~ compaW2S        + a * politW2S + 
          peer * compaW2P + aa * politW2P

agree3 =~ compaW3S        + a * politW3S + 
          peer * compaW3P + aa * politW3P
  
agree4 =~ compaW4S        + a * politW4S + 
          peer * compaW4P + aa * politW4P

# structural paths between time points 
agree4 ~ agree3
agree3 ~ agree2
agree2 ~ agree1

# error covariance - similar aspects across waves and informants
compaW1S ~~ compaW2S + compaW3S + compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW2S ~~ compaW3S + compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW3S ~~ compaW4S +
            compaW1P + compaW2P + compaW3P + compaW4P
compaW4S ~~ compaW1P + compaW2P + compaW3P + compaW4P

politW1S ~~ politW2S + politW3S + politW4S +
            politW1P + politW2P + politW3P + politW4P
politW2S ~~ politW3S + politW4S +
            politW1P + politW2P + politW3P + politW4P
politW3S ~~ politW4S +
            politW1P + politW2P + politW3P + politW4P
politW4S ~~ politW1P + politW2P + politW3P + politW4P

compaW1P ~~ compaW2P + compaW3P + compaW4P
compaW2P ~~ compaW3P + compaW4P
compaW3P ~~ compaW4P

politW1P ~~ politW2P + politW3P + politW4P
politW2P ~~ politW3P + politW4P
politW3P ~~ politW4P
'
lsmAgree <- sem(lsmAgree, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: the covariance matrix of the residuals of the observed
##                 variables (theta) is not positive definite;
##                 use lavInspect(fit, "theta") to investigate.
summary(lsmAgree, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 237 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        107
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               126.710
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2012.112
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.962
##   Tucker-Lewis Index (TLI)                       0.915
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1072.147
##   Loglikelihood unrestricted model (H1)      -1008.792
##                                                       
##   Akaike (AIC)                                2340.294
##   Bayesian (BIC)                              2688.863
##   Sample-size adjusted Bayesian (BIC)         2378.168
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.072
##   90 Percent confidence interval - lower         0.056
##   90 Percent confidence interval - upper         0.088
##   P-value RMSEA <= 0.05                          0.014
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.102
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree1 =~                                                             
##     compW1S           1.000                               0.153    0.327
##     poltW1S    (a)    1.322       NA                      0.202    0.378
##     compW1P (peer)    3.363    1.062    3.167    0.002    0.514    0.887
##     poltW1P   (aa)    2.567       NA                      0.392    0.666
##   agree2 =~                                                             
##     compW2S           1.000                               0.156    0.323
##     poltW2S    (a)    1.322       NA                      0.206    0.382
##     compW2P (peer)    3.363    1.062    3.167    0.002    0.523    0.911
##     poltW2P   (aa)    2.567       NA                      0.399    0.706
##   agree3 =~                                                             
##     compW3S           1.000                               0.158    0.330
##     poltW3S    (a)    1.322       NA                      0.208    0.378
##     compW3P (peer)    3.363    1.062    3.167    0.002    0.530    0.954
##     poltW3P   (aa)    2.567       NA                      0.405    0.642
##   agree4 =~                                                             
##     compW4S           1.000                               0.169    0.349
##     poltW4S    (a)    1.322       NA                      0.223    0.416
##     compW4P (peer)    3.363    1.062    3.167    0.002    0.568    0.981
##     poltW4P   (aa)    2.567       NA                      0.433    0.694
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree4 ~                                                              
##     agree3            1.014    0.069   14.791    0.000    0.947    0.947
##   agree3 ~                                                              
##     agree2            0.943    0.074   12.657    0.000    0.930    0.930
##   agree2 ~                                                              
##     agree1            0.844    0.077   10.995    0.000    0.829    0.829
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .compaW1S ~~                                                           
##    .compaW2S          0.123       NA                      0.123    0.608
##    .compaW3S          0.114       NA                      0.114    0.573
##    .compaW4S          0.116       NA                      0.116    0.580
##    .compaW1P          0.006       NA                      0.006    0.049
##    .compaW2P          0.036       NA                      0.036    0.344
##    .compaW3P          0.035       NA                      0.035    0.479
##    .compaW4P          0.008       NA                      0.008    0.159
##  .compaW2S ~~                                                           
##    .compaW3S          0.154       NA                      0.154    0.750
##    .compaW4S          0.155       NA                      0.155    0.751
##  .compaW1P ~~                                                           
##    .compaW2S          0.028       NA                      0.028    0.230
##  .compaW2S ~~                                                           
##    .compaW2P         -0.006       NA                     -0.006   -0.055
##    .compaW3P          0.017       NA                      0.017    0.228
##    .compaW4P          0.010       NA                      0.010    0.200
##  .compaW3S ~~                                                           
##    .compaW4S          0.171       NA                      0.171    0.835
##  .compaW1P ~~                                                           
##    .compaW3S          0.014       NA                      0.014    0.115
##  .compaW2P ~~                                                           
##    .compaW3S         -0.007       NA                     -0.007   -0.063
##  .compaW3S ~~                                                           
##    .compaW3P         -0.008       NA                     -0.008   -0.107
##    .compaW4P         -0.023       NA                     -0.023   -0.451
##  .compaW1P ~~                                                           
##    .compaW4S          0.002       NA                      0.002    0.019
##  .compaW2P ~~                                                           
##    .compaW4S         -0.010       NA                     -0.010   -0.091
##  .compaW3P ~~                                                           
##    .compaW4S          0.003       NA                      0.003    0.041
##  .compaW4S ~~                                                           
##    .compaW4P         -0.026       NA                     -0.026   -0.515
##  .politW1S ~~                                                           
##    .politW2S          0.183       NA                      0.183    0.742
##    .politW3S          0.167       NA                      0.167    0.663
##    .politW4S          0.165       NA                      0.165    0.684
##    .politW1P          0.085       NA                      0.085    0.389
##    .politW2P          0.058       NA                      0.058    0.293
##    .politW3P          0.061       NA                      0.061    0.254
##    .politW4P          0.065       NA                      0.065    0.293
##  .politW2S ~~                                                           
##    .politW3S          0.199       NA                      0.199    0.786
##    .politW4S          0.183       NA                      0.183    0.754
##  .politW1P ~~                                                           
##    .politW2S          0.089       NA                      0.089    0.405
##  .politW2S ~~                                                           
##    .politW2P          0.057       NA                      0.057    0.287
##    .politW3P          0.033       NA                      0.033    0.139
##    .politW4P          0.053       NA                      0.053    0.235
##  .politW3S ~~                                                           
##    .politW4S          0.209       NA                      0.209    0.841
##  .politW1P ~~                                                           
##    .politW3S          0.095       NA                      0.095    0.422
##  .politW2P ~~                                                           
##    .politW3S          0.063       NA                      0.063    0.306
##  .politW3S ~~                                                           
##    .politW3P          0.040       NA                      0.040    0.162
##    .politW4P          0.057       NA                      0.057    0.246
##  .politW1P ~~                                                           
##    .politW4S          0.091       NA                      0.091    0.426
##  .politW2P ~~                                                           
##    .politW4S          0.073       NA                      0.073    0.373
##  .politW3P ~~                                                           
##    .politW4S          0.056       NA                      0.056    0.236
##  .politW4S ~~                                                           
##    .politW4P          0.069       NA                      0.069    0.315
##  .compaW1P ~~                                                           
##    .compaW2P         -0.016       NA                     -0.016   -0.247
##    .compaW3P          0.015       NA                      0.015    0.332
##    .compaW4P          0.000       NA                      0.000    0.002
##  .compaW2P ~~                                                           
##    .compaW3P         -0.010       NA                     -0.010   -0.263
##    .compaW4P         -0.007       NA                     -0.007   -0.262
##  .compaW3P ~~                                                           
##    .compaW4P         -0.014       NA                     -0.014   -0.761
##  .politW1P ~~                                                           
##    .politW2P          0.114       NA                      0.114    0.644
##    .politW3P          0.110       NA                      0.110    0.517
##    .politW4P          0.130       NA                      0.130    0.657
##  .politW2P ~~                                                           
##    .politW3P          0.123       NA                      0.123    0.636
##    .politW4P          0.124       NA                      0.124    0.688
##  .politW3P ~~                                                           
##    .politW4P          0.167       NA                      0.167    0.769
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .compaW1S          4.146    0.029  142.461    0.000    4.146    8.861
##    .politW1S          3.698    0.033  111.332    0.000    3.698    6.923
##    .compaW1P          3.932    0.045   87.826    0.000    3.932    6.787
##    .politW1P          3.826    0.044   86.323    0.000    3.826    6.490
##    .compaW2S          4.126    0.032  127.505    0.000    4.126    8.577
##    .politW2S          3.734    0.036  105.155    0.000    3.734    6.934
##    .compaW2P          3.978    0.045   88.720    0.000    3.978    6.926
##    .politW2P          3.802    0.044   87.285    0.000    3.802    6.719
##    .compaW3S          4.133    0.033  127.091    0.000    4.133    8.646
##    .politW3S          3.733    0.037  101.172    0.000    3.733    6.778
##    .compaW3P          3.974    0.043   91.389    0.000    3.974    7.154
##    .politW3P          3.796    0.050   75.211    0.000    3.796    6.022
##    .compaW4S          4.196    0.034  122.690    0.000    4.196    8.669
##    .politW4S          3.770    0.037  101.218    0.000    3.770    7.031
##    .compaW4P          3.891    0.048   80.829    0.000    3.891    6.723
##    .politW4P          3.707    0.051   72.835    0.000    3.707    5.932
##     agree1            0.000                               0.000    0.000
##    .agree2            0.000                               0.000    0.000
##    .agree3            0.000                               0.000    0.000
##    .agree4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .compaW1S          0.196       NA                      0.196    0.893
##    .politW1S          0.245       NA                      0.245    0.857
##    .compaW1P          0.071       NA                      0.071    0.213
##    .politW1P          0.194       NA                      0.194    0.557
##    .compaW2S          0.207       NA                      0.207    0.896
##    .politW2S          0.248       NA                      0.248    0.854
##    .compaW2P          0.056       NA                      0.056    0.171
##    .politW2P          0.161       NA                      0.161    0.502
##    .compaW3S          0.204       NA                      0.204    0.891
##    .politW3S          0.260       NA                      0.260    0.857
##    .compaW3P          0.028       NA                      0.028    0.089
##    .politW3P          0.234       NA                      0.234    0.588
##    .compaW4S          0.206       NA                      0.206    0.878
##    .politW4S          0.238       NA                      0.238    0.827
##    .compaW4P          0.013       NA                      0.013    0.037
##    .politW4P          0.203       NA                      0.203    0.519
##     agree1            0.023       NA                      1.000    1.000
##    .agree2            0.008       NA                      0.312    0.312
##    .agree3            0.003       NA                      0.135    0.135
##    .agree4            0.003       NA                      0.104    0.104
semPaths(lsmAgree, what = "col", whatLabels = "est", structural = T, layout = "spring")

with random parcels

lsmAgree <- '

# factor at each time point with same loading
agree1 =~ agreeW1S1        + a * agreeW1S2 + 
           peer * agreeW1P1 + aa * agreeW1P2

agree2 =~ agreeW2S1        + a * agreeW2S2 + 
           peer * agreeW2P1 + aa * agreeW2P2

agree3 =~ agreeW3S1        + a * agreeW3S2 + 
           peer * agreeW3P1 + aa * agreeW3P2
  
agree4 =~ agreeW4S1        + a * agreeW4S2 + 
           peer * agreeW4P1 + aa * agreeW4P2

# structural paths between time points 
agree4 ~ agree3
agree3 ~ agree2
agree2 ~ agree1

# error covariance - similar parcels across waves
agreeW1S1 ~~ agreeW2S1 + agreeW3S1 + agreeW4S1
agreeW2S1 ~~ agreeW3S1 + agreeW4S1
agreeW3S1 ~~ agreeW4S1

agreeW1S2 ~~ agreeW2S2 + agreeW3S2 + agreeW4S2
agreeW2S2 ~~ agreeW3S2 + agreeW4S2
agreeW3S2 ~~ agreeW4S2

agreeW1P1 ~~ agreeW2P1 + agreeW3P1 + agreeW4P1
agreeW2P1 ~~ agreeW3P1 + agreeW4P1
agreeW3P1 ~~ agreeW4P1

agreeW1P2 ~~ agreeW2P2 + agreeW3P2 + agreeW4P2
agreeW2P2 ~~ agreeW3P2 + agreeW4P2
agreeW3P2 ~~ agreeW4P2

# error covariance - same method at one wave
agreeW1S1 ~~ agreeW1S2
agreeW1P1 ~~ agreeW1P2
agreeW2S1 ~~ agreeW2S2
agreeW2P1 ~~ agreeW2P2
agreeW3S1 ~~ agreeW3S2
agreeW3P1 ~~ agreeW3P2
agreeW4S1 ~~ agreeW4S2
agreeW4P1 ~~ agreeW4P2
'
lsmAgree <- sem(lsmAgree, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lsmAgree, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 323 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree1 =~                                                             
##     agrW1S1           1.000                               2.022    0.944
##     agrW1S2    (a)    1.115       NA                      2.255    0.948
##     agrW1P1 (peer)    1.074       NA                      2.172    0.927
##     agrW1P2   (aa)    0.985       NA                      1.991    0.948
##   agree2 =~                                                             
##     agrW2S1           1.000                               3.116    0.996
##     agrW2S2    (a)    1.115       NA                      3.475    0.992
##     agrW2P1 (peer)    1.074       NA                      3.347    0.983
##     agrW2P2   (aa)    0.985       NA                      3.068    0.981
##   agree3 =~                                                             
##     agrW3S1           1.000                               3.116    0.988
##     agrW3S2    (a)    1.115       NA                      3.476    0.989
##     agrW3P1 (peer)    1.074       NA                      3.347    0.981
##     agrW3P2   (aa)    0.985       NA                      3.069    0.981
##   agree4 =~                                                             
##     agrW4S1           1.000                               3.152    0.990
##     agrW4S2    (a)    1.115       NA                      3.516    0.984
##     agrW4P1 (peer)    1.074       NA                      3.386    0.979
##     agrW4P2   (aa)    0.985       NA                      3.104    0.979
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   agree4 ~                                                              
##     agree3            1.011       NA                      0.999    0.999
##   agree3 ~                                                              
##     agree2            1.000       NA                      1.000    1.000
##   agree2 ~                                                              
##     agree1            1.522       NA                      0.988    0.988
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .agreeW1S1 ~~                                                          
##    .agreeW2S1         0.036       NA                      0.036    0.193
##    .agreeW3S1         0.049       NA                      0.049    0.143
##    .agreeW4S1        -0.013       NA                     -0.013   -0.041
##  .agreeW2S1 ~~                                                          
##    .agreeW3S1         0.030       NA                      0.030    0.230
##    .agreeW4S1         0.022       NA                      0.022    0.180
##  .agreeW3S1 ~~                                                          
##    .agreeW4S1         0.029       NA                      0.029    0.135
##  .agreeW1S2 ~~                                                          
##    .agreeW2S2         0.121       NA                      0.121    0.361
##    .agreeW3S2         0.111       NA                      0.111    0.286
##    .agreeW4S2         0.151       NA                      0.151    0.311
##  .agreeW2S2 ~~                                                          
##    .agreeW3S2         0.079       NA                      0.079    0.344
##    .agreeW4S2         0.056       NA                      0.056    0.197
##  .agreeW3S2 ~~                                                          
##    .agreeW4S2         0.121       NA                      0.121    0.366
##  .agreeW1P1 ~~                                                          
##    .agreeW2P1        -0.036       NA                     -0.036   -0.065
##    .agreeW3P1         0.051       NA                      0.051    0.088
##    .agreeW4P1         0.090       NA                      0.090    0.146
##  .agreeW2P1 ~~                                                          
##    .agreeW3P1         0.041       NA                      0.041    0.098
##    .agreeW4P1         0.154       NA                      0.154    0.349
##  .agreeW3P1 ~~                                                          
##    .agreeW4P1         0.222       NA                      0.222    0.481
##  .agreeW1P2 ~~                                                          
##    .agreeW2P2         0.291       NA                      0.291    0.711
##    .agreeW3P2         0.291       NA                      0.291    0.711
##    .agreeW4P2         0.314       NA                      0.314    0.715
##  .agreeW2P2 ~~                                                          
##    .agreeW3P2         0.370       NA                      0.370    1.000
##    .agreeW4P2         0.403       NA                      0.403    1.012
##  .agreeW3P2 ~~                                                          
##    .agreeW4P2         0.403       NA                      0.403    1.012
##  .agreeW1S1 ~~                                                          
##    .agreeW1S2         0.417       NA                      0.417    0.778
##  .agreeW1P1 ~~                                                          
##    .agreeW1P2         0.415       NA                      0.415    0.703
##  .agreeW2S1 ~~                                                          
##    .agreeW2S2         0.036       NA                      0.036    0.302
##  .agreeW2P1 ~~                                                          
##    .agreeW2P2         0.000       NA                      0.000    0.000
##  .agreeW3S1 ~~                                                          
##    .agreeW3S2         0.148       NA                      0.148    0.598
##  .agreeW3P1 ~~                                                          
##    .agreeW3P2         0.000       NA                      0.000    0.000
##  .agreeW4S1 ~~                                                          
##    .agreeW4S2         0.211       NA                      0.211    0.729
##  .agreeW4P1 ~~                                                          
##    .agreeW4P2        -0.005       NA                     -0.005   -0.011
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .agreeW1S1         1.551       NA                      1.551    0.724
##    .agreeW1S2         1.463       NA                      1.463    0.615
##    .agreeW1P1         1.029       NA                      1.029    0.439
##    .agreeW1P2         1.197       NA                      1.197    0.570
##    .agreeW2S1         0.348       NA                      0.348    0.111
##    .agreeW2S2         0.072       NA                      0.072    0.021
##    .agreeW2P1         0.079       NA                      0.079    0.023
##    .agreeW2P2         0.139       NA                      0.139    0.045
##    .agreeW3S1         0.419       NA                      0.419    0.133
##    .agreeW3S2         0.096       NA                      0.096    0.027
##    .agreeW3P1         0.089       NA                      0.089    0.026
##    .agreeW3P2         0.139       NA                      0.139    0.044
##    .agreeW4S1         0.381       NA                      0.381    0.120
##    .agreeW4S2         0.074       NA                      0.074    0.021
##    .agreeW4P1        -0.052       NA                     -0.052   -0.015
##    .agreeW4P2         0.103       NA                      0.103    0.033
##     agree1            0.000                               0.000    0.000
##    .agree2            0.000                               0.000    0.000
##    .agree3            0.000                               0.000    0.000
##    .agree4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .agreeW1S1         0.503       NA                      0.503    0.110
##    .agreeW1S2         0.570       NA                      0.570    0.101
##    .agreeW1P1         0.775       NA                      0.775    0.141
##    .agreeW1P2         0.451       NA                      0.451    0.102
##    .agreeW2S1         0.071       NA                      0.071    0.007
##    .agreeW2S2         0.198       NA                      0.198    0.016
##    .agreeW2P1         0.398       NA                      0.398    0.034
##    .agreeW2P2         0.370       NA                      0.370    0.038
##    .agreeW3S1         0.232       NA                      0.232    0.023
##    .agreeW3S2         0.266       NA                      0.266    0.022
##    .agreeW3P1         0.435       NA                      0.435    0.037
##    .agreeW3P2         0.370       NA                      0.370    0.038
##    .agreeW4S1         0.205       NA                      0.205    0.020
##    .agreeW4S2         0.410       NA                      0.410    0.032
##    .agreeW4P1         0.489       NA                      0.489    0.041
##    .agreeW4P2         0.427       NA                      0.427    0.042
##     agree1            4.087       NA                      1.000    1.000
##    .agree2            0.237       NA                      0.024    0.024
##    .agree3            0.000       NA                      0.000    0.000
##    .agree4            0.015       NA                      0.002    0.002
semPaths(lsmAgree, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Conscientiousness

with aspects as parcels

lsmConsci <- '

# factor at each time point with same loading
consci1 =~ indusW1S        + a * orderW1S + 
          peer * indusW1P + aa * orderW1P

consci2 =~ indusW2S        + a * orderW2S + 
          peer * indusW2P + aa * orderW2P

consci3 =~ indusW3S        + a * orderW3S + 
          peer * indusW3P + aa * orderW3P
  
consci4 =~ indusW4S        + a * orderW4S + 
          peer * indusW4P + aa * orderW4P

# structural paths between time points 
consci4 ~ consci3
consci3 ~ consci2
consci2 ~ consci1

# error covariance - similar aspects across waves and informants
indusW1S ~~ indusW2S + indusW3S + indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW2S ~~ indusW3S + indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW3S ~~ indusW4S +
            indusW1P + indusW2P + indusW3P + indusW4P
indusW4S ~~ indusW1P + indusW2P + indusW3P + indusW4P

orderW1S ~~ orderW2S + orderW3S + orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW2S ~~ orderW3S + orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW3S ~~ orderW4S +
            orderW1P + orderW2P + orderW3P + orderW4P
orderW4S ~~ orderW1P + orderW2P + orderW3P + orderW4P

indusW1P ~~ indusW2P + indusW3P + indusW4P
indusW2P ~~ indusW3P + indusW4P
indusW3P ~~ indusW4P

orderW1P ~~ orderW2P + orderW3P + orderW4P
orderW2P ~~ orderW3P + orderW4P
orderW3P ~~ orderW4P
'
lsmConsci <- sem(lsmConsci, data = data, missing = "ML")
summary(lsmConsci, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 221 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        107
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               111.782
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2107.030
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.971
##   Tucker-Lewis Index (TLI)                       0.935
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1335.933
##   Loglikelihood unrestricted model (H1)      -1280.042
##                                                       
##   Akaike (AIC)                                2867.866
##   Bayesian (BIC)                              3216.436
##   Sample-size adjusted Bayesian (BIC)         2905.740
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.064
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.081
##   P-value RMSEA <= 0.05                          0.081
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.079
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci1 =~                                                            
##     indsW1S           1.000                               0.219    0.364
##     ordrW1S    (a)    0.820       NA                      0.179    0.289
##     indsW1P (peer)    2.433    0.866    2.810    0.005    0.532    0.861
##     ordrW1P   (aa)    1.695       NA                      0.371    0.584
##   consci2 =~                                                            
##     indsW2S           1.000                               0.207    0.334
##     ordrW2S    (a)    0.820       NA                      0.170    0.304
##     indsW2P (peer)    2.433    0.866    2.810    0.005    0.504    0.828
##     ordrW2P   (aa)    1.695       NA                      0.351    0.611
##   consci3 =~                                                            
##     indsW3S           1.000                               0.191    0.326
##     ordrW3S    (a)    0.820       NA                      0.157    0.269
##     indsW3P (peer)    2.433    0.866    2.810    0.005    0.465    0.739
##     ordrW3P   (aa)    1.695       NA                      0.324    0.514
##   consci4 =~                                                            
##     indsW4S           1.000                               0.188    0.318
##     ordrW4S    (a)    0.820       NA                      0.154    0.247
##     indsW4P (peer)    2.433    0.866    2.810    0.005    0.457    0.790
##     ordrW4P   (aa)    1.695       NA                      0.318    0.528
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci4 ~                                                             
##     consci3           0.871    0.105    8.324    0.000    0.886    0.886
##   consci3 ~                                                             
##     consci2           0.870    0.088    9.838    0.000    0.943    0.943
##   consci2 ~                                                             
##     consci1           0.759    0.081    9.354    0.000    0.801    0.801
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .indusW1S ~~                                                           
##    .indusW2S          0.250       NA                      0.250    0.765
##    .indusW3S          0.213       NA                      0.213    0.686
##    .indusW4S          0.219       NA                      0.219    0.699
##    .indusW1P          0.005       NA                      0.005    0.029
##    .indusW2P          0.032       NA                      0.032    0.165
##    .indusW3P          0.041       NA                      0.041    0.174
##    .indusW4P          0.019       NA                      0.019    0.095
##  .indusW2S ~~                                                           
##    .indusW3S          0.257       NA                      0.257    0.792
##    .indusW4S          0.268       NA                      0.268    0.820
##  .indusW1P ~~                                                           
##    .indusW2S          0.010       NA                      0.010    0.052
##  .indusW2S ~~                                                           
##    .indusW2P          0.035       NA                      0.035    0.177
##    .indusW3P          0.058       NA                      0.058    0.233
##    .indusW4P          0.036       NA                      0.036    0.174
##  .indusW3S ~~                                                           
##    .indusW4S          0.263       NA                      0.263    0.846
##  .indusW1P ~~                                                           
##    .indusW3S          0.006       NA                      0.006    0.033
##  .indusW2P ~~                                                           
##    .indusW3S          0.030       NA                      0.030    0.161
##  .indusW3S ~~                                                           
##    .indusW3P          0.016       NA                      0.016    0.068
##    .indusW4P          0.002       NA                      0.002    0.009
##  .indusW1P ~~                                                           
##    .indusW4S          0.036       NA                      0.036    0.203
##  .indusW2P ~~                                                           
##    .indusW4S          0.053       NA                      0.053    0.280
##  .indusW3P ~~                                                           
##    .indusW4S          0.026       NA                      0.026    0.111
##  .indusW4S ~~                                                           
##    .indusW4P          0.011       NA                      0.011    0.055
##  .orderW1S ~~                                                           
##    .orderW2S          0.237       NA                      0.237    0.750
##    .orderW3S          0.252       NA                      0.252    0.757
##    .orderW4S          0.237       NA                      0.237    0.661
##    .orderW1P          0.077       NA                      0.077    0.253
##    .orderW2P          0.111       NA                      0.111    0.412
##    .orderW3P          0.082       NA                      0.082    0.257
##    .orderW4P          0.095       NA                      0.095    0.314
##  .orderW2S ~~                                                           
##    .orderW3S          0.243       NA                      0.243    0.816
##    .orderW4S          0.238       NA                      0.238    0.741
##  .orderW1P ~~                                                           
##    .orderW2S          0.094       NA                      0.094    0.343
##  .orderW2S ~~                                                           
##    .orderW2P          0.100       NA                      0.100    0.413
##    .orderW3P          0.084       NA                      0.084    0.291
##    .orderW4P          0.085       NA                      0.085    0.313
##  .orderW3S ~~                                                           
##    .orderW4S          0.274       NA                      0.274    0.806
##  .orderW1P ~~                                                           
##    .orderW3S          0.088       NA                      0.088    0.306
##  .orderW2P ~~                                                           
##    .orderW3S          0.123       NA                      0.123    0.481
##  .orderW3S ~~                                                           
##    .orderW3P          0.074       NA                      0.074    0.244
##    .orderW4P          0.095       NA                      0.095    0.330
##  .orderW1P ~~                                                           
##    .orderW4S          0.101       NA                      0.101    0.326
##  .orderW2P ~~                                                           
##    .orderW4S          0.134       NA                      0.134    0.485
##  .orderW3P ~~                                                           
##    .orderW4S          0.107       NA                      0.107    0.326
##  .orderW4S ~~                                                           
##    .orderW4P          0.117       NA                      0.117    0.377
##  .indusW1P ~~                                                           
##    .indusW2P          0.040       NA                      0.040    0.373
##    .indusW3P          0.080       NA                      0.080    0.599
##    .indusW4P          0.076       NA                      0.076    0.684
##  .indusW2P ~~                                                           
##    .indusW3P          0.089       NA                      0.089    0.619
##    .indusW4P          0.086       NA                      0.086    0.713
##  .indusW3P ~~                                                           
##    .indusW4P          0.120       NA                      0.120    0.798
##  .orderW1P ~~                                                           
##    .orderW2P          0.168       NA                      0.168    0.718
##    .orderW3P          0.215       NA                      0.215    0.774
##    .orderW4P          0.164       NA                      0.164    0.621
##  .orderW2P ~~                                                           
##    .orderW3P          0.190       NA                      0.190    0.773
##    .orderW4P          0.165       NA                      0.165    0.707
##  .orderW3P ~~                                                           
##    .orderW4P          0.217       NA                      0.217    0.782
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S          3.183    0.037   85.257    0.000    3.183    5.301
##    .orderW1S          3.563    0.039   92.392    0.000    3.563    5.745
##    .indusW1P          3.699    0.048   76.985    0.000    3.699    5.985
##    .orderW1P          3.375    0.049   69.411    0.000    3.375    5.320
##    .indusW2S          3.137    0.041   77.123    0.000    3.137    5.062
##    .orderW2S          3.638    0.037   98.978    0.000    3.638    6.519
##    .indusW2P          3.668    0.047   77.303    0.000    3.668    6.028
##    .orderW2P          3.460    0.044   79.166    0.000    3.460    6.021
##    .indusW3S          3.173    0.039   80.732    0.000    3.173    5.407
##    .orderW3S          3.625    0.038   94.240    0.000    3.625    6.221
##    .indusW3P          3.692    0.049   74.637    0.000    3.692    5.872
##    .orderW3P          3.379    0.049   68.376    0.000    3.379    5.363
##    .indusW4S          3.186    0.041   77.790    0.000    3.186    5.395
##    .orderW4S          3.650    0.044   82.402    0.000    3.650    5.847
##    .indusW4P          3.610    0.048   74.892    0.000    3.610    6.243
##    .orderW4P          3.314    0.051   64.476    0.000    3.314    5.489
##     consci1           0.000                               0.000    0.000
##    .consci2           0.000                               0.000    0.000
##    .consci3           0.000                               0.000    0.000
##    .consci4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S          0.313       NA                      0.313    0.867
##    .orderW1S          0.352       NA                      0.352    0.916
##    .indusW1P          0.099       NA                      0.099    0.259
##    .orderW1P          0.265       NA                      0.265    0.659
##    .indusW2S          0.341       NA                      0.341    0.888
##    .orderW2S          0.283       NA                      0.283    0.907
##    .indusW2P          0.117       NA                      0.117    0.315
##    .orderW2P          0.207       NA                      0.207    0.627
##    .indusW3S          0.308       NA                      0.308    0.894
##    .orderW3S          0.315       NA                      0.315    0.928
##    .indusW3P          0.179       NA                      0.179    0.454
##    .orderW3P          0.292       NA                      0.292    0.736
##    .indusW4S          0.314       NA                      0.314    0.899
##    .orderW4S          0.366       NA                      0.366    0.939
##    .indusW4P          0.126       NA                      0.126    0.376
##    .orderW4P          0.263       NA                      0.263    0.722
##     consci1           0.048       NA                      1.000    1.000
##    .consci2           0.015       NA                      0.358    0.358
##    .consci3           0.004       NA                      0.111    0.111
##    .consci4           0.008       NA                      0.214    0.214
semPaths(lsmConsci, what = "col", whatLabels = "est", structural = T, layout = "spring")

with random parcels

lsmconsci <- '

# factor at each time point with same loading
consci1 =~ consciW1S1        + a * consciW1S2 + 
           peer * consciW1P1 + aa * consciW1P2

consci2 =~ consciW2S1        + a * consciW2S2 + 
           peer * consciW2P1 + aa * consciW2P2

consci3 =~ consciW3S1        + a * consciW3S2 + 
           peer * consciW3P1 + aa * consciW3P2
  
consci4 =~ consciW4S1        + a * consciW4S2 + 
           peer * consciW4P1 + aa * consciW4P2

# structural paths between time points 
consci4 ~ consci3
consci3 ~ consci2
consci2 ~ consci1

# error covariance - similar parcels across waves
consciW1S1 ~~ consciW2S1 + consciW3S1 + consciW4S1
consciW2S1 ~~ consciW3S1 + consciW4S1
consciW3S1 ~~ consciW4S1

consciW1S2 ~~ consciW2S2 + consciW3S2 + consciW4S2
consciW2S2 ~~ consciW3S2 + consciW4S2
consciW3S2 ~~ consciW4S2

consciW1P1 ~~ consciW2P1 + consciW3P1 + consciW4P1
consciW2P1 ~~ consciW3P1 + consciW4P1
consciW3P1 ~~ consciW4P1

consciW1P2 ~~ consciW2P2 + consciW3P2 + consciW4P2
consciW2P2 ~~ consciW3P2 + consciW4P2
consciW3P2 ~~ consciW4P2

# error covariance - same method at one wave
consciW1S1 ~~ consciW1S2
consciW1P1 ~~ consciW1P2
consciW2S1 ~~ consciW2S2
consciW2P1 ~~ consciW2P2
consciW3S1 ~~ consciW3S2
consciW3P1 ~~ consciW3P2
consciW4S1 ~~ consciW4S2
consciW4P1 ~~ consciW4P2
'
lsmconsci <- sem(lsmconsci, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lsmconsci, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 427 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci1 =~                                                            
##     cnsW1S1           1.000                               1.891    0.959
##     cnsW1S2    (a)    1.038       NA                      1.964    0.970
##     cnsW1P1 (peer)    1.154       NA                      2.182    0.929
##     cnsW1P2   (aa)    0.976       NA                      1.846    0.968
##   consci2 =~                                                            
##     cnsW2S1           1.000                               2.814    0.985
##     cnsW2S2    (a)    1.038       NA                      2.922    0.993
##     cnsW2P1 (peer)    1.154       NA                      3.248    0.982
##     cnsW2P2   (aa)    0.976       NA                      2.746    0.976
##   consci3 =~                                                            
##     cnsW3S1           1.000                               2.813    0.989
##     cnsW3S2    (a)    1.038       NA                      2.921    0.988
##     cnsW3P1 (peer)    1.154       NA                      3.246    0.985
##     cnsW3P2   (aa)    0.976       NA                      2.745    0.976
##   consci4 =~                                                            
##     cnsW4S1           1.000                               2.839    0.982
##     cnsW4S2    (a)    1.038       NA                      2.948    0.987
##     cnsW4P1 (peer)    1.154       NA                      3.277    0.979
##     cnsW4P2   (aa)    0.976       NA                      2.771    0.976
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   consci4 ~                                                             
##     consci3           1.009       NA                      1.000    1.000
##   consci3 ~                                                             
##     consci2           0.999       NA                      1.000    1.000
##   consci2 ~                                                             
##     consci1           1.491       NA                      1.002    1.002
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .consciW1S1 ~~                                                         
##    .consciW2S1        0.117       NA                      0.117    0.430
##    .consciW3S1        0.081       NA                      0.081    0.342
##    .consciW4S1        0.172       NA                      0.172    0.560
##  .consciW2S1 ~~                                                         
##    .consciW3S1        0.084       NA                      0.084    0.403
##    .consciW4S1        0.199       NA                      0.199    0.738
##  .consciW3S1 ~~                                                         
##    .consciW4S1        0.156       NA                      0.156    0.663
##  .consciW1S2 ~~                                                         
##    .consciW2S2        0.030       NA                      0.030    0.186
##    .consciW3S2        0.092       NA                      0.092    0.414
##    .consciW4S2        0.085       NA                      0.085    0.358
##  .consciW2S2 ~~                                                         
##    .consciW3S2        0.074       NA                      0.074    0.486
##    .consciW4S2        0.073       NA                      0.073    0.451
##  .consciW3S2 ~~                                                         
##    .consciW4S2        0.160       NA                      0.160    0.722
##  .consciW1P1 ~~                                                         
##    .consciW2P1        0.022       NA                      0.022    0.041
##    .consciW3P1        0.216       NA                      0.216    0.442
##    .consciW4P1        0.134       NA                      0.134    0.227
##  .consciW2P1 ~~                                                         
##    .consciW3P1        0.030       NA                      0.030    0.085
##    .consciW4P1        0.297       NA                      0.297    0.706
##  .consciW3P1 ~~                                                         
##    .consciW4P1        0.070       NA                      0.070    0.183
##  .consciW1P2 ~~                                                         
##    .consciW2P2        0.223       NA                      0.223    0.759
##    .consciW3P2        0.223       NA                      0.223    0.759
##    .consciW4P2        0.225       NA                      0.225    0.756
##  .consciW2P2 ~~                                                         
##    .consciW3P2        0.373       NA                      0.373    1.000
##    .consciW4P2        0.377       NA                      0.377    1.001
##  .consciW3P2 ~~                                                         
##    .consciW4P2        0.377       NA                      0.377    1.001
##  .consciW1S1 ~~                                                         
##    .consciW1S2        0.159       NA                      0.159    0.585
##  .consciW1P1 ~~                                                         
##    .consciW1P2        0.212       NA                      0.212    0.506
##  .consciW2S1 ~~                                                         
##    .consciW2S2        0.048       NA                      0.048    0.294
##  .consciW2P1 ~~                                                         
##    .consciW2P2       -0.000       NA                     -0.000   -0.000
##  .consciW3S1 ~~                                                         
##    .consciW3S2        0.051       NA                      0.051    0.261
##  .consciW3P1 ~~                                                         
##    .consciW3P2       -0.000       NA                     -0.000   -0.000
##  .consciW4S1 ~~                                                         
##    .consciW4S2        0.010       NA                      0.010    0.036
##  .consciW4P1 ~~                                                         
##    .consciW4P2        0.002       NA                      0.002    0.005
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .consciW1S1        1.187       NA                      1.187    0.602
##    .consciW1S2        1.307       NA                      1.307    0.646
##    .consciW1P1        1.163       NA                      1.163    0.495
##    .consciW1P2        1.232       NA                      1.232    0.646
##    .consciW2S1        0.163       NA                      0.163    0.057
##    .consciW2S2        0.214       NA                      0.214    0.073
##    .consciW2P1        0.104       NA                      0.104    0.031
##    .consciW2P2        0.245       NA                      0.245    0.087
##    .consciW3S1        0.177       NA                      0.177    0.062
##    .consciW3S2        0.214       NA                      0.214    0.072
##    .consciW3P1        0.244       NA                      0.244    0.074
##    .consciW3P2        0.247       NA                      0.247    0.088
##    .consciW4S1        0.162       NA                      0.162    0.056
##    .consciW4S2        0.188       NA                      0.188    0.063
##    .consciW4P1       -0.049       NA                     -0.049   -0.015
##    .consciW4P2        0.216       NA                      0.216    0.076
##     consci1           0.000                               0.000    0.000
##    .consci2           0.000                               0.000    0.000
##    .consci3           0.000                               0.000    0.000
##    .consci4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .consciW1S1        0.309       NA                      0.309    0.079
##    .consciW1S2        0.239       NA                      0.239    0.058
##    .consciW1P1        0.755       NA                      0.755    0.137
##    .consciW1P2        0.232       NA                      0.232    0.064
##    .consciW2S1        0.239       NA                      0.239    0.029
##    .consciW2S2        0.112       NA                      0.112    0.013
##    .consciW2P1        0.385       NA                      0.385    0.035
##    .consciW2P2        0.374       NA                      0.374    0.047
##    .consciW3S1        0.182       NA                      0.182    0.023
##    .consciW3S2        0.207       NA                      0.207    0.024
##    .consciW3P1        0.315       NA                      0.315    0.029
##    .consciW3P2        0.373       NA                      0.373    0.047
##    .consciW4S1        0.305       NA                      0.305    0.036
##    .consciW4S2        0.236       NA                      0.236    0.026
##    .consciW4P1        0.462       NA                      0.462    0.041
##    .consciW4P2        0.381       NA                      0.381    0.047
##     consci1           3.576       NA                      1.000    1.000
##    .consci2          -0.027       NA                     -0.003   -0.003
##    .consci3          -0.000       NA                     -0.000   -0.000
##    .consci4           0.001       NA                      0.000    0.000
semPaths(lsmconsci, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Extraversion

with aspects as parcels

lsmExtra <- '

# factor at each time point with same loading
extra1 =~ assertW1S        + a * enthuW1S + 
          peer * assertW1P + aa * enthuW1P

extra2 =~ assertW2S        + a * enthuW2S + 
          peer * assertW2P + aa * enthuW2P

extra3 =~ assertW3S        + a * enthuW3S + 
          peer * assertW3P + aa * enthuW3P
  
extra4 =~ assertW4S        + a * enthuW4S + 
          peer * assertW4P + aa * enthuW4P

# structural paths between time points 
extra4 ~ extra3
extra3 ~ extra2
extra2 ~ extra1

# error covariance - similar aspects across waves and informants
assertW1S ~~ assertW2S + assertW3S + assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW2S ~~ assertW3S + assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW3S ~~ assertW4S +
            assertW1P + assertW2P + assertW3P + assertW4P
assertW4S ~~ assertW1P + assertW2P + assertW3P + assertW4P

enthuW1S ~~ enthuW2S + enthuW3S + enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW2S ~~ enthuW3S + enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW3S ~~ enthuW4S +
            enthuW1P + enthuW2P + enthuW3P + enthuW4P
enthuW4S ~~ enthuW1P + enthuW2P + enthuW3P + enthuW4P

assertW1P ~~ assertW2P + assertW3P + assertW4P
assertW2P ~~ assertW3P + assertW4P
assertW3P ~~ assertW4P

enthuW1P ~~ enthuW2P + enthuW3P + enthuW4P
enthuW2P ~~ enthuW3P + enthuW4P
enthuW3P ~~ enthuW4P
'
lsmExtra <- sem(lsmExtra, data = data, missing = "ML")
summary(lsmExtra, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 254 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        107
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               118.553
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2412.811
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.972
##   Tucker-Lewis Index (TLI)                       0.937
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1261.787
##   Loglikelihood unrestricted model (H1)      -1202.510
##                                                       
##   Akaike (AIC)                                2719.573
##   Bayesian (BIC)                              3068.142
##   Sample-size adjusted Bayesian (BIC)         2757.447
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.068
##   90 Percent confidence interval - lower         0.051
##   90 Percent confidence interval - upper         0.085
##   P-value RMSEA <= 0.05                          0.038
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.176
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   extra1 =~                                                             
##     assrW1S           1.000                               0.291    0.432
##     enthW1S    (a)    0.701   40.976    0.017    0.986    0.204    0.323
##     assrW1P (peer)   -0.907    0.242   -3.751    0.000   -0.264   -0.444
##     enthW1P   (aa)   -0.561   32.784   -0.017    0.986   -0.163   -0.265
##   extra2 =~                                                             
##     assrW2S           1.000                               0.304    0.447
##     enthW2S    (a)    0.701   40.976    0.017    0.986    0.213    0.336
##     assrW2P (peer)   -0.907    0.242   -3.751    0.000   -0.276   -0.482
##     enthW2P   (aa)   -0.561   32.784   -0.017    0.986   -0.171   -0.286
##   extra3 =~                                                             
##     assrW3S           1.000                               0.310    0.460
##     enthW3S    (a)    0.701   40.976    0.017    0.986    0.218    0.343
##     assrW3P (peer)   -0.907    0.242   -3.751    0.000   -0.282   -0.497
##     enthW3P   (aa)   -0.561   32.784   -0.017    0.986   -0.174   -0.337
##   extra4 =~                                                             
##     assrW4S           1.000                               0.329    0.480
##     enthW4S    (a)    0.701   40.976    0.017    0.986    0.231    0.354
##     assrW4P (peer)   -0.907    0.242   -3.751    0.000   -0.298   -0.574
##     enthW4P   (aa)   -0.561   32.784   -0.017    0.986   -0.185   -0.376
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   extra4 ~                                                              
##     extra3            0.978    0.101    9.645    0.000    0.922    0.922
##   extra3 ~                                                              
##     extra2            0.817    0.115    7.101    0.000    0.799    0.799
##   extra2 ~                                                              
##     extra1            0.811    0.112    7.210    0.000    0.776    0.776
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .assertW1S ~~                                                          
##    .assertW2S         0.315    4.002    0.079    0.937    0.315    0.854
##    .assertW3S         0.318    3.268    0.097    0.922    0.318    0.875
##    .assertW4S         0.296    3.194    0.093    0.926    0.296    0.812
##    .assertW1P         0.247    4.478    0.055    0.956    0.247    0.766
##    .assertW2P         0.213    3.629    0.059    0.953    0.213    0.702
##    .assertW3P         0.195    2.964    0.066    0.948    0.195    0.653
##    .assertW4P         0.169    2.897    0.058    0.953    0.169    0.654
##  .assertW2S ~~                                                          
##    .assertW3S         0.325    4.403    0.074    0.941    0.325    0.893
##    .assertW4S         0.315    4.304    0.073    0.942    0.315    0.863
##  .assertW1P ~~                                                          
##    .assertW2S         0.237    3.629    0.065    0.948    0.237    0.732
##  .assertW2S ~~                                                          
##    .assertW2P         0.238    4.890    0.049    0.961    0.238    0.781
##    .assertW3P         0.209    3.993    0.052    0.958    0.209    0.702
##    .assertW4P         0.173    3.904    0.044    0.965    0.173    0.670
##  .assertW3S ~~                                                          
##    .assertW4S         0.321    5.502    0.058    0.954    0.321    0.888
##  .assertW1P ~~                                                          
##    .assertW3S         0.201    2.964    0.068    0.946    0.201    0.630
##  .assertW2P ~~                                                          
##    .assertW3S         0.200    3.993    0.050    0.960    0.200    0.664
##  .assertW3S ~~                                                          
##    .assertW3P         0.201    5.105    0.039    0.969    0.201    0.682
##    .assertW4P         0.173    4.990    0.035    0.972    0.173    0.675
##  .assertW1P ~~                                                          
##    .assertW4S         0.203    2.897    0.070    0.944    0.203    0.635
##  .assertW2P ~~                                                          
##    .assertW4S         0.208    3.904    0.053    0.958    0.208    0.689
##  .assertW3P ~~                                                          
##    .assertW4S         0.197    4.990    0.040    0.968    0.197    0.668
##  .assertW4S ~~                                                          
##    .assertW4P         0.205    5.738    0.036    0.972    0.205    0.799
##  .enthuW1S ~~                                                           
##    .enthuW2S          0.281    1.969    0.143    0.887    0.281    0.788
##    .enthuW3S          0.257    1.608    0.160    0.873    0.257    0.721
##    .enthuW4S          0.269    1.572    0.171    0.864    0.269    0.738
##    .enthuW1P          0.188    1.944    0.097    0.923    0.188    0.530
##    .enthuW2P          0.175    1.576    0.111    0.912    0.175    0.514
##    .enthuW3P          0.130    1.287    0.101    0.920    0.130    0.448
##    .enthuW4P          0.083    1.258    0.066    0.947    0.083    0.307
##  .enthuW2S ~~                                                           
##    .enthuW3S          0.298    2.167    0.137    0.891    0.298    0.837
##    .enthuW4S          0.297    2.118    0.140    0.888    0.297    0.816
##  .enthuW1P ~~                                                           
##    .enthuW2S          0.172    1.576    0.109    0.913    0.172    0.487
##  .enthuW2S ~~                                                           
##    .enthuW2P          0.183    2.123    0.086    0.931    0.183    0.536
##    .enthuW3P          0.139    1.734    0.080    0.936    0.139    0.479
##    .enthuW4P          0.067    1.695    0.039    0.969    0.067    0.245
##  .enthuW3S ~~                                                           
##    .enthuW4S          0.305    2.708    0.113    0.910    0.305    0.839
##  .enthuW1P ~~                                                           
##    .enthuW3S          0.190    1.287    0.148    0.882    0.190    0.539
##  .enthuW2P ~~                                                           
##    .enthuW3S          0.199    1.734    0.115    0.908    0.199    0.586
##  .enthuW3S ~~                                                           
##    .enthuW3P          0.147    2.216    0.066    0.947    0.147    0.506
##    .enthuW4P          0.110    2.166    0.051    0.960    0.110    0.404
##  .enthuW1P ~~                                                           
##    .enthuW4S          0.196    1.258    0.156    0.876    0.196    0.542
##  .enthuW2P ~~                                                           
##    .enthuW4S          0.208    1.695    0.123    0.902    0.208    0.596
##  .enthuW3P ~~                                                           
##    .enthuW4S          0.149    2.166    0.069    0.945    0.149    0.503
##  .enthuW4S ~~                                                           
##    .enthuW4P          0.105    2.491    0.042    0.966    0.105    0.377
##  .assertW1P ~~                                                          
##    .assertW2P         0.207    3.292    0.063    0.950    0.207    0.777
##    .assertW3P         0.214    2.688    0.080    0.936    0.214    0.820
##    .assertW4P         0.179    2.628    0.068    0.946    0.179    0.789
##  .assertW2P ~~                                                          
##    .assertW3P         0.214    3.622    0.059    0.953    0.214    0.869
##    .assertW4P         0.180    3.540    0.051    0.959    0.180    0.845
##  .assertW3P ~~                                                          
##    .assertW4P         0.167    4.526    0.037    0.971    0.167    0.797
##  .enthuW1P ~~                                                           
##    .enthuW2P          0.276    1.261    0.219    0.827    0.276    0.815
##    .enthuW3P          0.223    1.030    0.216    0.829    0.223    0.772
##    .enthuW4P          0.181    1.007    0.180    0.857    0.181    0.670
##  .enthuW2P ~~                                                           
##    .enthuW3P          0.219    1.387    0.158    0.875    0.219    0.788
##    .enthuW4P          0.180    1.356    0.133    0.894    0.180    0.693
##  .enthuW3P ~~                                                           
##    .enthuW4P          0.174    1.733    0.101    0.920    0.174    0.788
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S         3.461    0.042   82.755    0.000    3.461    5.145
##    .enthuW1S          3.729    0.039   95.071    0.000    3.729    5.912
##    .assertW1P         3.587    0.045   79.736    0.000    3.587    6.039
##    .enthuW1P          3.805    0.047   81.626    0.000    3.805    6.189
##    .assertW2S         3.414    0.044   77.620    0.000    3.414    5.028
##    .enthuW2S          3.697    0.041   89.163    0.000    3.697    5.836
##    .assertW2P         3.649    0.044   83.362    0.000    3.649    6.381
##    .enthuW2P          3.814    0.046   83.527    0.000    3.814    6.398
##    .assertW3S         3.409    0.044   77.471    0.000    3.409    5.046
##    .enthuW3S          3.675    0.042   87.074    0.000    3.675    5.792
##    .assertW3P         3.613    0.044   82.141    0.000    3.613    6.384
##    .enthuW3P          3.853    0.041   94.328    0.000    3.853    7.461
##    .assertW4S         3.454    0.047   73.710    0.000    3.454    5.038
##    .enthuW4S          3.734    0.045   82.923    0.000    3.734    5.724
##    .assertW4P         3.619    0.043   84.431    0.000    3.619    6.958
##    .enthuW4P          3.816    0.042   90.519    0.000    3.816    7.768
##     extra1            0.000                               0.000    0.000
##    .extra2            0.000                               0.000    0.000
##    .extra3            0.000                               0.000    0.000
##    .extra4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S         0.368    4.937    0.075    0.941    0.368    0.813
##    .enthuW1S          0.356    2.430    0.147    0.883    0.356    0.895
##    .assertW1P         0.283    4.061    0.070    0.944    0.283    0.803
##    .enthuW1P          0.351    1.556    0.226    0.821    0.351    0.930
##    .assertW2S         0.369    5.392    0.068    0.945    0.369    0.800
##    .enthuW2S          0.356    2.654    0.134    0.893    0.356    0.887
##    .assertW2P         0.251    4.435    0.057    0.955    0.251    0.768
##    .enthuW2P          0.326    1.699    0.192    0.848    0.326    0.918
##    .assertW3S         0.360    5.628    0.064    0.949    0.360    0.789
##    .enthuW3S          0.355    2.770    0.128    0.898    0.355    0.882
##    .assertW3P         0.241    4.630    0.052    0.958    0.241    0.753
##    .enthuW3P          0.236    1.773    0.133    0.894    0.236    0.886
##    .assertW4S         0.362    6.327    0.057    0.954    0.362    0.770
##    .enthuW4S          0.372    3.113    0.120    0.905    0.372    0.875
##    .assertW4P         0.181    5.204    0.035    0.972    0.181    0.671
##    .enthuW4P          0.207    1.993    0.104    0.917    0.207    0.859
##     extra1            0.085    4.937    0.017    0.986    1.000    1.000
##    .extra2            0.037    2.148    0.017    0.986    0.398    0.398
##    .extra3            0.035    2.033    0.017    0.986    0.361    0.361
##    .extra4            0.016    0.948    0.017    0.986    0.150    0.150
semPaths(lsmExtra, what = "col", whatLabels = "est", structural = T, layout = "spring")

with random parcels

lsmExtra <- '

# factor at each time point with same loading
extra1 =~ extraW1S1        + a * extraW1S2 + 
           peer * extraW1P1 + aa * extraW1P2

extra2 =~ extraW2S1        + a * extraW2S2 + 
           peer * extraW2P1 + aa * extraW2P2

extra3 =~ extraW3S1        + a * extraW3S2 + 
           peer * extraW3P1 + aa * extraW3P2
  
extra4 =~ extraW4S1        + a * extraW4S2 + 
           peer * extraW4P1 + aa * extraW4P2

# structural paths between time points 
extra4 ~ extra3
extra3 ~ extra2
extra2 ~ extra1

# error covariance - similar parcels across waves
extraW1S1 ~~ extraW2S1 + extraW3S1 + extraW4S1
extraW2S1 ~~ extraW3S1 + extraW4S1
extraW3S1 ~~ extraW4S1

extraW1S2 ~~ extraW2S2 + extraW3S2 + extraW4S2
extraW2S2 ~~ extraW3S2 + extraW4S2
extraW3S2 ~~ extraW4S2

extraW1P1 ~~ extraW2P1 + extraW3P1 + extraW4P1
extraW2P1 ~~ extraW3P1 + extraW4P1
extraW3P1 ~~ extraW4P1

extraW1P2 ~~ extraW2P2 + extraW3P2 + extraW4P2
extraW2P2 ~~ extraW3P2 + extraW4P2
extraW3P2 ~~ extraW4P2

# error covariance - same method at one wave
extraW1S1 ~~ extraW1S2
extraW1P1 ~~ extraW1P2
extraW2S1 ~~ extraW2S2
extraW2P1 ~~ extraW2P2
extraW3S1 ~~ extraW3S2
extraW3P1 ~~ extraW3P2
extraW4S1 ~~ extraW4S2
extraW4P1 ~~ extraW4P2
'
lsmExtra <- sem(lsmExtra, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Error in validObject(.Object): invalid class "Fit" object: invalid object for slot "fx.group" in class "Fit": got class "NULL", should be or extend class "numeric"
summary(lsmExtra, fit.measures = T, standardized = T)
##    Length     Class      Mode 
##         1 character character
semPaths(lsmExtra, what = "col", whatLabels = "est", structural = T, layout = "spring")
## Error in semPlotModel.default("\n\n# factor at each time point with same loading\nextra1 =~ extraW1S1        + a * extraW1S2 + \n           peer * extraW1P1 + aa * extraW1P2\n\nextra2 =~ extraW2S1        + a * extraW2S2 + \n           peer * extraW2P1 + aa * extraW2P2\n\nextra3 =~ extraW3S1        + a * extraW3S2 + \n           peer * extraW3P1 + aa * extraW3P2\n  \nextra4 =~ extraW4S1        + a * extraW4S2 + \n           peer * extraW4P1 + aa * extraW4P2\n\n# structural paths between time points \nextra4 ~ extra3\nextra3 ~ extra2\nextra2 ~ extra1\n\n# error covariance - similar parcels across waves\nextraW1S1 ~~ extraW2S1 + extraW3S1 + extraW4S1\nextraW2S1 ~~ extraW3S1 + extraW4S1\nextraW3S1 ~~ extraW4S1\n\nextraW1S2 ~~ extraW2S2 + extraW3S2 + extraW4S2\nextraW2S2 ~~ extraW3S2 + extraW4S2\nextraW3S2 ~~ extraW4S2\n\nextraW1P1 ~~ extraW2P1 + extraW3P1 + extraW4P1\nextraW2P1 ~~ extraW3P1 + extraW4P1\nextraW3P1 ~~ extraW4P1\n\nextraW1P2 ~~ extraW2P2 + extraW3P2 + extraW4P2\nextraW2P2 ~~ extraW3P2 + extraW4P2\nextraW3P2 ~~ extraW4P2\n\n# error covariance - same method at one wave\nextraW1S1 ~~ extraW1S2\nextraW1P1 ~~ extraW1P2\nextraW2S1 ~~ extraW2S2\nextraW2P1 ~~ extraW2P2\nextraW3S1 ~~ extraW3S2\nextraW3P1 ~~ extraW3P2\nextraW4S1 ~~ extraW4S2\nextraW4P1 ~~ extraW4P2\n", : Input string neither an existing file or Lavaan model.

LSM Neuroticism

with aspects as parcels

lsmNeuro <- '

# factor at each time point with same loading
neuro1 =~ volatW1S        + a * withdW1S + 
          peer * volatW1P + aa * withdW1P

neuro2 =~ volatW2S        + a * withdW2S + 
          peer * volatW2P + aa * withdW2P

neuro3 =~ volatW3S        + a * withdW3S + 
          peer * volatW3P + aa * withdW3P
  
neuro4 =~ volatW4S        + a * withdW4S + 
          peer * volatW4P + aa * withdW4P

# structural paths between time points 
neuro4 ~ neuro3
neuro3 ~ neuro2
neuro2 ~ neuro1

# error covariance - similar aspects across waves and informants
volatW1S ~~ volatW2S + volatW3S + volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW2S ~~ volatW3S + volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW3S ~~ volatW4S +
            volatW1P + volatW2P + volatW3P + volatW4P
volatW4S ~~ volatW1P + volatW2P + volatW3P + volatW4P

withdW1S ~~ withdW2S + withdW3S + withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW2S ~~ withdW3S + withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW3S ~~ withdW4S +
            withdW1P + withdW2P + withdW3P + withdW4P
withdW4S ~~ withdW1P + withdW2P + withdW3P + withdW4P

volatW1P ~~ volatW2P + volatW3P + volatW4P
volatW2P ~~ volatW3P + volatW4P
volatW3P ~~ volatW4P

withdW1P ~~ withdW2P + withdW3P + withdW4P
withdW2P ~~ withdW3P + withdW4P
withdW3P ~~ withdW4P
'
lsmNeuro <- sem(lsmNeuro, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: the covariance matrix of the residuals of the observed
##                 variables (theta) is not positive definite;
##                 use lavInspect(fit, "theta") to investigate.
summary(lsmNeuro, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 190 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        107
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               216.924
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2496.820
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.848
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1657.441
##   Loglikelihood unrestricted model (H1)      -1548.979
##                                                       
##   Akaike (AIC)                                3510.881
##   Bayesian (BIC)                              3859.450
##   Sample-size adjusted Bayesian (BIC)         3548.755
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.108
##   90 Percent confidence interval - lower         0.093
##   90 Percent confidence interval - upper         0.123
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.133
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro1 =~                                                             
##     voltW1S           1.000                               0.571    0.750
##     wthdW1S    (a)    0.705       NA                      0.402    0.579
##     voltW1P (peer)    0.969    0.168    5.754    0.000    0.553    0.704
##     wthdW1P   (aa)    0.638       NA                      0.364    0.537
##   neuro2 =~                                                             
##     voltW2S           1.000                               0.603    0.763
##     wthdW2S    (a)    0.705       NA                      0.425    0.605
##     voltW2P (peer)    0.969    0.168    5.754    0.000    0.585    0.745
##     wthdW2P   (aa)    0.638       NA                      0.385    0.620
##   neuro3 =~                                                             
##     voltW3S           1.000                               0.553    0.742
##     wthdW3S    (a)    0.705       NA                      0.390    0.567
##     voltW3P (peer)    0.969    0.168    5.754    0.000    0.536    0.729
##     wthdW3P   (aa)    0.638       NA                      0.353    0.553
##   neuro4 =~                                                             
##     voltW4S           1.000                               0.589    0.752
##     wthdW4S    (a)    0.705       NA                      0.415    0.612
##     voltW4P (peer)    0.969    0.168    5.754    0.000    0.571    0.756
##     wthdW4P   (aa)    0.638       NA                      0.376    0.589
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro4 ~                                                              
##     neuro3            0.980    0.062   15.859    0.000    0.920    0.920
##   neuro3 ~                                                              
##     neuro2            0.870    0.043   20.428    0.000    0.949    0.949
##   neuro2 ~                                                              
##     neuro1            0.935    0.057   16.437    0.000    0.884    0.884
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .volatW1S ~~                                                           
##    .volatW2S          0.193       NA                      0.193    0.748
##    .volatW3S          0.172       NA                      0.172    0.686
##    .volatW4S          0.164       NA                      0.164    0.630
##    .volatW1P         -0.114       NA                     -0.114   -0.406
##    .volatW2P         -0.042       NA                     -0.042   -0.160
##    .volatW3P         -0.079       NA                     -0.079   -0.314
##    .volatW4P         -0.010       NA                     -0.010   -0.040
##  .volatW2S ~~                                                           
##    .volatW3S          0.204       NA                      0.204    0.801
##    .volatW4S          0.178       NA                      0.178    0.674
##  .volatW1P ~~                                                           
##    .volatW2S         -0.113       NA                     -0.113   -0.398
##  .volatW2S ~~                                                           
##    .volatW2P         -0.072       NA                     -0.072   -0.268
##    .volatW3P         -0.109       NA                     -0.109   -0.426
##    .volatW4P         -0.069       NA                     -0.069   -0.273
##  .volatW3S ~~                                                           
##    .volatW4S          0.170       NA                      0.170    0.660
##  .volatW1P ~~                                                           
##    .volatW3S         -0.092       NA                     -0.092   -0.329
##  .volatW2P ~~                                                           
##    .volatW3S         -0.058       NA                     -0.058   -0.224
##  .volatW3S ~~                                                           
##    .volatW3P         -0.143       NA                     -0.143   -0.570
##    .volatW4P         -0.096       NA                     -0.096   -0.390
##  .volatW1P ~~                                                           
##    .volatW4S         -0.117       NA                     -0.117   -0.408
##  .volatW2P ~~                                                           
##    .volatW4S         -0.123       NA                     -0.123   -0.456
##  .volatW3P ~~                                                           
##    .volatW4S         -0.173       NA                     -0.173   -0.666
##  .volatW4S ~~                                                           
##    .volatW4P         -0.175       NA                     -0.175   -0.685
##  .withdW1S ~~                                                           
##    .withdW2S          0.224       NA                      0.224    0.707
##    .withdW3S          0.232       NA                      0.232    0.725
##    .withdW4S          0.220       NA                      0.220    0.725
##    .withdW1P          0.009       NA                      0.009    0.027
##    .withdW2P          0.034       NA                      0.034    0.125
##    .withdW3P         -0.005       NA                     -0.005   -0.017
##    .withdW4P          0.000       NA                      0.000    0.002
##  .withdW2S ~~                                                           
##    .withdW3S          0.234       NA                      0.234    0.739
##    .withdW4S          0.209       NA                      0.209    0.697
##  .withdW1P ~~                                                           
##    .withdW2S          0.010       NA                      0.010    0.031
##  .withdW2S ~~                                                           
##    .withdW2P          0.011       NA                      0.011    0.040
##    .withdW3P         -0.034       NA                     -0.034   -0.113
##    .withdW4P         -0.024       NA                     -0.024   -0.082
##  .withdW3S ~~                                                           
##    .withdW4S          0.231       NA                      0.231    0.760
##  .withdW1P ~~                                                           
##    .withdW3S          0.005       NA                      0.005    0.014
##  .withdW2P ~~                                                           
##    .withdW3S          0.018       NA                      0.018    0.066
##  .withdW3S ~~                                                           
##    .withdW3P         -0.010       NA                     -0.010   -0.032
##    .withdW4P         -0.015       NA                     -0.015   -0.050
##  .withdW1P ~~                                                           
##    .withdW4S          0.026       NA                      0.026    0.085
##  .withdW2P ~~                                                           
##    .withdW4S          0.035       NA                      0.035    0.135
##  .withdW3P ~~                                                           
##    .withdW4S          0.006       NA                      0.006    0.022
##  .withdW4S ~~                                                           
##    .withdW4P          0.011       NA                      0.011    0.040
##  .volatW1P ~~                                                           
##    .volatW2P          0.193       NA                      0.193    0.659
##    .volatW3P          0.187       NA                      0.187    0.666
##    .volatW4P          0.161       NA                      0.161    0.585
##  .volatW2P ~~                                                           
##    .volatW3P          0.179       NA                      0.179    0.679
##    .volatW4P          0.202       NA                      0.202    0.780
##  .volatW3P ~~                                                           
##    .volatW4P          0.166       NA                      0.166    0.669
##  .withdW1P ~~                                                           
##    .withdW2P          0.204       NA                      0.204    0.729
##    .withdW3P          0.244       NA                      0.244    0.803
##    .withdW4P          0.170       NA                      0.170    0.576
##  .withdW2P ~~                                                           
##    .withdW3P          0.189       NA                      0.189    0.729
##    .withdW4P          0.179       NA                      0.179    0.711
##  .withdW3P ~~                                                           
##    .withdW4P          0.213       NA                      0.213    0.777
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S          2.780    0.047   58.711    0.000    2.780    3.650
##    .withdW1S          2.994    0.043   69.352    0.000    2.994    4.312
##    .volatW1P          2.537    0.060   42.428    0.000    2.537    3.230
##    .withdW1P          2.561    0.052   49.665    0.000    2.561    3.772
##    .volatW2S          2.788    0.051   54.405    0.000    2.788    3.525
##    .withdW2S          3.030    0.046   65.615    0.000    3.030    4.309
##    .volatW2P          2.601    0.059   44.057    0.000    2.601    3.312
##    .withdW2P          2.569    0.047   54.263    0.000    2.569    4.132
##    .volatW3S          2.751    0.049   56.247    0.000    2.751    3.694
##    .withdW3S          3.001    0.045   66.119    0.000    3.001    4.365
##    .volatW3P          2.598    0.057   45.265    0.000    2.598    3.536
##    .withdW3P          2.598    0.049   52.543    0.000    2.598    4.074
##    .volatW4S          2.772    0.055   50.567    0.000    2.772    3.540
##    .withdW4S          2.964    0.047   63.139    0.000    2.964    4.370
##    .volatW4P          2.669    0.061   43.656    0.000    2.669    3.534
##    .withdW4P          2.608    0.053   48.823    0.000    2.608    4.088
##     neuro1            0.000                               0.000    0.000
##    .neuro2            0.000                               0.000    0.000
##    .neuro3            0.000                               0.000    0.000
##    .neuro4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S          0.254       NA                      0.254    0.438
##    .withdW1S          0.320       NA                      0.320    0.664
##    .volatW1P          0.311       NA                      0.311    0.504
##    .withdW1P          0.328       NA                      0.328    0.712
##    .volatW2S          0.261       NA                      0.261    0.418
##    .withdW2S          0.314       NA                      0.314    0.634
##    .volatW2P          0.275       NA                      0.275    0.446
##    .withdW2P          0.238       NA                      0.238    0.616
##    .volatW3S          0.249       NA                      0.249    0.449
##    .withdW3S          0.321       NA                      0.321    0.679
##    .volatW3P          0.253       NA                      0.253    0.468
##    .withdW3P          0.282       NA                      0.282    0.694
##    .volatW4S          0.267       NA                      0.267    0.435
##    .withdW4S          0.288       NA                      0.288    0.626
##    .volatW4P          0.245       NA                      0.245    0.429
##    .withdW4P          0.266       NA                      0.266    0.653
##     neuro1            0.326       NA                      1.000    1.000
##    .neuro2            0.079       NA                      0.218    0.218
##    .neuro3            0.030       NA                      0.099    0.099
##    .neuro4            0.053       NA                      0.154    0.154
semPaths(lsmNeuro, what = "col", whatLabels = "est", structural = T, layout = "spring")

with random parcels

lsmNeuro <- '

# factor at each time point with same loading
neuro1 =~ neuroW1S1        + a * neuroW1S2 + 
           peer * neuroW1P1 + aa * neuroW1P2

neuro2 =~ neuroW2S1        + a * neuroW2S2 + 
           peer * neuroW2P1 + aa * neuroW2P2

neuro3 =~ neuroW3S1        + a * neuroW3S2 + 
           peer * neuroW3P1 + aa * neuroW3P2
  
neuro4 =~ neuroW4S1        + a * neuroW4S2 + 
           peer * neuroW4P1 + aa * neuroW4P2

# structural paths between time points 
neuro4 ~ neuro3
neuro3 ~ neuro2
neuro2 ~ neuro1

# error covariance - similar parcels across waves
neuroW1S1 ~~ neuroW2S1 + neuroW3S1 + neuroW4S1
neuroW2S1 ~~ neuroW3S1 + neuroW4S1
neuroW3S1 ~~ neuroW4S1

neuroW1S2 ~~ neuroW2S2 + neuroW3S2 + neuroW4S2
neuroW2S2 ~~ neuroW3S2 + neuroW4S2
neuroW3S2 ~~ neuroW4S2

neuroW1P1 ~~ neuroW2P1 + neuroW3P1 + neuroW4P1
neuroW2P1 ~~ neuroW3P1 + neuroW4P1
neuroW3P1 ~~ neuroW4P1

neuroW1P2 ~~ neuroW2P2 + neuroW3P2 + neuroW4P2
neuroW2P2 ~~ neuroW3P2 + neuroW4P2
neuroW3P2 ~~ neuroW4P2

# error covariance - same method at one wave
neuroW1S1 ~~ neuroW1S2
neuroW1P1 ~~ neuroW1P2
neuroW2S1 ~~ neuroW2S2
neuroW2P1 ~~ neuroW2P2
neuroW3S1 ~~ neuroW3S2
neuroW3P1 ~~ neuroW3P2
neuroW4S1 ~~ neuroW4S2
neuroW4P1 ~~ neuroW4P2
'
lsmNeuro <- sem(lsmNeuro, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lsmNeuro, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 290 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro1 =~                                                             
##     nerW1S1           1.000                               1.693    0.927
##     nerW1S2    (a)    0.983       NA                      1.664    0.908
##     nerW1P1 (peer)    0.835       NA                      1.413    0.864
##     nerW1P2   (aa)    0.678       NA                      1.148    0.902
##   neuro2 =~                                                             
##     nerW2S1           1.000                               2.444    0.975
##     nerW2S2    (a)    0.983       NA                      2.403    0.976
##     nerW2P1 (peer)    0.835       NA                      2.041    0.963
##     nerW2P2   (aa)    0.678       NA                      1.657    0.930
##   neuro3 =~                                                             
##     nerW3S1           1.000                               2.523    0.973
##     nerW3S2    (a)    0.983       NA                      2.480    0.970
##     nerW3P1 (peer)    0.835       NA                      2.107    0.949
##     nerW3P2   (aa)    0.678       NA                      1.711    0.931
##   neuro4 =~                                                             
##     nerW4S1           1.000                               2.522    0.964
##     nerW4S2    (a)    0.983       NA                      2.480    0.963
##     nerW4P1 (peer)    0.835       NA                      2.106    0.936
##     nerW4P2   (aa)    0.678       NA                      1.710    0.931
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   neuro4 ~                                                              
##     neuro3            1.000       NA                      1.000    1.000
##   neuro3 ~                                                              
##     neuro2            1.029       NA                      0.997    0.997
##   neuro2 ~                                                              
##     neuro1            1.380       NA                      0.955    0.955
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .neuroW1S1 ~~                                                          
##    .neuroW2S1         0.037       NA                      0.037    0.097
##    .neuroW3S1         0.059       NA                      0.059    0.145
##    .neuroW4S1         0.043       NA                      0.043    0.089
##  .neuroW2S1 ~~                                                          
##    .neuroW3S1         0.040       NA                      0.040    0.121
##    .neuroW4S1         0.020       NA                      0.020    0.051
##  .neuroW3S1 ~~                                                          
##    .neuroW4S1         0.049       NA                      0.049    0.118
##  .neuroW1S2 ~~                                                          
##    .neuroW2S2        -0.006       NA                     -0.006   -0.014
##    .neuroW3S2        -0.004       NA                     -0.004   -0.009
##    .neuroW4S2         0.015       NA                      0.015    0.027
##  .neuroW2S2 ~~                                                          
##    .neuroW3S2        -0.014       NA                     -0.014   -0.042
##    .neuroW4S2         0.005       NA                      0.005    0.014
##  .neuroW3S2 ~~                                                          
##    .neuroW4S2        -0.019       NA                     -0.019   -0.045
##  .neuroW1P1 ~~                                                          
##    .neuroW2P1         0.062       NA                      0.062    0.132
##    .neuroW3P1         0.111       NA                      0.111    0.193
##    .neuroW4P1         0.162       NA                      0.162    0.250
##  .neuroW2P1 ~~                                                          
##    .neuroW3P1         0.017       NA                      0.017    0.044
##    .neuroW4P1         0.255       NA                      0.255    0.564
##  .neuroW3P1 ~~                                                          
##    .neuroW4P1         0.258       NA                      0.258    0.469
##  .neuroW1P2 ~~                                                          
##    .neuroW2P2         0.298       NA                      0.298    0.828
##    .neuroW3P2         0.303       NA                      0.303    0.822
##    .neuroW4P2         0.303       NA                      0.303    0.823
##  .neuroW2P2 ~~                                                          
##    .neuroW3P2         0.449       NA                      0.449    1.018
##    .neuroW4P2         0.449       NA                      0.449    1.018
##  .neuroW3P2 ~~                                                          
##    .neuroW4P2         0.453       NA                      0.453    1.000
##  .neuroW1S1 ~~                                                          
##    .neuroW1S2         0.450       NA                      0.450    0.857
##  .neuroW1P1 ~~                                                          
##    .neuroW1P2         0.228       NA                      0.228    0.506
##  .neuroW2S1 ~~                                                          
##    .neuroW2S2         0.236       NA                      0.236    0.789
##  .neuroW2P1 ~~                                                          
##    .neuroW2P2        -0.012       NA                     -0.012   -0.033
##  .neuroW3S1 ~~                                                          
##    .neuroW3S2         0.306       NA                      0.306    0.827
##  .neuroW3P1 ~~                                                          
##    .neuroW3P2        -0.000       NA                     -0.000   -0.000
##  .neuroW4S1 ~~                                                          
##    .neuroW4S2         0.406       NA                      0.406    0.839
##  .neuroW4P1 ~~                                                          
##    .neuroW4P2        -0.000       NA                     -0.000   -0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .neuroW1S1         1.261       NA                      1.261    0.691
##    .neuroW1S2         1.217       NA                      1.217    0.664
##    .neuroW1P1         0.772       NA                      0.772    0.472
##    .neuroW1P2         1.036       NA                      1.036    0.815
##    .neuroW2S1         0.364       NA                      0.364    0.145
##    .neuroW2S2         0.346       NA                      0.346    0.141
##    .neuroW2P1         0.176       NA                      0.176    0.083
##    .neuroW2P2         0.332       NA                      0.332    0.186
##    .neuroW3S1         0.211       NA                      0.211    0.081
##    .neuroW3S2         0.199       NA                      0.199    0.078
##    .neuroW3P1         0.124       NA                      0.124    0.056
##    .neuroW3P2         0.260       NA                      0.260    0.141
##    .neuroW4S1         0.194       NA                      0.194    0.074
##    .neuroW4S2         0.165       NA                      0.165    0.064
##    .neuroW4P1         0.123       NA                      0.123    0.055
##    .neuroW4P2         0.260       NA                      0.260    0.141
##     neuro1            0.000                               0.000    0.000
##    .neuro2            0.000                               0.000    0.000
##    .neuro3            0.000                               0.000    0.000
##    .neuro4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .neuroW1S1         0.467       NA                      0.467    0.140
##    .neuroW1S2         0.589       NA                      0.589    0.175
##    .neuroW1P1         0.679       NA                      0.679    0.254
##    .neuroW1P2         0.301       NA                      0.301    0.186
##    .neuroW2S1         0.314       NA                      0.314    0.050
##    .neuroW2S2         0.285       NA                      0.285    0.047
##    .neuroW2P1         0.327       NA                      0.327    0.073
##    .neuroW2P2         0.430       NA                      0.430    0.135
##    .neuroW3S1         0.355       NA                      0.355    0.053
##    .neuroW3S2         0.386       NA                      0.386    0.059
##    .neuroW3P1         0.487       NA                      0.487    0.099
##    .neuroW3P2         0.453       NA                      0.453    0.134
##    .neuroW4S1         0.491       NA                      0.491    0.072
##    .neuroW4S2         0.477       NA                      0.477    0.072
##    .neuroW4P1         0.624       NA                      0.624    0.123
##    .neuroW4P2         0.453       NA                      0.453    0.134
##     neuro1            2.865       NA                      1.000    1.000
##    .neuro2            0.520       NA                      0.087    0.087
##    .neuro3            0.040       NA                      0.006    0.006
##    .neuro4            0.000       NA                      0.000    0.000
semPaths(lsmNeuro, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Openness domain

with aspects as parcels

lsmOpend <- '

# factor at each time point with same loading
opend1 =~ intelW1S        + a * openaW1S + 
          peer * intelW1P + aa * openaW1P

opend2 =~ intelW2S        + a * openaW2S + 
          peer * intelW2P + aa * openaW2P

opend3 =~ intelW3S        + a * openaW3S + 
          peer * intelW3P + aa * openaW3P
  
opend4 =~ intelW4S        + a * openaW4S + 
          peer * intelW4P + aa * openaW4P

# structural paths between time points 
opend4 ~ opend3
opend3 ~ opend2
opend2 ~ opend1

# error covariance - similar aspects across waves and informants
intelW1S ~~ intelW2S + intelW3S + intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW2S ~~ intelW3S + intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW3S ~~ intelW4S +
            intelW1P + intelW2P + intelW3P + intelW4P
intelW4S ~~ intelW1P + intelW2P + intelW3P + intelW4P

openaW1S ~~ openaW2S + openaW3S + openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW2S ~~ openaW3S + openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW3S ~~ openaW4S +
            openaW1P + openaW2P + openaW3P + openaW4P
openaW4S ~~ openaW1P + openaW2P + openaW3P + openaW4P

intelW1P ~~ intelW2P + intelW3P + intelW4P
intelW2P ~~ intelW3P + intelW4P
intelW3P ~~ intelW4P

openaW1P ~~ openaW2P + openaW3P + openaW4P
openaW2P ~~ openaW3P + openaW4P
openaW3P ~~ openaW4P
'
lsmOpend <- sem(lsmOpend, data = data, missing = "ML")
summary(lsmOpend, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 266 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        107
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               120.793
##   Degrees of freedom                                54
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2293.599
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.969
##   Tucker-Lewis Index (TLI)                       0.932
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1046.743
##   Loglikelihood unrestricted model (H1)       -986.347
##                                                       
##   Akaike (AIC)                                2289.487
##   Bayesian (BIC)                              2638.056
##   Sample-size adjusted Bayesian (BIC)         2327.360
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.069
##   90 Percent confidence interval - lower         0.053
##   90 Percent confidence interval - upper         0.086
##   P-value RMSEA <= 0.05                          0.030
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.078
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opend1 =~                                                             
##     intlW1S           1.000                               0.176    0.324
##     openW1S    (a)    1.626       NA                      0.286    0.458
##     intlW1P (peer)    1.495    0.370    4.044    0.000    0.263    0.496
##     openW1P   (aa)    1.928       NA                      0.339    0.680
##   opend2 =~                                                             
##     intlW2S           1.000                               0.216    0.397
##     openW2S    (a)    1.626       NA                      0.352    0.534
##     intlW2P (peer)    1.495    0.370    4.044    0.000    0.323    0.635
##     openW2P   (aa)    1.928       NA                      0.417    0.747
##   opend3 =~                                                             
##     intlW3S           1.000                               0.185    0.340
##     openW3S    (a)    1.626       NA                      0.300    0.484
##     intlW3P (peer)    1.495    0.370    4.044    0.000    0.276    0.482
##     openW3P   (aa)    1.928       NA                      0.356    0.623
##   opend4 =~                                                             
##     intlW4S           1.000                               0.192    0.366
##     openW4S    (a)    1.626       NA                      0.312    0.494
##     intlW4P (peer)    1.495    0.370    4.044    0.000    0.286    0.522
##     openW4P   (aa)    1.928       NA                      0.369    0.665
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opend4 ~                                                              
##     opend3            0.959    0.095   10.127    0.000    0.925    0.925
##   opend3 ~                                                              
##     opend2            0.826    0.065   12.647    0.000    0.967    0.967
##   opend2 ~                                                              
##     opend1            1.011    0.107    9.405    0.000    0.822    0.822
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .intelW1S ~~                                                           
##    .intelW2S          0.199       NA                      0.199    0.774
##    .intelW3S          0.198       NA                      0.198    0.753
##    .intelW4S          0.184       NA                      0.184    0.733
##    .intelW1P          0.038       NA                      0.038    0.162
##    .intelW2P          0.007       NA                      0.007    0.037
##    .intelW3P          0.035       NA                      0.035    0.134
##    .intelW4P         -0.002       NA                     -0.002   -0.008
##  .intelW2S ~~                                                           
##    .intelW3S          0.203       NA                      0.203    0.793
##    .intelW4S          0.191       NA                      0.191    0.782
##  .intelW1P ~~                                                           
##    .intelW2S          0.036       NA                      0.036    0.155
##  .intelW2S ~~                                                           
##    .intelW2P         -0.003       NA                     -0.003   -0.016
##    .intelW3P          0.026       NA                      0.026    0.104
##    .intelW4P         -0.015       NA                     -0.015   -0.063
##  .intelW3S ~~                                                           
##    .intelW4S          0.203       NA                      0.203    0.814
##  .intelW1P ~~                                                           
##    .intelW3S          0.057       NA                      0.057    0.244
##  .intelW2P ~~                                                           
##    .intelW3S          0.013       NA                      0.013    0.065
##  .intelW3S ~~                                                           
##    .intelW3P          0.026       NA                      0.026    0.103
##    .intelW4P         -0.013       NA                     -0.013   -0.054
##  .intelW1P ~~                                                           
##    .intelW4S          0.038       NA                      0.038    0.171
##  .intelW2P ~~                                                           
##    .intelW4S          0.002       NA                      0.002    0.012
##  .intelW3P ~~                                                           
##    .intelW4S          0.019       NA                      0.019    0.076
##  .intelW4S ~~                                                           
##    .intelW4P         -0.027       NA                     -0.027   -0.119
##  .openaW1S ~~                                                           
##    .openaW2S          0.255       NA                      0.255    0.825
##    .openaW3S          0.256       NA                      0.256    0.851
##    .openaW4S          0.251       NA                      0.251    0.825
##    .openaW1P          0.059       NA                      0.059    0.291
##    .openaW2P          0.089       NA                      0.089    0.433
##    .openaW3P          0.115       NA                      0.115    0.465
##    .openaW4P          0.098       NA                      0.098    0.424
##  .openaW2S ~~                                                           
##    .openaW3S          0.257       NA                      0.257    0.852
##    .openaW4S          0.255       NA                      0.255    0.837
##  .openaW1P ~~                                                           
##    .openaW2S          0.064       NA                      0.064    0.316
##  .openaW2S ~~                                                           
##    .openaW2P          0.051       NA                      0.051    0.249
##    .openaW3P          0.087       NA                      0.087    0.350
##    .openaW4P          0.075       NA                      0.075    0.325
##  .openaW3S ~~                                                           
##    .openaW4S          0.250       NA                      0.250    0.841
##  .openaW1P ~~                                                           
##    .openaW3S          0.064       NA                      0.064    0.321
##  .openaW2P ~~                                                           
##    .openaW3S          0.057       NA                      0.057    0.284
##  .openaW3S ~~                                                           
##    .openaW3P          0.083       NA                      0.083    0.342
##    .openaW4P          0.066       NA                      0.066    0.291
##  .openaW1P ~~                                                           
##    .openaW4S          0.072       NA                      0.072    0.358
##  .openaW2P ~~                                                           
##    .openaW4S          0.072       NA                      0.072    0.353
##  .openaW3P ~~                                                           
##    .openaW4S          0.098       NA                      0.098    0.400
##  .openaW4S ~~                                                           
##    .openaW4P          0.083       NA                      0.083    0.365
##  .intelW1P ~~                                                           
##    .intelW2P          0.140       NA                      0.140    0.771
##    .intelW3P          0.170       NA                      0.170    0.736
##    .intelW4P          0.150       NA                      0.150    0.696
##  .intelW2P ~~                                                           
##    .intelW3P          0.166       NA                      0.166    0.842
##    .intelW4P          0.124       NA                      0.124    0.672
##  .intelW3P ~~                                                           
##    .intelW4P          0.171       NA                      0.171    0.728
##  .openaW1P ~~                                                           
##    .openaW2P          0.089       NA                      0.089    0.659
##    .openaW3P          0.117       NA                      0.117    0.717
##    .openaW4P          0.124       NA                      0.124    0.818
##  .openaW2P ~~                                                           
##    .openaW3P          0.118       NA                      0.118    0.712
##    .openaW4P          0.107       NA                      0.107    0.696
##  .openaW3P ~~                                                           
##    .openaW4P          0.158       NA                      0.158    0.852
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .intelW1S          3.666    0.034  108.517    0.000    3.666    6.747
##    .openaW1S          3.799    0.039   97.829    0.000    3.799    6.081
##    .intelW1P          3.993    0.041   97.308    0.000    3.993    7.532
##    .openaW1P          3.607    0.038   95.890    0.000    3.607    7.237
##    .intelW2S          3.614    0.036  100.934    0.000    3.614    6.628
##    .openaW2S          3.772    0.043   88.082    0.000    3.772    5.732
##    .intelW2P          3.972    0.040  100.237    0.000    3.972    7.803
##    .openaW2P          3.602    0.042   85.294    0.000    3.602    6.457
##    .intelW3S          3.641    0.036  101.320    0.000    3.641    6.705
##    .openaW3S          3.800    0.040   94.234    0.000    3.800    6.126
##    .intelW3P          3.950    0.045   86.826    0.000    3.950    6.895
##    .openaW3P          3.587    0.043   82.566    0.000    3.587    6.278
##    .intelW4S          3.659    0.036  100.624    0.000    3.659    6.985
##    .openaW4S          3.826    0.043   89.612    0.000    3.826    6.071
##    .intelW4P          3.884    0.048   80.877    0.000    3.884    7.072
##    .openaW4P          3.580    0.044   80.864    0.000    3.580    6.443
##     opend1            0.000                               0.000    0.000
##    .opend2            0.000                               0.000    0.000
##    .opend3            0.000                               0.000    0.000
##    .opend4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .intelW1S          0.264       NA                      0.264    0.895
##    .openaW1S          0.308       NA                      0.308    0.791
##    .intelW1P          0.212       NA                      0.212    0.754
##    .openaW1P          0.134       NA                      0.134    0.538
##    .intelW2S          0.250       NA                      0.250    0.843
##    .openaW2S          0.309       NA                      0.309    0.714
##    .intelW2P          0.155       NA                      0.155    0.597
##    .openaW2P          0.137       NA                      0.137    0.442
##    .intelW3S          0.261       NA                      0.261    0.884
##    .openaW3S          0.295       NA                      0.295    0.765
##    .intelW3P          0.252       NA                      0.252    0.767
##    .openaW3P          0.200       NA                      0.200    0.611
##    .intelW4S          0.238       NA                      0.238    0.866
##    .openaW4S          0.300       NA                      0.300    0.756
##    .intelW4P          0.219       NA                      0.219    0.728
##    .openaW4P          0.172       NA                      0.172    0.558
##     opend1            0.031       NA                      1.000    1.000
##    .opend2            0.015       NA                      0.325    0.325
##    .opend3            0.002       NA                      0.065    0.065
##    .opend4            0.005       NA                      0.145    0.145
semPaths(lsmOpend, what = "col", whatLabels = "est", structural = T, layout = "spring")

with random parcels

lsmOpend <- '

# factor at each time point with same loading
opend1 =~ opendW1S1        + a * opendW1S2 + 
           peer * opendW1P1 + aa * opendW1P2

opend2 =~ opendW2S1        + a * opendW2S2 + 
           peer * opendW2P1 + aa * opendW2P2

opend3 =~ opendW3S1        + a * opendW3S2 + 
           peer * opendW3P1 + aa * opendW3P2
  
opend4 =~ opendW4S1        + a * opendW4S2 + 
           peer * opendW4P1 + aa * opendW4P2

# structural paths between time points 
opend4 ~ opend3
opend3 ~ opend2
opend2 ~ opend1

# error covariance - similar parcels across waves
opendW1S1 ~~ opendW2S1 + opendW3S1 + opendW4S1
opendW2S1 ~~ opendW3S1 + opendW4S1
opendW3S1 ~~ opendW4S1

opendW1S2 ~~ opendW2S2 + opendW3S2 + opendW4S2
opendW2S2 ~~ opendW3S2 + opendW4S2
opendW3S2 ~~ opendW4S2

opendW1P1 ~~ opendW2P1 + opendW3P1 + opendW4P1
opendW2P1 ~~ opendW3P1 + opendW4P1
opendW3P1 ~~ opendW4P1

opendW1P2 ~~ opendW2P2 + opendW3P2 + opendW4P2
opendW2P2 ~~ opendW3P2 + opendW4P2
opendW3P2 ~~ opendW4P2

# error covariance - same method at one wave
opendW1S1 ~~ opendW1S2
opendW1P1 ~~ opendW1P2
opendW2S1 ~~ opendW2S2
opendW2P1 ~~ opendW2P2
opendW3S1 ~~ opendW3S2
opendW3P1 ~~ opendW3P2
opendW4S1 ~~ opendW4S2
opendW4P1 ~~ opendW4P2
'
lsmOpend <- sem(lsmOpend, data = data, missing = "ML")
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
## Warning in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
## lavaan WARNING: the optimizer warns that a solution has NOT been found!
summary(lsmOpend, fit.measures = T, standardized = T)
## lavaan 0.6-7 did NOT end normally after 442 iterations
## ** WARNING ** Estimates below are most likely unreliable
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        51
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                    NA
##   Degrees of freedom                                NA
## Warning in .local(object, ...): lavaan WARNING: fit measures not available if model did not converge
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opend1 =~                                                             
##     opnW1S1           1.000                               1.938    0.937
##     opnW1S2    (a)    1.008       NA                      1.954    0.948
##     opnW1P1 (peer)    1.055       NA                      2.044    0.915
##     opnW1P2   (aa)    0.960       NA                      1.861    0.951
##   opend2 =~                                                             
##     opnW2S1           1.000                               2.841    0.991
##     opnW2S2    (a)    1.008       NA                      2.865    0.992
##     opnW2P1 (peer)    1.055       NA                      2.996    0.982
##     opnW2P2   (aa)    0.960       NA                      2.727    0.976
##   opend3 =~                                                             
##     opnW3S1           1.000                               2.842    0.990
##     opnW3S2    (a)    1.008       NA                      2.866    0.989
##     opnW3P1 (peer)    1.055       NA                      2.997    0.984
##     opnW3P2   (aa)    0.960       NA                      2.728    0.976
##   opend4 =~                                                             
##     opnW4S1           1.000                               2.843    0.980
##     opnW4S2    (a)    1.008       NA                      2.867    0.981
##     opnW4P1 (peer)    1.055       NA                      2.999    0.971
##     opnW4P2   (aa)    0.960       NA                      2.729    0.970
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opend4 ~                                                              
##     opend3            1.001       NA                      1.000    1.000
##   opend3 ~                                                              
##     opend2            1.000       NA                      1.000    1.000
##   opend2 ~                                                              
##     opend1            1.440       NA                      0.982    0.982
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .opendW1S1 ~~                                                          
##    .opendW2S1         0.047       NA                      0.047    0.173
##    .opendW3S1         0.065       NA                      0.065    0.217
##    .opendW4S1         0.027       NA                      0.027    0.066
##  .opendW2S1 ~~                                                          
##    .opendW3S1         0.023       NA                      0.023    0.149
##    .opendW4S1         0.077       NA                      0.077    0.363
##  .opendW3S1 ~~                                                          
##    .opendW4S1         0.021       NA                      0.021    0.091
##  .opendW1S2 ~~                                                          
##    .opendW2S2         0.053       NA                      0.053    0.225
##    .opendW3S2         0.027       NA                      0.027    0.095
##    .opendW4S2         0.056       NA                      0.056    0.152
##  .opendW2S2 ~~                                                          
##    .opendW3S2         0.060       NA                      0.060    0.386
##    .opendW4S2         0.046       NA                      0.046    0.228
##  .opendW3S2 ~~                                                          
##    .opendW4S2         0.049       NA                      0.049    0.199
##  .opendW1P1 ~~                                                          
##    .opendW2P1         0.075       NA                      0.075    0.143
##    .opendW3P1         0.110       NA                      0.110    0.222
##    .opendW4P1         0.076       NA                      0.076    0.115
##  .opendW2P1 ~~                                                          
##    .opendW3P1         0.185       NA                      0.185    0.581
##    .opendW4P1         0.231       NA                      0.231    0.537
##  .opendW3P1 ~~                                                          
##    .opendW4P1         0.093       NA                      0.093    0.229
##  .opendW1P2 ~~                                                          
##    .opendW2P2         0.278       NA                      0.278    0.754
##    .opendW3P2         0.278       NA                      0.278    0.754
##    .opendW4P2         0.308       NA                      0.308    0.741
##  .opendW2P2 ~~                                                          
##    .opendW3P2         0.376       NA                      0.376    1.000
##    .opendW4P2         0.421       NA                      0.421    0.995
##  .opendW3P2 ~~                                                          
##    .opendW4P2         0.421       NA                      0.421    0.995
##  .opendW1S1 ~~                                                          
##    .opendW1S2         0.405       NA                      0.405    0.849
##  .opendW1P1 ~~                                                          
##    .opendW1P2         0.354       NA                      0.354    0.652
##  .opendW2S1 ~~                                                          
##    .opendW2S2         0.043       NA                      0.043    0.323
##  .opendW2P1 ~~                                                          
##    .opendW2P2         0.000       NA                      0.000    0.000
##  .opendW3S1 ~~                                                          
##    .opendW3S2         0.106       NA                      0.106    0.590
##  .opendW3P1 ~~                                                          
##    .opendW3P2        -0.000       NA                     -0.000   -0.000
##  .opendW4S1 ~~                                                          
##    .opendW4S2         0.224       NA                      0.224    0.700
##  .opendW4P1 ~~                                                          
##    .opendW4P2         0.036       NA                      0.036    0.070
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .opendW1S1         1.428       NA                      1.428    0.690
##    .opendW1S2         1.263       NA                      1.263    0.612
##    .opendW1P1         0.916       NA                      0.916    0.410
##    .opendW1P2         1.181       NA                      1.181    0.604
##    .opendW2S1         0.266       NA                      0.266    0.093
##    .opendW2S2         0.104       NA                      0.104    0.036
##    .opendW2P1         0.126       NA                      0.126    0.041
##    .opendW2P2         0.182       NA                      0.182    0.065
##    .opendW3S1         0.244       NA                      0.244    0.085
##    .opendW3S2         0.061       NA                      0.061    0.021
##    .opendW3P1        -0.013       NA                     -0.013   -0.004
##    .opendW3P2         0.181       NA                      0.181    0.065
##    .opendW4S1         0.323       NA                      0.323    0.111
##    .opendW4S2         0.126       NA                      0.126    0.043
##    .opendW4P1         0.031       NA                      0.031    0.010
##    .opendW4P2         0.141       NA                      0.141    0.050
##     opend1            0.000                               0.000    0.000
##    .opend2            0.000                               0.000    0.000
##    .opend3            0.000                               0.000    0.000
##    .opend4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .opendW1S1         0.524       NA                      0.524    0.122
##    .opendW1S2         0.435       NA                      0.435    0.102
##    .opendW1P1         0.812       NA                      0.812    0.163
##    .opendW1P2         0.363       NA                      0.363    0.095
##    .opendW2S1         0.140       NA                      0.140    0.017
##    .opendW2S2         0.128       NA                      0.128    0.015
##    .opendW2P1         0.337       NA                      0.337    0.036
##    .opendW2P2         0.376       NA                      0.376    0.048
##    .opendW3S1         0.169       NA                      0.169    0.021
##    .opendW3S2         0.192       NA                      0.192    0.023
##    .opendW3P1         0.302       NA                      0.302    0.033
##    .opendW3P2         0.376       NA                      0.376    0.048
##    .opendW4S1         0.325       NA                      0.325    0.039
##    .opendW4S2         0.314       NA                      0.314    0.037
##    .opendW4P1         0.548       NA                      0.548    0.057
##    .opendW4P2         0.476       NA                      0.476    0.060
##     opend1            3.756       NA                      1.000    1.000
##    .opend2            0.281       NA                      0.035    0.035
##    .opend3           -0.000       NA                     -0.000   -0.000
##    .opend4           -0.002       NA                     -0.000   -0.000
semPaths(lsmOpend, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Assertiveness

lsmAssert <- '

# factor at each time point with same loading
assert1 =~ assertW1S1        + a * assertW1S2 + 
           peer * assertW1P1 + aa * assertW1P2

assert2 =~ assertW2S1        + a * assertW2S2 + 
           peer * assertW2P1 + aa * assertW2P2

assert3 =~ assertW3S1        + a * assertW3S2 + 
           peer * assertW3P1 + aa * assertW3P2
  
assert4 =~ assertW4S1        + a * assertW4S2 + 
           peer * assertW4P1 + aa * assertW4P2

# structural paths between time points 
assert4 ~ assert3
assert3 ~ assert2
assert2 ~ assert1

# error covariance - similar parcels across waves
assertW1S1 ~~ assertW2S1 + assertW3S1 + assertW4S1
assertW2S1 ~~ assertW3S1 + assertW4S1
assertW3S1 ~~ assertW4S1

assertW1S2 ~~ assertW2S2 + assertW3S2 + assertW4S2
assertW2S2 ~~ assertW3S2 + assertW4S2
assertW3S2 ~~ assertW4S2

assertW1P1 ~~ assertW2P1 + assertW3P1 + assertW4P1
assertW2P1 ~~ assertW3P1 + assertW4P1
assertW3P1 ~~ assertW4P1

assertW1P2 ~~ assertW2P2 + assertW3P2 + assertW4P2
assertW2P2 ~~ assertW3P2 + assertW4P2
assertW3P2 ~~ assertW4P2

# error covariance - same method at one wave
assertW1S1 ~~ assertW1S2
assertW1P1 ~~ assertW1P2
assertW2S1 ~~ assertW2S2
assertW2P1 ~~ assertW2P2
assertW3S1 ~~ assertW3S2
assertW3P1 ~~ assertW3P2
assertW4S1 ~~ assertW4S2
assertW4P1 ~~ assertW4P2
'
lsmAssert <- sem(lsmAssert, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmAssert, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 172 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               286.637
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2668.403
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.918
##   Tucker-Lewis Index (TLI)                       0.874
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1405.842
##   Loglikelihood unrestricted model (H1)      -1262.524
##                                                       
##   Akaike (AIC)                                2959.685
##   Bayesian (BIC)                              3222.890
##   Sample-size adjusted Bayesian (BIC)         2988.284
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.102
##   90 Percent confidence interval - lower         0.089
##   90 Percent confidence interval - upper         0.114
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.181
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   assert1 =~                                                            
##     assW1S1           1.000                               0.570    0.828
##     assW1S2    (a)    1.069    0.068   15.789    0.000    0.609    0.811
##     assW1P1 (peer)    0.384    0.067    5.753    0.000    0.219    0.375
##     assW1P2   (aa)    0.505    0.073    6.897    0.000    0.288    0.461
##   assert2 =~                                                            
##     assW2S1           1.000                               0.581    0.824
##     assW2S2    (a)    1.069    0.068   15.789    0.000    0.621    0.848
##     assW2P1 (peer)    0.384    0.067    5.753    0.000    0.223    0.422
##     assW2P2   (aa)    0.505    0.073    6.897    0.000    0.293    0.476
##   assert3 =~                                                            
##     assW3S1           1.000                               0.594    0.863
##     assW3S2    (a)    1.069    0.068   15.789    0.000    0.635    0.882
##     assW3P1 (peer)    0.384    0.067    5.753    0.000    0.228    0.406
##     assW3P2   (aa)    0.505    0.073    6.897    0.000    0.300    0.437
##   assert4 =~                                                            
##     assW4S1           1.000                               0.604    0.877
##     assW4S2    (a)    1.069    0.068   15.789    0.000    0.645    0.895
##     assW4P1 (peer)    0.384    0.067    5.753    0.000    0.232    0.436
##     assW4P2   (aa)    0.505    0.073    6.897    0.000    0.305    0.480
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   assert4 ~                                                             
##     assert3           0.959    0.046   20.938    0.000    0.944    0.944
##   assert3 ~                                                             
##     assert2           0.989    0.045   21.736    0.000    0.967    0.967
##   assert2 ~                                                             
##     assert1           1.019    0.082   12.497    0.000    1.000    1.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .assertW1S1 ~~                                                         
##    .assertW2S1        0.045    0.021    2.115    0.034    0.045    0.291
##    .assertW3S1        0.036    0.019    1.846    0.065    0.036    0.268
##    .assertW4S1        0.022    0.019    1.132    0.257    0.022    0.171
##  .assertW2S1 ~~                                                         
##    .assertW3S1        0.064    0.021    3.037    0.002    0.064    0.464
##    .assertW4S1        0.056    0.021    2.686    0.007    0.056    0.425
##  .assertW3S1 ~~                                                         
##    .assertW4S1        0.059    0.020    2.889    0.004    0.059    0.510
##  .assertW1S2 ~~                                                         
##    .assertW2S2        0.069    0.024    2.880    0.004    0.069    0.402
##    .assertW3S2        0.057    0.022    2.594    0.009    0.057    0.381
##    .assertW4S2        0.052    0.022    2.323    0.020    0.052    0.371
##  .assertW2S2 ~~                                                         
##    .assertW3S2        0.053    0.023    2.361    0.018    0.053    0.404
##    .assertW4S2        0.069    0.024    2.909    0.004    0.069    0.556
##  .assertW3S2 ~~                                                         
##    .assertW4S2        0.046    0.023    2.026    0.043    0.046    0.424
##  .assertW1P1 ~~                                                         
##    .assertW2P1        0.162    0.027    5.946    0.000    0.162    0.625
##    .assertW3P1        0.173    0.032    5.477    0.000    0.173    0.622
##    .assertW4P1        0.137    0.028    4.947    0.000    0.137    0.529
##  .assertW2P1 ~~                                                         
##    .assertW3P1        0.131    0.028    4.628    0.000    0.131    0.533
##    .assertW4P1        0.137    0.026    5.232    0.000    0.137    0.596
##  .assertW3P1 ~~                                                         
##    .assertW4P1        0.163    0.031    5.201    0.000    0.163    0.662
##  .assertW1P2 ~~                                                         
##    .assertW2P2        0.172    0.032    5.357    0.000    0.172    0.574
##    .assertW3P2        0.246    0.038    6.521    0.000    0.246    0.720
##    .assertW4P2        0.210    0.034    6.260    0.000    0.210    0.683
##  .assertW2P2 ~~                                                         
##    .assertW3P2        0.270    0.040    6.793    0.000    0.270    0.808
##    .assertW4P2        0.221    0.035    6.248    0.000    0.221    0.736
##  .assertW3P2 ~~                                                         
##    .assertW4P2        0.259    0.041    6.267    0.000    0.259    0.754
##  .assertW1S1 ~~                                                         
##    .assertW1S2        0.059    0.027    2.189    0.029    0.059    0.347
##  .assertW1P1 ~~                                                         
##    .assertW1P2        0.068    0.016    4.169    0.000    0.068    0.229
##  .assertW2S1 ~~                                                         
##    .assertW2S2        0.028    0.011    2.594    0.009    0.028    0.179
##  .assertW2P1 ~~                                                         
##    .assertW2P2        0.053    0.014    3.780    0.000    0.053    0.206
##  .assertW3S1 ~~                                                         
##    .assertW3S2        0.000    0.010    0.049    0.961    0.000    0.004
##  .assertW3P1 ~~                                                         
##    .assertW3P2       -0.004    0.017   -0.258    0.797   -0.004   -0.014
##  .assertW4S1 ~~                                                         
##    .assertW4S2        0.004    0.033    0.113    0.910    0.004    0.035
##  .assertW4P1 ~~                                                         
##    .assertW4P2        0.039    0.015    2.543    0.011    0.039    0.146
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S1        3.401    0.043   79.457    0.000    3.401    4.940
##    .assertW1S2        3.521    0.047   75.385    0.000    3.521    4.687
##    .assertW1P1        3.683    0.046   80.837    0.000    3.683    6.319
##    .assertW1P2        3.496    0.048   72.989    0.000    3.496    5.606
##    .assertW2S1        3.348    0.046   72.372    0.000    3.348    4.751
##    .assertW2S2        3.479    0.048   72.923    0.000    3.479    4.750
##    .assertW2P1        3.751    0.042   88.665    0.000    3.751    7.097
##    .assertW2P2        3.560    0.048   74.565    0.000    3.560    5.786
##    .assertW3S1        3.336    0.045   73.518    0.000    3.336    4.845
##    .assertW3S2        3.474    0.047   73.572    0.000    3.474    4.821
##    .assertW3P1        3.671    0.046   79.553    0.000    3.671    6.534
##    .assertW3P2        3.537    0.054   66.004    0.000    3.537    5.153
##    .assertW4S1        3.391    0.048   70.829    0.000    3.391    4.926
##    .assertW4S2        3.508    0.050   70.782    0.000    3.508    4.866
##    .assertW4P1        3.664    0.047   78.318    0.000    3.664    6.894
##    .assertW4P2        3.551    0.053   67.028    0.000    3.551    5.600
##     assert1           0.000                               0.000    0.000
##    .assert2           0.000                               0.000    0.000
##    .assert3           0.000                               0.000    0.000
##    .assert4           0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .assertW1S1        0.149    0.031    4.821    0.000    0.149    0.315
##    .assertW1S2        0.193    0.040    4.817    0.000    0.193    0.342
##    .assertW1P1        0.292    0.034    8.582    0.000    0.292    0.859
##    .assertW1P2        0.306    0.036    8.567    0.000    0.306    0.787
##    .assertW2S1        0.159    0.027    5.882    0.000    0.159    0.320
##    .assertW2S2        0.151    0.029    5.290    0.000    0.151    0.281
##    .assertW2P1        0.230    0.029    8.049    0.000    0.230    0.822
##    .assertW2P2        0.293    0.036    8.021    0.000    0.293    0.773
##    .assertW3S1        0.121    0.024    4.998    0.000    0.121    0.255
##    .assertW3S2        0.116    0.027    4.350    0.000    0.116    0.223
##    .assertW3P1        0.264    0.037    7.216    0.000    0.264    0.835
##    .assertW3P2        0.381    0.051    7.503    0.000    0.381    0.809
##    .assertW4S1        0.109    0.039    2.806    0.005    0.109    0.231
##    .assertW4S2        0.103    0.044    2.337    0.019    0.103    0.198
##    .assertW4P1        0.229    0.032    7.042    0.000    0.229    0.810
##    .assertW4P2        0.309    0.044    6.989    0.000    0.309    0.769
##     assert1           0.325    0.045    7.165    0.000    1.000    1.000
##    .assert2          -0.000    0.025   -0.003    0.998   -0.000   -0.000
##    .assert3           0.023    0.011    2.176    0.030    0.066    0.066
##    .assert4           0.040    0.031    1.295    0.195    0.109    0.109
semPaths(lsmAssert, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Compassion

lsmCompa <- '

# factor at each time point with same loading
compa1 =~ compaW1S1        + a * compaW1S2 + 
           peer * compaW1P1 + aa * compaW1P2

compa2 =~ compaW2S1        + a * compaW2S2 + 
           peer * compaW2P1 + aa * compaW2P2

compa3 =~ compaW3S1        + a * compaW3S2 + 
           peer * compaW3P1 + aa * compaW3P2
  
compa4 =~ compaW4S1        + a * compaW4S2 + 
           peer * compaW4P1 + aa * compaW4P2

# structural paths between time points 
compa4 ~ compa3
compa3 ~ compa2
compa2 ~ compa1

# error covariance - similar parcels across waves
compaW1S1 ~~ compaW2S1 + compaW3S1 + compaW4S1
compaW2S1 ~~ compaW3S1 + compaW4S1
compaW3S1 ~~ compaW4S1

compaW1S2 ~~ compaW2S2 + compaW3S2 + compaW4S2
compaW2S2 ~~ compaW3S2 + compaW4S2
compaW3S2 ~~ compaW4S2

compaW1P1 ~~ compaW2P1 + compaW3P1 + compaW4P1
compaW2P1 ~~ compaW3P1 + compaW4P1
compaW3P1 ~~ compaW4P1

compaW1P2 ~~ compaW2P2 + compaW3P2 + compaW4P2
compaW2P2 ~~ compaW3P2 + compaW4P2
compaW3P2 ~~ compaW4P2

# error covariance - same method at one wave
compaW1S1 ~~ compaW1S2
compaW1P1 ~~ compaW1P2
compaW2S1 ~~ compaW2S2
compaW2P1 ~~ compaW2P2
compaW3S1 ~~ compaW3S2
compaW3P1 ~~ compaW3P2
compaW4S1 ~~ compaW4S2
compaW4P1 ~~ compaW4P2
'
lsmCompa <- sem(lsmCompa, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmCompa, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 204 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               314.754
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2272.548
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.890
##   Tucker-Lewis Index (TLI)                       0.831
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1044.836
##   Loglikelihood unrestricted model (H1)       -887.459
##                                                       
##   Akaike (AIC)                                2237.671
##   Bayesian (BIC)                              2500.876
##   Sample-size adjusted Bayesian (BIC)         2266.270
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.108
##   90 Percent confidence interval - lower         0.096
##   90 Percent confidence interval - upper         0.121
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.202
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   compa1 =~                                                             
##     cmpW1S1           1.000                               0.269    0.551
##     cmpW1S2    (a)    1.076    0.059   18.321    0.000    0.289    0.551
##     cmpW1P1 (peer)    0.685    0.123    5.592    0.000    0.184    0.304
##     cmpW1P2   (aa)    0.674    0.122    5.535    0.000    0.181    0.336
##   compa2 =~                                                             
##     cmpW2S1           1.000                               0.389    0.784
##     cmpW2S2    (a)    1.076    0.059   18.321    0.000    0.418    0.779
##     cmpW2P1 (peer)    0.685    0.123    5.592    0.000    0.266    0.488
##     cmpW2P2   (aa)    0.674    0.122    5.535    0.000    0.262    0.447
##   compa3 =~                                                             
##     cmpW3S1           1.000                               0.395    0.797
##     cmpW3S2    (a)    1.076    0.059   18.321    0.000    0.425    0.810
##     cmpW3P1 (peer)    0.685    0.123    5.592    0.000    0.271    0.471
##     cmpW3P2   (aa)    0.674    0.122    5.535    0.000    0.266    0.515
##   compa4 =~                                                             
##     cmpW4S1           1.000                               0.346    0.705
##     cmpW4S2    (a)    1.076    0.059   18.321    0.000    0.372    0.702
##     cmpW4P1 (peer)    0.685    0.123    5.592    0.000    0.237    0.403
##     cmpW4P2   (aa)    0.674    0.122    5.535    0.000    0.233    0.394
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   compa4 ~                                                              
##     compa3            1.091    0.063   17.222    0.000    1.245    1.245
##   compa3 ~                                                              
##     compa2            0.965    0.076   12.643    0.000    0.950    0.950
##   compa2 ~                                                              
##     compa1            1.761    0.557    3.163    0.002    1.216    1.216
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .compaW1S1 ~~                                                          
##    .compaW2S1        -0.006    0.009   -0.637    0.524   -0.006   -0.045
##    .compaW3S1         0.005    0.008    0.621    0.535    0.005    0.043
##    .compaW4S1         0.007    0.008    0.830    0.406    0.007    0.049
##  .compaW2S1 ~~                                                          
##    .compaW3S1         0.023    0.009    2.458    0.014    0.023    0.248
##    .compaW4S1         0.016    0.009    1.798    0.072    0.016    0.146
##  .compaW3S1 ~~                                                          
##    .compaW4S1         0.018    0.009    2.082    0.037    0.018    0.173
##  .compaW1S2 ~~                                                          
##    .compaW2S2         0.022    0.010    2.155    0.031    0.022    0.152
##    .compaW3S2         0.012    0.009    1.370    0.171    0.012    0.092
##    .compaW4S2        -0.004    0.009   -0.452    0.651   -0.004   -0.025
##  .compaW2S2 ~~                                                          
##    .compaW3S2         0.034    0.010    3.331    0.001    0.034    0.327
##    .compaW4S2         0.025    0.010    2.549    0.011    0.025    0.196
##  .compaW3S2 ~~                                                          
##    .compaW4S2         0.019    0.009    2.040    0.041    0.019    0.162
##  .compaW1P1 ~~                                                          
##    .compaW2P1        -0.001    0.015   -0.065    0.949   -0.001   -0.004
##    .compaW3P1         0.001    0.021    0.034    0.973    0.001    0.002
##    .compaW4P1         0.014    0.016    0.871    0.384    0.014    0.045
##  .compaW2P1 ~~                                                          
##    .compaW3P1         0.033    0.016    2.061    0.039    0.033    0.137
##    .compaW4P1         0.036    0.015    2.446    0.014    0.036    0.142
##  .compaW3P1 ~~                                                          
##    .compaW4P1         0.007    0.022    0.335    0.737    0.007    0.026
##  .compaW1P2 ~~                                                          
##    .compaW2P2         0.033    0.015    2.226    0.026    0.033    0.124
##    .compaW3P2         0.047    0.014    3.326    0.001    0.047    0.208
##    .compaW4P2         0.020    0.017    1.198    0.231    0.020    0.073
##  .compaW2P2 ~~                                                          
##    .compaW3P2         0.001    0.015    0.085    0.932    0.001    0.006
##    .compaW4P2        -0.014    0.017   -0.859    0.390   -0.014   -0.050
##  .compaW3P2 ~~                                                          
##    .compaW4P2         0.037    0.015    2.471    0.013    0.037    0.153
##  .compaW1S1 ~~                                                          
##    .compaW1S2         0.114    0.028    4.128    0.000    0.114    0.643
##  .compaW1P1 ~~                                                          
##    .compaW1P2         0.213    0.035    6.155    0.000    0.213    0.729
##  .compaW2S1 ~~                                                          
##    .compaW2S2         0.031    0.011    2.859    0.004    0.031    0.295
##  .compaW2P1 ~~                                                          
##    .compaW2P2         0.199    0.032    6.198    0.000    0.199    0.795
##  .compaW3S1 ~~                                                          
##    .compaW3S2         0.027    0.009    3.083    0.002    0.027    0.295
##  .compaW3P1 ~~                                                          
##    .compaW3P2         0.147    0.032    4.524    0.000    0.147    0.652
##  .compaW4S1 ~~                                                          
##    .compaW4S2         0.093    0.030    3.155    0.002    0.093    0.708
##  .compaW4P1 ~~                                                          
##    .compaW4P2         0.252    0.045    5.622    0.000    0.252    0.860
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .compaW1S1         4.197    0.030  138.342    0.000    4.197    8.606
##    .compaW1S2         4.095    0.033  125.587    0.000    4.095    7.812
##    .compaW1P1         3.945    0.049   79.933    0.000    3.945    6.523
##    .compaW1P2         3.972    0.043   91.339    0.000    3.972    7.370
##    .compaW2S1         4.182    0.034  123.841    0.000    4.182    8.435
##    .compaW2S2         4.084    0.036  112.558    0.000    4.084    7.601
##    .compaW2P1         3.982    0.046   87.339    0.000    3.982    7.296
##    .compaW2P2         4.026    0.050   81.180    0.000    4.026    6.862
##    .compaW3S1         4.206    0.034  123.996    0.000    4.206    8.485
##    .compaW3S2         4.067    0.036  113.728    0.000    4.067    7.745
##    .compaW3P1         3.982    0.051   78.282    0.000    3.982    6.922
##    .compaW3P2         4.023    0.045   89.976    0.000    4.023    7.782
##    .compaW4S1         4.237    0.035  121.782    0.000    4.237    8.625
##    .compaW4S2         4.163    0.038  110.427    0.000    4.163    7.847
##    .compaW4P1         3.840    0.056   68.271    0.000    3.840    6.529
##    .compaW4P2         3.950    0.057   69.830    0.000    3.950    6.675
##     compa1            0.000                               0.000    0.000
##    .compa2            0.000                               0.000    0.000
##    .compa3            0.000                               0.000    0.000
##    .compa4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .compaW1S1         0.166    0.028    5.853    0.000    0.166    0.697
##    .compaW1S2         0.191    0.030    6.359    0.000    0.191    0.696
##    .compaW1P1         0.332    0.044    7.578    0.000    0.332    0.907
##    .compaW1P2         0.258    0.030    8.455    0.000    0.258    0.887
##    .compaW2S1         0.095    0.015    6.203    0.000    0.095    0.385
##    .compaW2S2         0.114    0.017    6.780    0.000    0.114    0.394
##    .compaW2P1         0.227    0.031    7.361    0.000    0.227    0.762
##    .compaW2P2         0.276    0.038    7.265    0.000    0.276    0.800
##    .compaW3S1         0.089    0.014    6.514    0.000    0.089    0.364
##    .compaW3S2         0.095    0.014    6.808    0.000    0.095    0.344
##    .compaW3P1         0.258    0.039    6.601    0.000    0.258    0.778
##    .compaW3P2         0.196    0.028    6.972    0.000    0.196    0.735
##    .compaW4S1         0.121    0.028    4.302    0.000    0.121    0.503
##    .compaW4S2         0.143    0.033    4.297    0.000    0.143    0.507
##    .compaW4P1         0.290    0.047    6.152    0.000    0.290    0.837
##    .compaW4P2         0.296    0.045    6.508    0.000    0.296    0.845
##     compa1            0.072    0.026    2.749    0.006    1.000    1.000
##    .compa2           -0.072    0.068   -1.059    0.290   -0.479   -0.479
##    .compa3            0.015    0.010    1.583    0.114    0.098    0.098
##    .compa4           -0.066    0.025   -2.591    0.010   -0.551   -0.551
semPaths(lsmCompa, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Enthusiasm

lsmEnthu <- '

# factor at each time point with same loading
enthu1 =~ enthuW1S1        + a * enthuW1S2 + 
           peer * enthuW1P1 + aa * enthuW1P2

enthu2 =~ enthuW2S1        + a * enthuW2S2 + 
           peer * enthuW2P1 + aa * enthuW2P2

enthu3 =~ enthuW3S1        + a * enthuW3S2 + 
           peer * enthuW3P1 + aa * enthuW3P2
  
enthu4 =~ enthuW4S1        + a * enthuW4S2 + 
           peer * enthuW4P1 + aa * enthuW4P2

# structural paths between time points 
enthu4 ~ enthu3
enthu3 ~ enthu2
enthu2 ~ enthu1

# error covariance - similar parcels across waves
enthuW1S1 ~~ enthuW2S1 + enthuW3S1 + enthuW4S1
enthuW2S1 ~~ enthuW3S1 + enthuW4S1
enthuW3S1 ~~ enthuW4S1

enthuW1S2 ~~ enthuW2S2 + enthuW3S2 + enthuW4S2
enthuW2S2 ~~ enthuW3S2 + enthuW4S2
enthuW3S2 ~~ enthuW4S2

enthuW1P1 ~~ enthuW2P1 + enthuW3P1 + enthuW4P1
enthuW2P1 ~~ enthuW3P1 + enthuW4P1
enthuW3P1 ~~ enthuW4P1

enthuW1P2 ~~ enthuW2P2 + enthuW3P2 + enthuW4P2
enthuW2P2 ~~ enthuW3P2 + enthuW4P2
enthuW3P2 ~~ enthuW4P2

# error covariance - same method at one wave
enthuW1S1 ~~ enthuW1S2
enthuW1P1 ~~ enthuW1P2
enthuW2S1 ~~ enthuW2S2
enthuW2P1 ~~ enthuW2P2
enthuW3S1 ~~ enthuW3S2
enthuW3P1 ~~ enthuW3P2
enthuW4S1 ~~ enthuW4S2
enthuW4P1 ~~ enthuW4P2
'
lsmEnthu <- sem(lsmEnthu, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmEnthu, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 165 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               239.458
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2328.338
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.927
##   Tucker-Lewis Index (TLI)                       0.888
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1510.599
##   Loglikelihood unrestricted model (H1)      -1390.870
##                                                       
##   Akaike (AIC)                                3169.198
##   Bayesian (BIC)                              3432.404
##   Sample-size adjusted Bayesian (BIC)         3197.797
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.089
##   90 Percent confidence interval - lower         0.077
##   90 Percent confidence interval - upper         0.102
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.148
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   enthu1 =~                                                             
##     entW1S1           1.000                               0.466    0.708
##     entW1S2    (a)    1.176    0.090   13.061    0.000    0.548    0.738
##     entW1P1 (peer)    0.832    0.181    4.590    0.000    0.388    0.604
##     entW1P2   (aa)    0.701    0.162    4.329    0.000    0.327    0.562
##   enthu2 =~                                                             
##     entW2S1           1.000                               0.484    0.755
##     entW2S2    (a)    1.176    0.090   13.061    0.000    0.570    0.771
##     entW2P1 (peer)    0.832    0.181    4.590    0.000    0.403    0.631
##     entW2P2   (aa)    0.701    0.162    4.329    0.000    0.340    0.600
##   enthu3 =~                                                             
##     entW3S1           1.000                               0.448    0.729
##     entW3S2    (a)    1.176    0.090   13.061    0.000    0.527    0.721
##     entW3P1 (peer)    0.832    0.181    4.590    0.000    0.373    0.626
##     entW3P2   (aa)    0.701    0.162    4.329    0.000    0.314    0.580
##   enthu4 =~                                                             
##     entW4S1           1.000                               0.423    0.697
##     entW4S2    (a)    1.176    0.090   13.061    0.000    0.498    0.681
##     entW4P1 (peer)    0.832    0.181    4.590    0.000    0.352    0.597
##     entW4P2   (aa)    0.701    0.162    4.329    0.000    0.297    0.530
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   enthu4 ~                                                              
##     enthu3            0.995    0.063   15.671    0.000    1.052    1.052
##   enthu3 ~                                                              
##     enthu2            0.900    0.055   16.374    0.000    0.974    0.974
##   enthu2 ~                                                              
##     enthu1            1.042    0.086   12.138    0.000    1.002    1.002
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .enthuW1S1 ~~                                                          
##    .enthuW2S1         0.096    0.022    4.318    0.000    0.096    0.489
##    .enthuW3S1         0.085    0.023    3.739    0.000    0.085    0.433
##    .enthuW4S1         0.068    0.022    3.156    0.002    0.068    0.337
##  .enthuW2S1 ~~                                                          
##    .enthuW3S1         0.066    0.026    2.500    0.012    0.066    0.373
##    .enthuW4S1         0.084    0.027    3.161    0.002    0.084    0.458
##  .enthuW3S1 ~~                                                          
##    .enthuW4S1         0.080    0.028    2.869    0.004    0.080    0.436
##  .enthuW1S2 ~~                                                          
##    .enthuW2S2         0.087    0.032    2.726    0.006    0.087    0.369
##    .enthuW3S2         0.070    0.031    2.271    0.023    0.070    0.277
##    .enthuW4S2         0.081    0.032    2.555    0.011    0.081    0.302
##  .enthuW2S2 ~~                                                          
##    .enthuW3S2         0.131    0.035    3.755    0.000    0.131    0.548
##    .enthuW4S2         0.130    0.035    3.694    0.000    0.130    0.518
##  .enthuW3S2 ~~                                                          
##    .enthuW4S2         0.152    0.037    4.124    0.000    0.152    0.561
##  .enthuW1P1 ~~                                                          
##    .enthuW2P1         0.135    0.045    2.989    0.003    0.135    0.534
##    .enthuW3P1         0.126    0.043    2.952    0.003    0.126    0.530
##    .enthuW4P1         0.108    0.039    2.769    0.006    0.108    0.446
##  .enthuW2P1 ~~                                                          
##    .enthuW3P1         0.147    0.043    3.403    0.001    0.147    0.637
##    .enthuW4P1         0.100    0.042    2.402    0.016    0.100    0.428
##  .enthuW3P1 ~~                                                          
##    .enthuW4P1         0.106    0.041    2.608    0.009    0.106    0.483
##  .enthuW1P2 ~~                                                          
##    .enthuW2P2         0.122    0.038    3.214    0.001    0.122    0.559
##    .enthuW3P2         0.126    0.035    3.632    0.000    0.126    0.594
##    .enthuW4P2         0.091    0.033    2.709    0.007    0.091    0.397
##  .enthuW2P2 ~~                                                          
##    .enthuW3P2         0.113    0.035    3.176    0.001    0.113    0.563
##    .enthuW4P2         0.090    0.034    2.671    0.008    0.090    0.418
##  .enthuW3P2 ~~                                                          
##    .enthuW4P2         0.102    0.034    3.025    0.002    0.102    0.486
##  .enthuW1S1 ~~                                                          
##    .enthuW1S2         0.074    0.024    3.148    0.002    0.074    0.318
##  .enthuW1P1 ~~                                                          
##    .enthuW1P2         0.066    0.019    3.399    0.001    0.066    0.269
##  .enthuW2S1 ~~                                                          
##    .enthuW2S2         0.028    0.012    2.335    0.020    0.028    0.143
##  .enthuW2P1 ~~                                                          
##    .enthuW2P2         0.045    0.017    2.714    0.007    0.045    0.199
##  .enthuW3S1 ~~                                                          
##    .enthuW3S2         0.035    0.013    2.639    0.008    0.035    0.163
##  .enthuW3P1 ~~                                                          
##    .enthuW3P2         0.041    0.015    2.717    0.007    0.041    0.200
##  .enthuW4S1 ~~                                                          
##    .enthuW4S2         0.069    0.024    2.832    0.005    0.069    0.296
##  .enthuW4P1 ~~                                                          
##    .enthuW4P2         0.088    0.028    3.132    0.002    0.088    0.389
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .enthuW1S1         3.922    0.041   95.861    0.000    3.922    5.961
##    .enthuW1S2         3.535    0.046   76.599    0.000    3.535    4.764
##    .enthuW1P1         3.688    0.049   75.553    0.000    3.688    5.753
##    .enthuW1P2         3.942    0.045   88.483    0.000    3.942    6.784
##    .enthuW2S1         3.848    0.042   90.970    0.000    3.848    5.996
##    .enthuW2S2         3.544    0.049   72.512    0.000    3.544    4.796
##    .enthuW2P1         3.669    0.049   74.434    0.000    3.669    5.745
##    .enthuW2P2         3.976    0.044   89.683    0.000    3.976    7.017
##    .enthuW3S1         3.841    0.041   93.434    0.000    3.841    6.255
##    .enthuW3S2         3.504    0.049   71.168    0.000    3.504    4.796
##    .enthuW3P1         3.736    0.047   79.374    0.000    3.736    6.275
##    .enthuW3P2         3.961    0.043   91.199    0.000    3.961    7.315
##    .enthuW4S1         3.902    0.043   90.499    0.000    3.902    6.420
##    .enthuW4S2         3.539    0.051   68.765    0.000    3.539    4.841
##    .enthuW4P1         3.694    0.052   71.735    0.000    3.694    6.258
##    .enthuW4P2         3.917    0.050   77.838    0.000    3.917    6.989
##     enthu1            0.000                               0.000    0.000
##    .enthu2            0.000                               0.000    0.000
##    .enthu3            0.000                               0.000    0.000
##    .enthu4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .enthuW1S1         0.216    0.029    7.406    0.000    0.216    0.499
##    .enthuW1S2         0.251    0.047    5.385    0.000    0.251    0.455
##    .enthuW1P1         0.261    0.046    5.699    0.000    0.261    0.635
##    .enthuW1P2         0.231    0.038    6.142    0.000    0.231    0.684
##    .enthuW2S1         0.177    0.031    5.646    0.000    0.177    0.430
##    .enthuW2S2         0.222    0.042    5.330    0.000    0.222    0.406
##    .enthuW2P1         0.245    0.048    5.059    0.000    0.245    0.602
##    .enthuW2P2         0.206    0.040    5.083    0.000    0.206    0.641
##    .enthuW3S1         0.177    0.033    5.329    0.000    0.177    0.469
##    .enthuW3S2         0.257    0.041    6.188    0.000    0.257    0.481
##    .enthuW3P1         0.216    0.042    5.134    0.000    0.216    0.608
##    .enthuW3P2         0.195    0.033    5.983    0.000    0.195    0.664
##    .enthuW4S1         0.190    0.035    5.469    0.000    0.190    0.515
##    .enthuW4S2         0.286    0.047    6.092    0.000    0.286    0.536
##    .enthuW4P1         0.224    0.036    6.163    0.000    0.224    0.644
##    .enthuW4P2         0.226    0.036    6.200    0.000    0.226    0.719
##     enthu1            0.217    0.041    5.286    0.000    1.000    1.000
##    .enthu2           -0.001    0.018   -0.044    0.965   -0.003   -0.003
##    .enthu3            0.010    0.010    1.076    0.282    0.052    0.052
##    .enthu4           -0.019    0.017   -1.102    0.270   -0.106   -0.106
semPaths(lsmEnthu, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Industriousness

lsmIndus <- '

# factor at each time point with same loading
indus1 =~ indusW1S1        + a * indusW1S2 + 
           peer * indusW1P1 + aa * indusW1P2

indus2 =~ indusW2S1        + a * indusW2S2 + 
           peer * indusW2P1 + aa * indusW2P2

indus3 =~ indusW3S1        + a * indusW3S2 + 
           peer * indusW3P1 + aa * indusW3P2
  
indus4 =~ indusW4S1        + a * indusW4S2 + 
           peer * indusW4P1 + aa * indusW4P2

# structural paths between time points 
indus4 ~ indus3
indus3 ~ indus2
indus2 ~ indus1

# error covariance - similar parcels across waves
indusW1S1 ~~ indusW2S1 + indusW3S1 + indusW4S1
indusW2S1 ~~ indusW3S1 + indusW4S1
indusW3S1 ~~ indusW4S1

indusW1S2 ~~ indusW2S2 + indusW3S2 + indusW4S2
indusW2S2 ~~ indusW3S2 + indusW4S2
indusW3S2 ~~ indusW4S2

indusW1P1 ~~ indusW2P1 + indusW3P1 + indusW4P1
indusW2P1 ~~ indusW3P1 + indusW4P1
indusW3P1 ~~ indusW4P1

indusW1P2 ~~ indusW2P2 + indusW3P2 + indusW4P2
indusW2P2 ~~ indusW3P2 + indusW4P2
indusW3P2 ~~ indusW4P2

# error covariance - same method at one wave
indusW1S1 ~~ indusW1S2
indusW1P1 ~~ indusW1P2
indusW2S1 ~~ indusW2S2
indusW2P1 ~~ indusW2P2
indusW3S1 ~~ indusW3S2
indusW3P1 ~~ indusW3P2
indusW4S1 ~~ indusW4S2
indusW4P1 ~~ indusW4P2
'
lsmIndus <- sem(lsmIndus, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmIndus, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 142 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               224.996
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1960.526
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.920
##   Tucker-Lewis Index (TLI)                       0.877
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1627.811
##   Loglikelihood unrestricted model (H1)      -1515.313
##                                                       
##   Akaike (AIC)                                3403.621
##   Bayesian (BIC)                              3666.827
##   Sample-size adjusted Bayesian (BIC)         3432.220
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.085
##   90 Percent confidence interval - lower         0.072
##   90 Percent confidence interval - upper         0.098
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.168
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   indus1 =~                                                             
##     indW1S1           1.000                               0.401    0.684
##     indW1S2    (a)    1.391    0.123   11.266    0.000    0.558    0.764
##     indW1P1 (peer)    0.681    0.114    5.975    0.000    0.273    0.438
##     indW1P2   (aa)    0.534    0.129    4.138    0.000    0.214    0.336
##   indus2 =~                                                             
##     indW2S1           1.000                               0.455    0.748
##     indW2S2    (a)    1.391    0.123   11.266    0.000    0.632    0.856
##     indW2P1 (peer)    0.681    0.114    5.975    0.000    0.310    0.514
##     indW2P2   (aa)    0.534    0.129    4.138    0.000    0.243    0.392
##   indus3 =~                                                             
##     indW3S1           1.000                               0.406    0.668
##     indW3S2    (a)    1.391    0.123   11.266    0.000    0.565    0.789
##     indW3P1 (peer)    0.681    0.114    5.975    0.000    0.277    0.451
##     indW3P2   (aa)    0.534    0.129    4.138    0.000    0.217    0.370
##   indus4 =~                                                             
##     indW4S1           1.000                               0.418    0.737
##     indW4S2    (a)    1.391    0.123   11.266    0.000    0.581    0.833
##     indW4P1 (peer)    0.681    0.114    5.975    0.000    0.284    0.434
##     indW4P2   (aa)    0.534    0.129    4.138    0.000    0.223    0.383
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   indus4 ~                                                              
##     indus3            1.047    0.066   15.933    0.000    1.018    1.018
##   indus3 ~                                                              
##     indus2            0.886    0.062   14.275    0.000    0.991    0.991
##   indus2 ~                                                              
##     indus1            1.038    0.154    6.725    0.000    0.915    0.915
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .indusW1S1 ~~                                                          
##    .indusW2S1         0.078    0.017    4.573    0.000    0.078    0.455
##    .indusW3S1         0.077    0.018    4.359    0.000    0.077    0.398
##    .indusW4S1         0.057    0.017    3.456    0.001    0.057    0.350
##  .indusW2S1 ~~                                                          
##    .indusW3S1         0.080    0.020    4.068    0.000    0.080    0.436
##    .indusW4S1         0.056    0.018    3.031    0.002    0.056    0.360
##  .indusW3S1 ~~                                                          
##    .indusW4S1         0.092    0.019    4.784    0.000    0.092    0.532
##  .indusW1S2 ~~                                                          
##    .indusW2S2         0.069    0.031    2.206    0.027    0.069    0.383
##    .indusW3S2         0.050    0.029    1.713    0.087    0.050    0.239
##    .indusW4S2         0.026    0.030    0.877    0.381    0.026    0.145
##  .indusW2S2 ~~                                                          
##    .indusW3S2         0.044    0.032    1.367    0.172    0.044    0.265
##    .indusW4S2         0.008    0.033    0.229    0.819    0.008    0.052
##  .indusW3S2 ~~                                                          
##    .indusW4S2         0.054    0.034    1.622    0.105    0.054    0.321
##  .indusW1P1 ~~                                                          
##    .indusW2P1         0.138    0.032    4.353    0.000    0.138    0.475
##    .indusW3P1         0.131    0.033    3.974    0.000    0.131    0.428
##    .indusW4P1         0.175    0.037    4.731    0.000    0.175    0.528
##  .indusW2P1 ~~                                                          
##    .indusW3P1         0.176    0.037    4.807    0.000    0.176    0.622
##    .indusW4P1         0.184    0.038    4.864    0.000    0.184    0.601
##  .indusW3P1 ~~                                                          
##    .indusW4P1         0.235    0.042    5.545    0.000    0.235    0.728
##  .indusW1P2 ~~                                                          
##    .indusW2P2         0.165    0.036    4.584    0.000    0.165    0.483
##    .indusW3P2         0.165    0.036    4.576    0.000    0.165    0.503
##    .indusW4P2         0.169    0.041    4.176    0.000    0.169    0.525
##  .indusW2P2 ~~                                                          
##    .indusW3P2         0.176    0.040    4.429    0.000    0.176    0.567
##    .indusW4P2         0.198    0.038    5.160    0.000    0.198    0.647
##  .indusW3P2 ~~                                                          
##    .indusW4P2         0.194    0.038    5.091    0.000    0.194    0.663
##  .indusW1S1 ~~                                                          
##    .indusW1S2         0.047    0.034    1.352    0.177    0.047    0.231
##  .indusW1P1 ~~                                                          
##    .indusW1P2         0.117    0.026    4.541    0.000    0.117    0.346
##  .indusW2S1 ~~                                                          
##    .indusW2S2         0.006    0.014    0.399    0.690    0.006    0.037
##  .indusW2P1 ~~                                                          
##    .indusW2P2         0.072    0.021    3.407    0.001    0.072    0.244
##  .indusW3S1 ~~                                                          
##    .indusW3S2         0.019    0.012    1.560    0.119    0.019    0.095
##  .indusW3P1 ~~                                                          
##    .indusW3P2         0.071    0.023    3.120    0.002    0.071    0.239
##  .indusW4S1 ~~                                                          
##    .indusW4S2         0.024    0.025    0.981    0.327    0.024    0.165
##  .indusW4P1 ~~                                                          
##    .indusW4P2         0.021    0.022    0.986    0.324    0.021    0.067
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S1         3.340    0.036   91.671    0.000    3.340    5.701
##    .indusW1S2         3.025    0.045   66.613    0.000    3.025    4.143
##    .indusW1P1         3.776    0.049   76.583    0.000    3.776    6.055
##    .indusW1P2         3.627    0.051   71.395    0.000    3.627    5.691
##    .indusW2S1         3.311    0.041   81.673    0.000    3.311    5.446
##    .indusW2S2         2.966    0.049   60.694    0.000    2.966    4.015
##    .indusW2P1         3.736    0.048   77.739    0.000    3.736    6.196
##    .indusW2P2         3.628    0.050   72.099    0.000    3.628    5.856
##    .indusW3S1         3.326    0.041   80.650    0.000    3.326    5.469
##    .indusW3S2         3.027    0.048   62.650    0.000    3.027    4.230
##    .indusW3P1         3.748    0.050   75.147    0.000    3.748    6.109
##    .indusW3P2         3.617    0.049   73.888    0.000    3.617    6.160
##    .indusW4S1         3.327    0.040   82.589    0.000    3.327    5.871
##    .indusW4S2         3.058    0.050   61.677    0.000    3.058    4.384
##    .indusW4P1         3.681    0.056   65.547    0.000    3.681    5.617
##    .indusW4P2         3.538    0.051   69.715    0.000    3.538    6.078
##     indus1            0.000                               0.000    0.000
##    .indus2            0.000                               0.000    0.000
##    .indus3            0.000                               0.000    0.000
##    .indus4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .indusW1S1         0.183    0.031    5.851    0.000    0.183    0.532
##    .indusW1S2         0.222    0.058    3.811    0.000    0.222    0.417
##    .indusW1P1         0.314    0.038    8.347    0.000    0.314    0.808
##    .indusW1P2         0.360    0.042    8.665    0.000    0.360    0.887
##    .indusW2S1         0.163    0.024    6.867    0.000    0.163    0.440
##    .indusW2S2         0.146    0.042    3.442    0.001    0.146    0.267
##    .indusW2P1         0.268    0.034    7.938    0.000    0.268    0.736
##    .indusW2P2         0.325    0.044    7.337    0.000    0.325    0.846
##    .indusW3S1         0.205    0.026    7.976    0.000    0.205    0.554
##    .indusW3S2         0.193    0.037    5.183    0.000    0.193    0.377
##    .indusW3P1         0.300    0.040    7.554    0.000    0.300    0.797
##    .indusW3P2         0.298    0.038    7.840    0.000    0.298    0.863
##    .indusW4S1         0.147    0.026    5.648    0.000    0.147    0.457
##    .indusW4S2         0.149    0.048    3.081    0.002    0.149    0.307
##    .indusW4P1         0.348    0.050    6.972    0.000    0.348    0.811
##    .indusW4P2         0.289    0.041    7.029    0.000    0.289    0.853
##     indus1            0.161    0.035    4.630    0.000    1.000    1.000
##    .indus2            0.034    0.026    1.291    0.197    0.162    0.162
##    .indus3            0.003    0.009    0.311    0.756    0.017    0.017
##    .indus4           -0.006    0.016   -0.389    0.697   -0.036   -0.036
semPaths(lsmIndus, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Intellect

lsmIntel <- '

# factor at each time point with same loading
intel1 =~ intelW1S1        + a * intelW1S2 + 
           peer * intelW1P1 + aa * intelW1P2

intel2 =~ intelW2S1        + a * intelW2S2 + 
           peer * intelW2P1 + aa * intelW2P2

intel3 =~ intelW3S1        + a * intelW3S2 + 
           peer * intelW3P1 + aa * intelW3P2
  
intel4 =~ intelW4S1        + a * intelW4S2 + 
           peer * intelW4P1 + aa * intelW4P2

# structural paths between time points 
intel4 ~ intel3
intel3 ~ intel2
intel2 ~ intel1

# error covariance - similar parcels across waves
intelW1S1 ~~ intelW2S1 + intelW3S1 + intelW4S1
intelW2S1 ~~ intelW3S1 + intelW4S1
intelW3S1 ~~ intelW4S1

intelW1S2 ~~ intelW2S2 + intelW3S2 + intelW4S2
intelW2S2 ~~ intelW3S2 + intelW4S2
intelW3S2 ~~ intelW4S2

intelW1P1 ~~ intelW2P1 + intelW3P1 + intelW4P1
intelW2P1 ~~ intelW3P1 + intelW4P1
intelW3P1 ~~ intelW4P1

intelW1P2 ~~ intelW2P2 + intelW3P2 + intelW4P2
intelW2P2 ~~ intelW3P2 + intelW4P2
intelW3P2 ~~ intelW4P2

# error covariance - same method at one wave
intelW1S1 ~~ intelW1S2
intelW1P1 ~~ intelW1P2
intelW2S1 ~~ intelW2S2
intelW2P1 ~~ intelW2P2
intelW3S1 ~~ intelW3S2
intelW3P1 ~~ intelW3P2
intelW4S1 ~~ intelW4S2
intelW4P1 ~~ intelW4P2
'
lsmIntel <- sem(lsmIntel, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmIntel, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 178 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               218.233
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2029.552
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.927
##   Tucker-Lewis Index (TLI)                       0.887
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1320.147
##   Loglikelihood unrestricted model (H1)      -1211.030
##                                                       
##   Akaike (AIC)                                2788.293
##   Bayesian (BIC)                              3051.498
##   Sample-size adjusted Bayesian (BIC)         2816.892
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.083
##   90 Percent confidence interval - lower         0.070
##   90 Percent confidence interval - upper         0.097
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.171
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   intel1 =~                                                             
##     intW1S1           1.000                               0.433    0.751
##     intW1S2    (a)    1.101    0.107   10.322    0.000    0.477    0.745
##     intW1P1 (peer)    0.584    0.111    5.281    0.000    0.253    0.461
##     intW1P2   (aa)    0.408    0.107    3.800    0.000    0.177    0.324
##   intel2 =~                                                             
##     intW2S1           1.000                               0.418    0.742
##     intW2S2    (a)    1.101    0.107   10.322    0.000    0.461    0.734
##     intW2P1 (peer)    0.584    0.111    5.281    0.000    0.244    0.440
##     intW2P2   (aa)    0.408    0.107    3.800    0.000    0.171    0.360
##   intel3 =~                                                             
##     intW3S1           1.000                               0.434    0.739
##     intW3S2    (a)    1.101    0.107   10.322    0.000    0.478    0.760
##     intW3P1 (peer)    0.584    0.111    5.281    0.000    0.254    0.425
##     intW3P2   (aa)    0.408    0.107    3.800    0.000    0.177    0.308
##   intel4 =~                                                             
##     intW4S1           1.000                               0.358    0.642
##     intW4S2    (a)    1.101    0.107   10.322    0.000    0.395    0.679
##     intW4P1 (peer)    0.584    0.111    5.281    0.000    0.209    0.331
##     intW4P2   (aa)    0.408    0.107    3.800    0.000    0.146    0.290
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   intel4 ~                                                              
##     intel3            0.945    0.066   14.424    0.000    1.146    1.146
##   intel3 ~                                                              
##     intel2            1.042    0.071   14.759    0.000    1.003    1.003
##   intel2 ~                                                              
##     intel1            0.941    0.099    9.507    0.000    0.975    0.975
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .intelW1S1 ~~                                                          
##    .intelW2S1         0.064    0.018    3.461    0.001    0.064    0.442
##    .intelW3S1         0.060    0.019    3.060    0.002    0.060    0.395
##    .intelW4S1         0.043    0.018    2.345    0.019    0.043    0.264
##  .intelW2S1 ~~                                                          
##    .intelW3S1         0.071    0.020    3.560    0.000    0.071    0.478
##    .intelW4S1         0.045    0.019    2.412    0.016    0.045    0.280
##  .intelW3S1 ~~                                                          
##    .intelW4S1         0.054    0.020    2.676    0.007    0.054    0.320
##  .intelW1S2 ~~                                                          
##    .intelW2S2         0.067    0.022    3.031    0.002    0.067    0.370
##    .intelW3S2         0.046    0.023    2.059    0.040    0.046    0.265
##    .intelW4S2         0.050    0.022    2.291    0.022    0.050    0.274
##  .intelW2S2 ~~                                                          
##    .intelW3S2         0.084    0.025    3.390    0.001    0.084    0.483
##    .intelW4S2         0.075    0.024    3.189    0.001    0.075    0.415
##  .intelW3S2 ~~                                                          
##    .intelW4S2         0.061    0.024    2.595    0.009    0.061    0.350
##  .intelW1P1 ~~                                                          
##    .intelW2P1         0.135    0.029    4.700    0.000    0.135    0.555
##    .intelW3P1         0.183    0.031    5.831    0.000    0.183    0.696
##    .intelW4P1         0.149    0.031    4.836    0.000    0.149    0.512
##  .intelW2P1 ~~                                                          
##    .intelW3P1         0.191    0.034    5.534    0.000    0.191    0.709
##    .intelW4P1         0.155    0.036    4.347    0.000    0.155    0.520
##  .intelW3P1 ~~                                                          
##    .intelW4P1         0.173    0.040    4.282    0.000    0.173    0.537
##  .intelW1P2 ~~                                                          
##    .intelW2P2         0.165    0.025    6.635    0.000    0.165    0.725
##    .intelW3P2         0.180    0.032    5.528    0.000    0.180    0.635
##    .intelW4P2         0.136    0.028    4.912    0.000    0.136    0.546
##  .intelW2P2 ~~                                                          
##    .intelW3P2         0.158    0.029    5.470    0.000    0.158    0.650
##    .intelW4P2         0.127    0.023    5.446    0.000    0.127    0.597
##  .intelW3P2 ~~                                                          
##    .intelW4P2         0.157    0.033    4.806    0.000    0.157    0.593
##  .intelW1S1 ~~                                                          
##    .intelW1S2         0.038    0.023    1.645    0.100    0.038    0.231
##  .intelW1P1 ~~                                                          
##    .intelW1P2         0.058    0.013    4.302    0.000    0.058    0.230
##  .intelW2S1 ~~                                                          
##    .intelW2S2         0.029    0.010    3.020    0.003    0.029    0.183
##  .intelW2P1 ~~                                                          
##    .intelW2P2         0.027    0.012    2.191    0.028    0.027    0.122
##  .intelW3S1 ~~                                                          
##    .intelW3S2         0.013    0.010    1.273    0.203    0.013    0.081
##  .intelW3P1 ~~                                                          
##    .intelW3P2         0.027    0.018    1.522    0.128    0.027    0.090
##  .intelW4S1 ~~                                                          
##    .intelW4S2         0.066    0.031    2.114    0.035    0.066    0.362
##  .intelW4P1 ~~                                                          
##    .intelW4P2         0.113    0.027    4.169    0.000    0.113    0.393
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .intelW1S1         3.712    0.036  103.457    0.000    3.712    6.433
##    .intelW1S2         3.620    0.040   90.878    0.000    3.620    5.652
##    .intelW1P1         3.998    0.043   93.712    0.000    3.998    7.288
##    .intelW1P2         4.002    0.043   93.515    0.000    4.002    7.334
##    .intelW2S1         3.644    0.037   97.637    0.000    3.644    6.465
##    .intelW2S2         3.595    0.042   86.044    0.000    3.595    5.727
##    .intelW2P1         3.960    0.045   88.781    0.000    3.960    7.134
##    .intelW2P2         4.026    0.038  106.690    0.000    4.026    8.492
##    .intelW3S1         3.658    0.039   93.180    0.000    3.658    6.223
##    .intelW3S2         3.631    0.042   85.934    0.000    3.631    5.770
##    .intelW3P1         3.979    0.048   82.997    0.000    3.979    6.666
##    .intelW3P2         3.936    0.048   82.087    0.000    3.936    6.832
##    .intelW4S1         3.683    0.040   91.958    0.000    3.683    6.597
##    .intelW4S2         3.644    0.041   89.607    0.000    3.644    6.274
##    .intelW4P1         3.856    0.058   66.734    0.000    3.856    6.096
##    .intelW4P2         3.910    0.046   85.924    0.000    3.910    7.763
##     intel1            0.000                               0.000    0.000
##    .intel2            0.000                               0.000    0.000
##    .intel3            0.000                               0.000    0.000
##    .intel4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .intelW1S1         0.145    0.029    4.947    0.000    0.145    0.436
##    .intelW1S2         0.183    0.034    5.388    0.000    0.183    0.445
##    .intelW1P1         0.237    0.030    7.975    0.000    0.237    0.787
##    .intelW1P2         0.266    0.032    8.447    0.000    0.266    0.895
##    .intelW2S1         0.143    0.022    6.420    0.000    0.143    0.449
##    .intelW2S2         0.182    0.029    6.239    0.000    0.182    0.461
##    .intelW2P1         0.248    0.034    7.383    0.000    0.248    0.806
##    .intelW2P2         0.196    0.024    8.021    0.000    0.196    0.870
##    .intelW3S1         0.157    0.025    6.161    0.000    0.157    0.454
##    .intelW3S2         0.167    0.029    5.773    0.000    0.167    0.422
##    .intelW3P1         0.292    0.039    7.427    0.000    0.292    0.819
##    .intelW3P2         0.300    0.040    7.533    0.000    0.300    0.905
##    .intelW4S1         0.183    0.035    5.181    0.000    0.183    0.588
##    .intelW4S2         0.182    0.038    4.772    0.000    0.182    0.539
##    .intelW4P1         0.356    0.047    7.658    0.000    0.356    0.891
##    .intelW4P2         0.232    0.029    8.037    0.000    0.232    0.916
##     intel1            0.188    0.036    5.234    0.000    1.000    1.000
##    .intel2            0.009    0.017    0.515    0.607    0.050    0.050
##    .intel3           -0.001    0.009   -0.145    0.884   -0.007   -0.007
##    .intel4           -0.040    0.025   -1.606    0.108   -0.312   -0.312
semPaths(lsmIntel, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Openness aspect

lsmOpena <- '

# factor at each time point with same loading
opena1 =~ openaW1S1        + a * openaW1S2 + 
           peer * openaW1P1 + aa * openaW1P2

opena2 =~ openaW2S1        + a * openaW2S2 + 
           peer * openaW2P1 + aa * openaW2P2

opena3 =~ openaW3S1        + a * openaW3S2 + 
           peer * openaW3P1 + aa * openaW3P2
  
opena4 =~ openaW4S1        + a * openaW4S2 + 
           peer * openaW4P1 + aa * openaW4P2

# structural paths between time points 
opena4 ~ opena3
opena3 ~ opena2
opena2 ~ opena1

# error covariance - similar parcels across waves
openaW1S1 ~~ openaW2S1 + openaW3S1 + openaW4S1
openaW2S1 ~~ openaW3S1 + openaW4S1
openaW3S1 ~~ openaW4S1

openaW1S2 ~~ openaW2S2 + openaW3S2 + openaW4S2
openaW2S2 ~~ openaW3S2 + openaW4S2
openaW3S2 ~~ openaW4S2

openaW1P1 ~~ openaW2P1 + openaW3P1 + openaW4P1
openaW2P1 ~~ openaW3P1 + openaW4P1
openaW3P1 ~~ openaW4P1

openaW1P2 ~~ openaW2P2 + openaW3P2 + openaW4P2
openaW2P2 ~~ openaW3P2 + openaW4P2
openaW3P2 ~~ openaW4P2

# error covariance - same method at one wave
openaW1S1 ~~ openaW1S2
openaW1P1 ~~ openaW1P2
openaW2S1 ~~ openaW2S2
openaW2P1 ~~ openaW2P2
openaW3S1 ~~ openaW3S2
openaW3P1 ~~ openaW3P2
openaW4S1 ~~ openaW4S2
openaW4P1 ~~ openaW4P2
'
lsmOpena <- sem(lsmOpena, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmOpena, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 187 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               146.582
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2368.492
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.969
##   Tucker-Lewis Index (TLI)                       0.953
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1140.330
##   Loglikelihood unrestricted model (H1)      -1067.039
##                                                       
##   Akaike (AIC)                                2428.660
##   Bayesian (BIC)                              2691.866
##   Sample-size adjusted Bayesian (BIC)         2457.259
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.058
##   90 Percent confidence interval - lower         0.044
##   90 Percent confidence interval - upper         0.073
##   P-value RMSEA <= 0.05                          0.168
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.114
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opena1 =~                                                             
##     opnW1S1           1.000                               0.484    0.737
##     opnW1S2    (a)    0.906    0.063   14.304    0.000    0.438    0.765
##     opnW1P1 (peer)    0.628    0.076    8.318    0.000    0.304    0.558
##     opnW1P2   (aa)    0.479    0.076    6.296    0.000    0.232    0.478
##   opena2 =~                                                             
##     opnW2S1           1.000                               0.538    0.798
##     opnW2S2    (a)    0.906    0.063   14.304    0.000    0.487    0.807
##     opnW2P1 (peer)    0.628    0.076    8.318    0.000    0.338    0.598
##     opnW2P2   (aa)    0.479    0.076    6.296    0.000    0.257    0.462
##   opena3 =~                                                             
##     opnW3S1           1.000                               0.541    0.828
##     opnW3S2    (a)    0.906    0.063   14.304    0.000    0.490    0.864
##     opnW3P1 (peer)    0.628    0.076    8.318    0.000    0.340    0.618
##     opnW3P2   (aa)    0.479    0.076    6.296    0.000    0.259    0.491
##   opena4 =~                                                             
##     opnW4S1           1.000                               0.474    0.717
##     opnW4S2    (a)    0.906    0.063   14.304    0.000    0.430    0.742
##     opnW4P1 (peer)    0.628    0.076    8.318    0.000    0.298    0.548
##     opnW4P2   (aa)    0.479    0.076    6.296    0.000    0.227    0.460
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   opena4 ~                                                              
##     opena3            0.913    0.047   19.282    0.000    1.041    1.041
##   opena3 ~                                                              
##     opena2            1.003    0.046   21.721    0.000    0.997    0.997
##   opena2 ~                                                              
##     opena1            1.108    0.091   12.148    0.000    0.996    0.996
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .openaW1S1 ~~                                                          
##    .openaW2S1         0.108    0.020    5.526    0.000    0.108    0.599
##    .openaW3S1         0.086    0.018    4.851    0.000    0.086    0.531
##    .openaW4S1         0.103    0.020    5.165    0.000    0.103    0.502
##  .openaW2S1 ~~                                                          
##    .openaW3S1         0.082    0.019    4.429    0.000    0.082    0.552
##    .openaW4S1         0.095    0.021    4.632    0.000    0.095    0.507
##  .openaW3S1 ~~                                                          
##    .openaW4S1         0.089    0.019    4.562    0.000    0.089    0.526
##  .openaW1S2 ~~                                                          
##    .openaW2S2         0.033    0.015    2.152    0.031    0.033    0.249
##    .openaW3S2         0.035    0.014    2.522    0.012    0.035    0.334
##    .openaW4S2         0.040    0.016    2.480    0.013    0.040    0.279
##  .openaW2S2 ~~                                                          
##    .openaW3S2         0.049    0.015    3.223    0.001    0.049    0.479
##    .openaW4S2         0.051    0.017    2.957    0.003    0.051    0.367
##  .openaW3S2 ~~                                                          
##    .openaW4S2         0.049    0.016    3.116    0.002    0.049    0.447
##  .openaW1P1 ~~                                                          
##    .openaW2P1         0.095    0.022    4.410    0.000    0.095    0.465
##    .openaW3P1         0.101    0.022    4.622    0.000    0.101    0.516
##    .openaW4P1         0.035    0.026    1.360    0.174    0.035    0.171
##  .openaW2P1 ~~                                                          
##    .openaW3P1         0.135    0.025    5.510    0.000    0.135    0.692
##    .openaW4P1         0.083    0.028    3.011    0.003    0.083    0.403
##  .openaW3P1 ~~                                                          
##    .openaW4P1         0.110    0.029    3.798    0.000    0.110    0.559
##  .openaW1P2 ~~                                                          
##    .openaW2P2         0.129    0.022    5.874    0.000    0.129    0.614
##    .openaW3P2         0.099    0.022    4.432    0.000    0.099    0.507
##    .openaW4P2         0.111    0.021    5.225    0.000    0.111    0.597
##  .openaW2P2 ~~                                                          
##    .openaW3P2         0.149    0.027    5.499    0.000    0.149    0.654
##    .openaW4P2         0.133    0.026    5.047    0.000    0.133    0.615
##  .openaW3P2 ~~                                                          
##    .openaW4P2         0.140    0.029    4.788    0.000    0.140    0.695
##  .openaW1S1 ~~                                                          
##    .openaW1S2         0.043    0.017    2.597    0.009    0.043    0.262
##  .openaW1P1 ~~                                                          
##    .openaW1P2         0.045    0.013    3.503    0.000    0.045    0.234
##  .openaW2S1 ~~                                                          
##    .openaW2S2         0.030    0.009    3.470    0.001    0.030    0.207
##  .openaW2P1 ~~                                                          
##    .openaW2P2         0.031    0.013    2.411    0.016    0.031    0.137
##  .openaW3S1 ~~                                                          
##    .openaW3S2         0.011    0.007    1.539    0.124    0.011    0.103
##  .openaW3P1 ~~                                                          
##    .openaW3P2         0.018    0.011    1.654    0.098    0.018    0.091
##  .openaW4S1 ~~                                                          
##    .openaW4S2         0.055    0.023    2.461    0.014    0.055    0.310
##  .openaW4P1 ~~                                                          
##    .openaW4P2         0.045    0.021    2.179    0.029    0.045    0.224
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .openaW1S1         3.865    0.041   94.717    0.000    3.865    5.888
##    .openaW1S2         3.916    0.036  109.899    0.000    3.916    6.834
##    .openaW1P1         3.859    0.042   91.185    0.000    3.859    7.088
##    .openaW1P2         3.656    0.038   97.377    0.000    3.656    7.551
##    .openaW2S1         3.812    0.044   87.125    0.000    3.812    5.658
##    .openaW2S2         3.861    0.040   96.555    0.000    3.861    6.397
##    .openaW2P1         3.827    0.044   87.519    0.000    3.827    6.779
##    .openaW2P2         3.595    0.044   81.576    0.000    3.595    6.448
##    .openaW3S1         3.825    0.043   89.604    0.000    3.825    5.857
##    .openaW3S2         3.910    0.037  104.970    0.000    3.910    6.897
##    .openaW3P1         3.837    0.043   89.734    0.000    3.837    6.981
##    .openaW3P2         3.657    0.043   85.878    0.000    3.657    6.933
##    .openaW4S1         3.869    0.046   84.932    0.000    3.869    5.847
##    .openaW4S2         3.937    0.041   97.187    0.000    3.937    6.800
##    .openaW4P1         3.728    0.048   77.391    0.000    3.728    6.853
##    .openaW4P2         3.644    0.042   86.414    0.000    3.644    7.383
##     opena1            0.000                               0.000    0.000
##    .opena2            0.000                               0.000    0.000
##    .opena3            0.000                               0.000    0.000
##    .opena4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .openaW1S1         0.197    0.027    7.426    0.000    0.197    0.457
##    .openaW1S2         0.136    0.023    6.057    0.000    0.136    0.415
##    .openaW1P1         0.204    0.026    7.988    0.000    0.204    0.688
##    .openaW1P2         0.181    0.022    8.301    0.000    0.181    0.771
##    .openaW2S1         0.165    0.024    6.941    0.000    0.165    0.364
##    .openaW2S2         0.127    0.020    6.243    0.000    0.127    0.349
##    .openaW2P1         0.205    0.028    7.308    0.000    0.205    0.642
##    .openaW2P2         0.245    0.030    8.140    0.000    0.245    0.787
##    .openaW3S1         0.134    0.021    6.427    0.000    0.134    0.314
##    .openaW3S2         0.081    0.017    4.892    0.000    0.081    0.253
##    .openaW3P1         0.187    0.027    6.868    0.000    0.187    0.618
##    .openaW3P2         0.211    0.031    6.754    0.000    0.211    0.759
##    .openaW4S1         0.213    0.035    6.137    0.000    0.213    0.486
##    .openaW4S2         0.151    0.027    5.555    0.000    0.151    0.449
##    .openaW4P1         0.207    0.031    6.586    0.000    0.207    0.700
##    .openaW4P2         0.192    0.027    7.026    0.000    0.192    0.788
##     opena1            0.234    0.039    6.036    0.000    1.000    1.000
##    .opena2            0.002    0.019    0.110    0.912    0.007    0.007
##    .opena3            0.002    0.008    0.250    0.803    0.007    0.007
##    .opena4           -0.019    0.022   -0.858    0.391   -0.083   -0.083
semPaths(lsmOpena, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Orderliness

lsmOrder <- '

# factor at each time point with same loading
order1 =~ orderW1S1        + a * orderW1S2 + 
           peer * orderW1P1 + aa * orderW1P2

order2 =~ orderW2S1        + a * orderW2S2 + 
           peer * orderW2P1 + aa * orderW2P2

order3 =~ orderW3S1        + a * orderW3S2 + 
           peer * orderW3P1 + aa * orderW3P2
  
order4 =~ orderW4S1        + a * orderW4S2 + 
           peer * orderW4P1 + aa * orderW4P2

# structural paths between time points 
order4 ~ order3
order3 ~ order2
order2 ~ order1

# error covariance - similar parcels across waves
orderW1S1 ~~ orderW2S1 + orderW3S1 + orderW4S1
orderW2S1 ~~ orderW3S1 + orderW4S1
orderW3S1 ~~ orderW4S1

orderW1S2 ~~ orderW2S2 + orderW3S2 + orderW4S2
orderW2S2 ~~ orderW3S2 + orderW4S2
orderW3S2 ~~ orderW4S2

orderW1P1 ~~ orderW2P1 + orderW3P1 + orderW4P1
orderW2P1 ~~ orderW3P1 + orderW4P1
orderW3P1 ~~ orderW4P1

orderW1P2 ~~ orderW2P2 + orderW3P2 + orderW4P2
orderW2P2 ~~ orderW3P2 + orderW4P2
orderW3P2 ~~ orderW4P2

# error covariance - same method at one wave
orderW1S1 ~~ orderW1S2
orderW1P1 ~~ orderW1P2
orderW2S1 ~~ orderW2S2
orderW2P1 ~~ orderW2P2
orderW3S1 ~~ orderW3S2
orderW3P1 ~~ orderW3P2
orderW4S1 ~~ orderW4S2
orderW4P1 ~~ orderW4P2
'
lsmOrder <- sem(lsmOrder, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmOrder, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 136 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               162.667
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2131.446
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.958
##   Tucker-Lewis Index (TLI)                       0.935
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1600.261
##   Loglikelihood unrestricted model (H1)      -1518.927
##                                                       
##   Akaike (AIC)                                3348.521
##   Bayesian (BIC)                              3611.727
##   Sample-size adjusted Bayesian (BIC)         3377.120
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.065
##   90 Percent confidence interval - lower         0.051
##   90 Percent confidence interval - upper         0.079
##   P-value RMSEA <= 0.05                          0.043
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.110
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   order1 =~                                                             
##     ordW1S1           1.000                               0.533    0.762
##     ordW1S2    (a)    0.790    0.054   14.610    0.000    0.421    0.662
##     ordW1P1 (peer)    0.780    0.097    8.032    0.000    0.415    0.569
##     ordW1P2   (aa)    0.558    0.075    7.410    0.000    0.297    0.489
##   order2 =~                                                             
##     ordW2S1           1.000                               0.540    0.808
##     ordW2S2    (a)    0.790    0.054   14.610    0.000    0.426    0.703
##     ordW2P1 (peer)    0.780    0.097    8.032    0.000    0.421    0.619
##     ordW2P2   (aa)    0.558    0.075    7.410    0.000    0.301    0.560
##   order3 =~                                                             
##     ordW3S1           1.000                               0.566    0.830
##     ordW3S2    (a)    0.790    0.054   14.610    0.000    0.447    0.749
##     ordW3P1 (peer)    0.780    0.097    8.032    0.000    0.442    0.574
##     ordW3P2   (aa)    0.558    0.075    7.410    0.000    0.316    0.555
##   order4 =~                                                             
##     ordW4S1           1.000                               0.561    0.803
##     ordW4S2    (a)    0.790    0.054   14.610    0.000    0.443    0.714
##     ordW4P1 (peer)    0.780    0.097    8.032    0.000    0.437    0.585
##     ordW4P2   (aa)    0.558    0.075    7.410    0.000    0.313    0.551
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   order4 ~                                                              
##     order3            0.977    0.057   17.051    0.000    0.987    0.987
##   order3 ~                                                              
##     order2            1.060    0.053   19.928    0.000    1.010    1.010
##   order2 ~                                                              
##     order1            1.013    0.094   10.754    0.000    1.000    1.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .orderW1S1 ~~                                                          
##    .orderW2S1         0.005    0.021    0.219    0.827    0.005    0.026
##    .orderW3S1         0.027    0.022    1.249    0.212    0.027    0.157
##    .orderW4S1         0.004    0.023    0.180    0.857    0.004    0.022
##  .orderW2S1 ~~                                                          
##    .orderW3S1         0.030    0.023    1.305    0.192    0.030    0.203
##    .orderW4S1        -0.004    0.023   -0.188    0.851   -0.004   -0.026
##  .orderW3S1 ~~                                                          
##    .orderW4S1         0.041    0.024    1.718    0.086    0.041    0.260
##  .orderW1S2 ~~                                                          
##    .orderW2S2         0.088    0.016    5.397    0.000    0.088    0.428
##    .orderW3S2         0.060    0.015    3.924    0.000    0.060    0.319
##    .orderW4S2         0.060    0.017    3.523    0.000    0.060    0.291
##  .orderW2S2 ~~                                                          
##    .orderW3S2         0.073    0.016    4.417    0.000    0.073    0.426
##    .orderW4S2         0.073    0.018    4.069    0.000    0.073    0.388
##  .orderW3S2 ~~                                                          
##    .orderW4S2         0.084    0.017    5.062    0.000    0.084    0.488
##  .orderW1P1 ~~                                                          
##    .orderW2P1         0.164    0.036    4.499    0.000    0.164    0.512
##    .orderW3P1         0.187    0.044    4.219    0.000    0.187    0.493
##    .orderW4P1         0.187    0.041    4.519    0.000    0.187    0.512
##  .orderW2P1 ~~                                                          
##    .orderW3P1         0.214    0.041    5.280    0.000    0.214    0.638
##    .orderW4P1         0.212    0.038    5.578    0.000    0.212    0.656
##  .orderW3P1 ~~                                                          
##    .orderW4P1         0.280    0.047    5.974    0.000    0.280    0.732
##  .orderW1P2 ~~                                                          
##    .orderW2P2         0.124    0.026    4.713    0.000    0.124    0.526
##    .orderW3P2         0.128    0.029    4.442    0.000    0.128    0.511
##    .orderW4P2         0.095    0.027    3.529    0.000    0.095    0.377
##  .orderW2P2 ~~                                                          
##    .orderW3P2         0.129    0.025    5.056    0.000    0.129    0.611
##    .orderW4P2         0.104    0.024    4.263    0.000    0.104    0.492
##  .orderW3P2 ~~                                                          
##    .orderW4P2         0.084    0.029    2.890    0.004    0.084    0.373
##  .orderW1S1 ~~                                                          
##    .orderW1S2         0.086    0.023    3.755    0.000    0.086    0.398
##  .orderW1P1 ~~                                                          
##    .orderW1P2         0.085    0.025    3.436    0.001    0.085    0.268
##  .orderW2S1 ~~                                                          
##    .orderW2S2         0.001    0.012    0.109    0.913    0.001    0.008
##  .orderW2P1 ~~                                                          
##    .orderW2P2         0.029    0.013    2.189    0.029    0.029    0.124
##  .orderW3S1 ~~                                                          
##    .orderW3S2         0.011    0.011    1.065    0.287    0.011    0.075
##  .orderW3P1 ~~                                                          
##    .orderW3P2         0.055    0.020    2.789    0.005    0.055    0.186
##  .orderW4S1 ~~                                                          
##    .orderW4S2         0.061    0.028    2.167    0.030    0.061    0.335
##  .orderW4P1 ~~                                                          
##    .orderW4P2         0.091    0.026    3.491    0.000    0.091    0.316
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .orderW1S1         3.397    0.044   78.094    0.000    3.397    4.857
##    .orderW1S2         3.727    0.040   94.324    0.000    3.727    5.866
##    .orderW1P1         3.240    0.056   58.032    0.000    3.240    4.436
##    .orderW1P2         3.521    0.047   74.533    0.000    3.521    5.795
##    .orderW2S1         3.488    0.045   77.797    0.000    3.488    5.225
##    .orderW2S2         3.791    0.040   93.813    0.000    3.791    6.254
##    .orderW2P1         3.342    0.052   64.184    0.000    3.342    4.921
##    .orderW2P2         3.571    0.042   85.107    0.000    3.571    6.646
##    .orderW3S1         3.489    0.046   76.583    0.000    3.489    5.113
##    .orderW3S2         3.761    0.040   93.836    0.000    3.761    6.300
##    .orderW3P1         3.274    0.060   54.203    0.000    3.274    4.255
##    .orderW3P2         3.494    0.046   75.887    0.000    3.494    6.135
##    .orderW4S1         3.518    0.050   69.865    0.000    3.518    5.037
##    .orderW4S2         3.784    0.045   84.864    0.000    3.784    6.094
##    .orderW4P1         3.210    0.061   52.223    0.000    3.210    4.292
##    .orderW4P2         3.415    0.051   66.630    0.000    3.415    6.015
##     order1            0.000                               0.000    0.000
##    .order2            0.000                               0.000    0.000
##    .order3            0.000                               0.000    0.000
##    .order4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .orderW1S1         0.206    0.036    5.771    0.000    0.206    0.420
##    .orderW1S2         0.226    0.026    8.842    0.000    0.226    0.561
##    .orderW1P1         0.361    0.044    8.205    0.000    0.361    0.677
##    .orderW1P2         0.281    0.033    8.475    0.000    0.281    0.761
##    .orderW2S1         0.155    0.027    5.621    0.000    0.155    0.347
##    .orderW2S2         0.186    0.022    8.400    0.000    0.186    0.506
##    .orderW2P1         0.284    0.039    7.365    0.000    0.284    0.616
##    .orderW2P2         0.198    0.027    7.267    0.000    0.198    0.686
##    .orderW3S1         0.145    0.029    5.018    0.000    0.145    0.311
##    .orderW3S2         0.156    0.019    8.092    0.000    0.156    0.438
##    .orderW3P1         0.397    0.053    7.466    0.000    0.397    0.671
##    .orderW3P2         0.225    0.030    7.395    0.000    0.225    0.692
##    .orderW4S1         0.173    0.044    3.964    0.000    0.173    0.355
##    .orderW4S2         0.189    0.030    6.281    0.000    0.189    0.491
##    .orderW4P1         0.368    0.050    7.329    0.000    0.368    0.658
##    .orderW4P2         0.224    0.032    7.001    0.000    0.224    0.696
##     order1            0.284    0.047    6.077    0.000    1.000    1.000
##    .order2           -0.000    0.023   -0.005    0.996   -0.000   -0.000
##    .order3           -0.006    0.012   -0.506    0.613   -0.019   -0.019
##    .order4            0.008    0.031    0.267    0.789    0.027    0.027
semPaths(lsmOrder, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Politeness

lsmPolit <- '

# factor at each time point with same loading
polit1 =~ politW1S1        + a * politW1S2 + 
           peer * politW1P1 + aa * politW1P2

polit2 =~ politW2S1        + a * politW2S2 + 
           peer * politW2P1 + aa * politW2P2

polit3 =~ politW3S1        + a * politW3S2 + 
           peer * politW3P1 + aa * politW3P2
  
polit4 =~ politW4S1        + a * politW4S2 + 
           peer * politW4P1 + aa * politW4P2

# structural paths between time points 
polit4 ~ polit3
polit3 ~ polit2
polit2 ~ polit1

# error covariance - similar parcels across waves
politW1S1 ~~ politW2S1 + politW3S1 + politW4S1
politW2S1 ~~ politW3S1 + politW4S1
politW3S1 ~~ politW4S1

politW1S2 ~~ politW2S2 + politW3S2 + politW4S2
politW2S2 ~~ politW3S2 + politW4S2
politW3S2 ~~ politW4S2

politW1P1 ~~ politW2P1 + politW3P1 + politW4P1
politW2P1 ~~ politW3P1 + politW4P1
politW3P1 ~~ politW4P1

politW1P2 ~~ politW2P2 + politW3P2 + politW4P2
politW2P2 ~~ politW3P2 + politW4P2
politW3P2 ~~ politW4P2

# error covariance - same method at one wave
politW1S1 ~~ politW1S2
politW1P1 ~~ politW1P2
politW2S1 ~~ politW2S2
politW2P1 ~~ politW2P2
politW3S1 ~~ politW3S2
politW3P1 ~~ politW3P2
politW4S1 ~~ politW4S2
politW4P1 ~~ politW4P2
'
lsmPolit <- sem(lsmPolit, data = data, missing = "ML")
summary(lsmPolit, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 153 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               148.718
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1979.092
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.962
##   Tucker-Lewis Index (TLI)                       0.941
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1498.565
##   Loglikelihood unrestricted model (H1)      -1424.206
##                                                       
##   Akaike (AIC)                                3145.129
##   Bayesian (BIC)                              3408.334
##   Sample-size adjusted Bayesian (BIC)         3173.728
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.059
##   90 Percent confidence interval - lower         0.045
##   90 Percent confidence interval - upper         0.074
##   P-value RMSEA <= 0.05                          0.143
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.094
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   polit1 =~                                                             
##     pltW1S1           1.000                               0.385    0.593
##     pltW1S2    (a)    0.851    0.097    8.768    0.000    0.328    0.576
##     pltW1P1 (peer)    1.157    0.132    8.736    0.000    0.446    0.711
##     pltW1P2   (aa)    1.330    0.148    8.962    0.000    0.512    0.802
##   polit2 =~                                                             
##     pltW2S1           1.000                               0.381    0.575
##     pltW2S2    (a)    0.851    0.097    8.768    0.000    0.324    0.567
##     pltW2P1 (peer)    1.157    0.132    8.736    0.000    0.440    0.723
##     pltW2P2   (aa)    1.330    0.148    8.962    0.000    0.506    0.792
##   polit3 =~                                                             
##     pltW3S1           1.000                               0.423    0.633
##     pltW3S2    (a)    0.851    0.097    8.768    0.000    0.360    0.592
##     pltW3P1 (peer)    1.157    0.132    8.736    0.000    0.489    0.739
##     pltW3P2   (aa)    1.330    0.148    8.962    0.000    0.562    0.831
##   polit4 =~                                                             
##     pltW4S1           1.000                               0.437    0.699
##     pltW4S2    (a)    0.851    0.097    8.768    0.000    0.372    0.590
##     pltW4P1 (peer)    1.157    0.132    8.736    0.000    0.505    0.813
##     pltW4P2   (aa)    1.330    0.148    8.962    0.000    0.581    0.810
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   polit4 ~                                                              
##     polit3            1.022    0.061   16.729    0.000    0.990    0.990
##   polit3 ~                                                              
##     polit2            1.063    0.071   14.970    0.000    0.957    0.957
##   polit2 ~                                                              
##     polit1            0.934    0.080   11.721    0.000    0.945    0.945
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .politW1S1 ~~                                                          
##    .politW2S1         0.198    0.027    7.416    0.000    0.198    0.698
##    .politW3S1         0.168    0.025    6.647    0.000    0.168    0.622
##    .politW4S1         0.143    0.024    5.985    0.000    0.143    0.610
##  .politW2S1 ~~                                                          
##    .politW3S1         0.205    0.029    6.983    0.000    0.205    0.732
##    .politW4S1         0.153    0.027    5.697    0.000    0.153    0.633
##  .politW3S1 ~~                                                          
##    .politW4S1         0.156    0.028    5.655    0.000    0.156    0.675
##  .politW1S2 ~~                                                          
##    .politW2S2         0.097    0.020    4.797    0.000    0.097    0.442
##    .politW3S2         0.109    0.020    5.350    0.000    0.109    0.480
##    .politW4S2         0.098    0.023    4.258    0.000    0.098    0.413
##  .politW2S2 ~~                                                          
##    .politW3S2         0.136    0.023    5.903    0.000    0.136    0.591
##    .politW4S2         0.138    0.025    5.503    0.000    0.138    0.576
##  .politW3S2 ~~                                                          
##    .politW4S2         0.165    0.028    5.963    0.000    0.165    0.662
##  .politW1P1 ~~                                                          
##    .politW2P1         0.078    0.019    4.102    0.000    0.078    0.418
##    .politW3P1         0.064    0.018    3.480    0.001    0.064    0.325
##    .politW4P1         0.067    0.021    3.210    0.001    0.067    0.418
##  .politW2P1 ~~                                                          
##    .politW3P1         0.051    0.018    2.783    0.005    0.051    0.269
##    .politW4P1         0.063    0.022    2.853    0.004    0.063    0.411
##  .politW3P1 ~~                                                          
##    .politW4P1         0.044    0.020    2.157    0.031    0.044    0.272
##  .politW1P2 ~~                                                          
##    .politW2P2         0.004    0.021    0.214    0.831    0.004    0.030
##    .politW3P2        -0.007    0.018   -0.403    0.687   -0.007   -0.052
##    .politW4P2        -0.015    0.029   -0.513    0.608   -0.015   -0.093
##  .politW2P2 ~~                                                          
##    .politW3P2         0.030    0.020    1.488    0.137    0.030    0.205
##    .politW4P2         0.045    0.025    1.768    0.077    0.045    0.274
##  .politW3P2 ~~                                                          
##    .politW4P2         0.068    0.025    2.775    0.006    0.068    0.431
##  .politW1S1 ~~                                                          
##    .politW1S2         0.041    0.014    3.053    0.002    0.041    0.170
##  .politW1P1 ~~                                                          
##    .politW1P2         0.063    0.023    2.793    0.005    0.063    0.375
##  .politW2S1 ~~                                                          
##    .politW2S2         0.015    0.010    1.481    0.139    0.015    0.060
##  .politW2P1 ~~                                                          
##    .politW2P2         0.031    0.017    1.858    0.063    0.031    0.190
##  .politW3S1 ~~                                                          
##    .politW3S2         0.023    0.010    2.353    0.019    0.023    0.091
##  .politW3P1 ~~                                                          
##    .politW3P2         0.071    0.021    3.398    0.001    0.071    0.422
##  .politW4S1 ~~                                                          
##    .politW4S2         0.000    0.014    0.005    0.996    0.000    0.000
##  .politW4P1 ~~                                                          
##    .politW4P2         0.021    0.024    0.854    0.393    0.021    0.137
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .politW1S1         3.809    0.040   94.241    0.000    3.809    5.860
##    .politW1S2         3.588    0.035  101.262    0.000    3.588    6.299
##    .politW1P1         3.642    0.048   76.434    0.000    3.642    5.814
##    .politW1P2         4.009    0.048   82.736    0.000    4.009    6.275
##    .politW2S1         3.822    0.043   88.068    0.000    3.822    5.774
##    .politW2S2         3.647    0.039   94.454    0.000    3.647    6.383
##    .politW2P1         3.626    0.048   75.990    0.000    3.626    5.951
##    .politW2P2         3.974    0.050   80.002    0.000    3.974    6.220
##    .politW3S1         3.810    0.044   85.893    0.000    3.810    5.703
##    .politW3S2         3.658    0.041   88.948    0.000    3.658    6.018
##    .politW3P1         3.609    0.053   67.517    0.000    3.609    5.450
##    .politW3P2         3.982    0.053   75.567    0.000    3.982    5.883
##    .politW4S1         3.880    0.043   89.437    0.000    3.880    6.213
##    .politW4S2         3.670    0.045   80.973    0.000    3.670    5.825
##    .politW4P1         3.598    0.052   69.446    0.000    3.598    5.792
##    .politW4P2         3.827    0.060   64.087    0.000    3.827    5.337
##     polit1            0.000                               0.000    0.000
##    .polit2            0.000                               0.000    0.000
##    .polit3            0.000                               0.000    0.000
##    .polit4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .politW1S1         0.274    0.029    9.505    0.000    0.274    0.649
##    .politW1S2         0.217    0.024    9.195    0.000    0.217    0.669
##    .politW1P1         0.194    0.030    6.491    0.000    0.194    0.494
##    .politW1P2         0.146    0.031    4.653    0.000    0.146    0.357
##    .politW2S1         0.293    0.034    8.686    0.000    0.293    0.669
##    .politW2S2         0.221    0.026    8.400    0.000    0.221    0.678
##    .politW2P1         0.177    0.026    6.771    0.000    0.177    0.478
##    .politW2P2         0.152    0.029    5.248    0.000    0.152    0.372
##    .politW3S1         0.267    0.033    8.221    0.000    0.267    0.599
##    .politW3S2         0.240    0.028    8.433    0.000    0.240    0.649
##    .politW3P1         0.199    0.031    6.392    0.000    0.199    0.454
##    .politW3P2         0.142    0.028    5.029    0.000    0.142    0.310
##    .politW4S1         0.199    0.030    6.596    0.000    0.199    0.511
##    .politW4S2         0.259    0.035    7.489    0.000    0.259    0.652
##    .politW4P1         0.131    0.030    4.375    0.000    0.131    0.339
##    .politW4P2         0.177    0.043    4.096    0.000    0.177    0.345
##     polit1            0.148    0.030    4.901    0.000    1.000    1.000
##    .polit2            0.015    0.010    1.478    0.140    0.106    0.106
##    .polit3            0.015    0.009    1.701    0.089    0.084    0.084
##    .polit4            0.004    0.013    0.284    0.776    0.020    0.020
semPaths(lsmPolit, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Volatility

lsmVolat <- '

# factor at each time point with same loading
volat1 =~ volatW1S1        + a * volatW1S2 + 
           peer * volatW1P1 + aa * volatW1P2

volat2 =~ volatW2S1        + a * volatW2S2 + 
           peer * volatW2P1 + aa * volatW2P2

volat3 =~ volatW3S1        + a * volatW3S2 + 
           peer * volatW3P1 + aa * volatW3P2
  
volat4 =~ volatW4S1        + a * volatW4S2 + 
           peer * volatW4P1 + aa * volatW4P2

# structural paths between time points 
volat4 ~ volat3
volat3 ~ volat2
volat2 ~ volat1

# error covariance - similar parcels across waves
volatW1S1 ~~ volatW2S1 + volatW3S1 + volatW4S1
volatW2S1 ~~ volatW3S1 + volatW4S1
volatW3S1 ~~ volatW4S1

volatW1S2 ~~ volatW2S2 + volatW3S2 + volatW4S2
volatW2S2 ~~ volatW3S2 + volatW4S2
volatW3S2 ~~ volatW4S2

volatW1P1 ~~ volatW2P1 + volatW3P1 + volatW4P1
volatW2P1 ~~ volatW3P1 + volatW4P1
volatW3P1 ~~ volatW4P1

volatW1P2 ~~ volatW2P2 + volatW3P2 + volatW4P2
volatW2P2 ~~ volatW3P2 + volatW4P2
volatW3P2 ~~ volatW4P2

# error covariance - same method at one wave
volatW1S1 ~~ volatW1S2
volatW1P1 ~~ volatW1P2
volatW2S1 ~~ volatW2S2
volatW2P1 ~~ volatW2P2
volatW3S1 ~~ volatW3S2
volatW3P1 ~~ volatW3P2
volatW4S1 ~~ volatW4S2
volatW4P1 ~~ volatW4P2
'
lsmVolat <- sem(lsmVolat, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmVolat, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 133 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               331.954
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2829.311
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.906
##   Tucker-Lewis Index (TLI)                       0.856
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1820.277
##   Loglikelihood unrestricted model (H1)      -1654.300
##                                                       
##   Akaike (AIC)                                3788.554
##   Bayesian (BIC)                              4051.759
##   Sample-size adjusted Bayesian (BIC)         3817.153
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.112
##   90 Percent confidence interval - lower         0.100
##   90 Percent confidence interval - upper         0.125
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.201
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   volat1 =~                                                             
##     vltW1S1           1.000                               0.641    0.760
##     vltW1S2    (a)    0.894    0.039   22.999    0.000    0.572    0.748
##     vltW1P1 (peer)    0.565    0.054   10.464    0.000    0.362    0.455
##     vltW1P2   (aa)    0.555    0.055   10.163    0.000    0.356    0.450
##   volat2 =~                                                             
##     vltW2S1           1.000                               0.786    0.890
##     vltW2S2    (a)    0.894    0.039   22.999    0.000    0.703    0.899
##     vltW2P1 (peer)    0.565    0.054   10.464    0.000    0.444    0.597
##     vltW2P2   (aa)    0.555    0.055   10.163    0.000    0.436    0.587
##   volat3 =~                                                             
##     vltW3S1           1.000                               0.697    0.894
##     vltW3S2    (a)    0.894    0.039   22.999    0.000    0.623    0.831
##     vltW3P1 (peer)    0.565    0.054   10.464    0.000    0.393    0.461
##     vltW3P2   (aa)    0.555    0.055   10.163    0.000    0.387    0.502
##   volat4 =~                                                             
##     vltW4S1           1.000                               0.568    0.650
##     vltW4S2    (a)    0.894    0.039   22.999    0.000    0.508    0.664
##     vltW4P1 (peer)    0.565    0.054   10.464    0.000    0.321    0.433
##     vltW4P2   (aa)    0.555    0.055   10.163    0.000    0.315    0.433
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   volat4 ~                                                              
##     volat3            0.991    0.057   17.528    0.000    1.216    1.216
##   volat3 ~                                                              
##     volat2            0.871    0.040   21.741    0.000    0.983    0.983
##   volat2 ~                                                              
##     volat1            1.289    0.168    7.687    0.000    1.050    1.050
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .volatW1S1 ~~                                                          
##    .volatW2S1         0.033    0.021    1.541    0.123    0.033    0.148
##    .volatW3S1         0.009    0.018    0.485    0.627    0.009    0.046
##    .volatW4S1         0.045    0.024    1.893    0.058    0.045    0.124
##  .volatW2S1 ~~                                                          
##    .volatW3S1         0.030    0.019    1.626    0.104    0.030    0.217
##    .volatW4S1         0.022    0.024    0.886    0.375    0.022    0.081
##  .volatW3S1 ~~                                                          
##    .volatW4S1         0.026    0.021    1.253    0.210    0.026    0.114
##  .volatW1S2 ~~                                                          
##    .volatW2S2         0.037    0.017    2.216    0.027    0.037    0.213
##    .volatW3S2         0.054    0.016    3.295    0.001    0.054    0.253
##    .volatW4S2         0.023    0.019    1.246    0.213    0.023    0.080
##  .volatW2S2 ~~                                                          
##    .volatW3S2         0.055    0.016    3.432    0.001    0.055    0.388
##    .volatW4S2         0.024    0.017    1.397    0.162    0.024    0.123
##  .volatW3S2 ~~                                                          
##    .volatW4S2         0.040    0.017    2.412    0.016    0.040    0.169
##  .volatW1P1 ~~                                                          
##    .volatW2P1         0.027    0.024    1.112    0.266    0.027    0.063
##    .volatW3P1        -0.036    0.028   -1.292    0.196   -0.036   -0.068
##    .volatW4P1         0.038    0.025    1.500    0.134    0.038    0.081
##  .volatW2P1 ~~                                                          
##    .volatW3P1         0.027    0.027    1.002    0.316    0.027    0.060
##    .volatW4P1         0.050    0.026    1.937    0.053    0.050    0.127
##  .volatW3P1 ~~                                                          
##    .volatW4P1        -0.054    0.032   -1.674    0.094   -0.054   -0.108
##  .volatW1P2 ~~                                                          
##    .volatW2P2         0.052    0.022    2.351    0.019    0.052    0.122
##    .volatW3P2         0.073    0.023    3.158    0.002    0.073    0.155
##    .volatW4P2         0.039    0.026    1.516    0.130    0.039    0.085
##  .volatW2P2 ~~                                                          
##    .volatW3P2         0.018    0.023    0.774    0.439    0.018    0.045
##    .volatW4P2         0.049    0.025    1.952    0.051    0.049    0.124
##  .volatW3P2 ~~                                                          
##    .volatW4P2         0.097    0.024    4.079    0.000    0.097    0.223
##  .volatW1S1 ~~                                                          
##    .volatW1S2         0.145    0.049    2.960    0.003    0.145    0.520
##  .volatW1P1 ~~                                                          
##    .volatW1P2         0.407    0.058    6.991    0.000    0.407    0.814
##  .volatW2S1 ~~                                                          
##    .volatW2S2         0.010    0.016    0.653    0.514    0.010    0.074
##  .volatW2P1 ~~                                                          
##    .volatW2P2         0.251    0.045    5.626    0.000    0.251    0.700
##  .volatW3S1 ~~                                                          
##    .volatW3S2         0.051    0.015    3.291    0.001    0.051    0.348
##  .volatW3P1 ~~                                                          
##    .volatW3P2         0.417    0.066    6.303    0.000    0.417    0.826
##  .volatW4S1 ~~                                                          
##    .volatW4S2         0.258    0.068    3.804    0.000    0.258    0.678
##  .volatW4P1 ~~                                                          
##    .volatW4P2         0.344    0.062    5.538    0.000    0.344    0.786
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S1         2.851    0.052   54.389    0.000    2.851    3.382
##    .volatW1S2         2.708    0.048   56.894    0.000    2.708    3.538
##    .volatW1P1         2.529    0.063   39.861    0.000    2.529    3.181
##    .volatW1P2         2.531    0.063   40.117    0.000    2.531    3.200
##    .volatW2S1         2.863    0.058   49.453    0.000    2.863    3.243
##    .volatW2S2         2.718    0.051   53.253    0.000    2.718    3.479
##    .volatW2P1         2.603    0.060   43.364    0.000    2.603    3.504
##    .volatW2P2         2.575    0.060   42.830    0.000    2.575    3.461
##    .volatW3S1         2.824    0.052   54.789    0.000    2.824    3.623
##    .volatW3S2         2.670    0.050   53.778    0.000    2.670    3.563
##    .volatW3P1         2.638    0.075   35.191    0.000    2.638    3.094
##    .volatW3P2         2.555    0.066   38.650    0.000    2.555    3.314
##    .volatW4S1         2.833    0.062   45.531    0.000    2.833    3.241
##    .volatW4S2         2.719    0.054   49.983    0.000    2.719    3.558
##    .volatW4P1         2.715    0.069   39.355    0.000    2.715    3.670
##    .volatW4P2         2.651    0.067   39.723    0.000    2.651    3.643
##     volat1            0.000                               0.000    0.000
##    .volat2            0.000                               0.000    0.000
##    .volat3            0.000                               0.000    0.000
##    .volat4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .volatW1S1         0.300    0.058    5.211    0.000    0.300    0.423
##    .volatW1S2         0.258    0.048    5.367    0.000    0.258    0.441
##    .volatW1P1         0.501    0.064    7.787    0.000    0.501    0.793
##    .volatW1P2         0.499    0.059    8.391    0.000    0.499    0.798
##    .volatW2S1         0.161    0.031    5.281    0.000    0.161    0.207
##    .volatW2S2         0.117    0.023    5.185    0.000    0.117    0.191
##    .volatW2P1         0.355    0.047    7.517    0.000    0.355    0.643
##    .volatW2P2         0.363    0.047    7.686    0.000    0.363    0.656
##    .volatW3S1         0.122    0.023    5.222    0.000    0.122    0.200
##    .volatW3S2         0.174    0.024    7.206    0.000    0.174    0.309
##    .volatW3P1         0.572    0.085    6.698    0.000    0.572    0.787
##    .volatW3P2         0.445    0.060    7.400    0.000    0.445    0.748
##    .volatW4S1         0.441    0.080    5.487    0.000    0.441    0.578
##    .volatW4S2         0.327    0.063    5.175    0.000    0.327    0.559
##    .volatW4P1         0.444    0.069    6.426    0.000    0.444    0.812
##    .volatW4P2         0.430    0.060    7.130    0.000    0.430    0.812
##     volat1            0.410    0.074    5.547    0.000    1.000    1.000
##    .volat2           -0.064    0.084   -0.761    0.447   -0.103   -0.103
##    .volat3            0.017    0.017    0.977    0.329    0.034    0.034
##    .volat4           -0.154    0.066   -2.332    0.020   -0.479   -0.479
semPaths(lsmVolat, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Withdrawal

lsmWithd <- '

# factor at each time point with same loading
withd1 =~ withdW1S1        + a * withdW1S2 + 
           peer * withdW1P1 + aa * withdW1P2

withd2 =~ withdW2S1        + a * withdW2S2 + 
           peer * withdW2P1 + aa * withdW2P2

withd3 =~ withdW3S1        + a * withdW3S2 + 
           peer * withdW3P1 + aa * withdW3P2
  
withd4 =~ withdW4S1        + a * withdW4S2 + 
           peer * withdW4P1 + aa * withdW4P2

# structural paths between time points 
withd4 ~ withd3
withd3 ~ withd2
withd2 ~ withd1

# error covariance - similar parcels across waves
withdW1S1 ~~ withdW2S1 + withdW3S1 + withdW4S1
withdW2S1 ~~ withdW3S1 + withdW4S1
withdW3S1 ~~ withdW4S1

withdW1S2 ~~ withdW2S2 + withdW3S2 + withdW4S2
withdW2S2 ~~ withdW3S2 + withdW4S2
withdW3S2 ~~ withdW4S2

withdW1P1 ~~ withdW2P1 + withdW3P1 + withdW4P1
withdW2P1 ~~ withdW3P1 + withdW4P1
withdW3P1 ~~ withdW4P1

withdW1P2 ~~ withdW2P2 + withdW3P2 + withdW4P2
withdW2P2 ~~ withdW3P2 + withdW4P2
withdW3P2 ~~ withdW4P2

# error covariance - same method at one wave
withdW1S1 ~~ withdW1S2
withdW1P1 ~~ withdW1P2
withdW2S1 ~~ withdW2S2
withdW2P1 ~~ withdW2P2
withdW3S1 ~~ withdW3S2
withdW3P1 ~~ withdW3P2
withdW4S1 ~~ withdW4S2
withdW4P1 ~~ withdW4P2
'
lsmWithd <- sem(lsmWithd, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmWithd, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 145 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        52
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               308.848
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2333.668
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.896
##   Tucker-Lewis Index (TLI)                       0.840
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1786.107
##   Loglikelihood unrestricted model (H1)      -1631.683
##                                                       
##   Akaike (AIC)                                3720.214
##   Bayesian (BIC)                              3983.420
##   Sample-size adjusted Bayesian (BIC)         3748.813
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.107
##   90 Percent confidence interval - lower         0.095
##   90 Percent confidence interval - upper         0.120
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.165
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   withd1 =~                                                             
##     wthW1S1           1.000                               0.536    0.708
##     wthW1S2    (a)    0.928    0.067   13.860    0.000    0.497    0.687
##     wthW1P1 (peer)    0.712    0.252    2.822    0.005    0.381    0.570
##     wthW1P2   (aa)    0.686    0.246    2.794    0.005    0.367    0.524
##   withd2 =~                                                             
##     wthW2S1           1.000                               0.593    0.772
##     wthW2S2    (a)    0.928    0.067   13.860    0.000    0.550    0.758
##     wthW2P1 (peer)    0.712    0.252    2.822    0.005    0.422    0.626
##     wthW2P2   (aa)    0.686    0.246    2.794    0.005    0.407    0.615
##   withd3 =~                                                             
##     wthW3S1           1.000                               0.544    0.723
##     wthW3S2    (a)    0.928    0.067   13.860    0.000    0.505    0.737
##     wthW3P1 (peer)    0.712    0.252    2.822    0.005    0.388    0.556
##     wthW3P2   (aa)    0.686    0.246    2.794    0.005    0.374    0.566
##   withd4 =~                                                             
##     wthW4S1           1.000                               0.547    0.722
##     wthW4S2    (a)    0.928    0.067   13.860    0.000    0.507    0.753
##     wthW4P1 (peer)    0.712    0.252    2.822    0.005    0.389    0.578
##     wthW4P2   (aa)    0.686    0.246    2.794    0.005    0.375    0.583
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   withd4 ~                                                              
##     withd3            0.976    0.067   14.644    0.000    0.972    0.972
##   withd3 ~                                                              
##     withd2            0.885    0.056   15.946    0.000    0.964    0.964
##   withd2 ~                                                              
##     withd1            1.151    0.131    8.808    0.000    1.040    1.040
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .withdW1S1 ~~                                                          
##    .withdW2S1         0.062    0.039    1.593    0.111    0.062    0.237
##    .withdW3S1         0.073    0.044    1.654    0.098    0.073    0.263
##    .withdW4S1         0.081    0.041    2.001    0.045    0.081    0.290
##  .withdW2S1 ~~                                                          
##    .withdW3S1         0.100    0.059    1.706    0.088    0.100    0.393
##    .withdW4S1         0.080    0.052    1.546    0.122    0.080    0.312
##  .withdW3S1 ~~                                                          
##    .withdW4S1         0.108    0.060    1.788    0.074    0.108    0.397
##  .withdW1S2 ~~                                                          
##    .withdW2S2         0.100    0.038    2.658    0.008    0.100    0.404
##    .withdW3S2         0.111    0.035    3.139    0.002    0.111    0.458
##    .withdW4S2         0.092    0.035    2.627    0.009    0.092    0.393
##  .withdW2S2 ~~                                                          
##    .withdW3S2         0.102    0.038    2.671    0.008    0.102    0.464
##    .withdW4S2         0.095    0.038    2.492    0.013    0.095    0.452
##  .withdW3S2 ~~                                                          
##    .withdW4S2         0.115    0.039    2.943    0.003    0.115    0.560
##  .withdW1P1 ~~                                                          
##    .withdW2P1         0.128    0.089    1.442    0.149    0.128    0.443
##    .withdW3P1         0.168    0.111    1.510    0.131    0.168    0.528
##    .withdW4P1         0.151    0.088    1.716    0.086    0.151    0.499
##  .withdW2P1 ~~                                                          
##    .withdW3P1         0.191    0.100    1.906    0.057    0.191    0.626
##    .withdW4P1         0.171    0.089    1.920    0.055    0.171    0.590
##  .withdW3P1 ~~                                                          
##    .withdW4P1         0.184    0.115    1.602    0.109    0.184    0.577
##  .withdW1P2 ~~                                                          
##    .withdW2P2         0.178    0.085    2.089    0.037    0.178    0.572
##    .withdW3P2         0.197    0.103    1.915    0.056    0.197    0.605
##    .withdW4P2         0.134    0.094    1.428    0.153    0.134    0.429
##  .withdW2P2 ~~                                                          
##    .withdW3P2         0.192    0.095    2.028    0.043    0.192    0.675
##    .withdW4P2         0.110    0.084    1.314    0.189    0.110    0.404
##  .withdW3P2 ~~                                                          
##    .withdW4P2         0.174    0.100    1.741    0.082    0.174    0.611
##  .withdW1S1 ~~                                                          
##    .withdW1S2         0.118    0.038    3.062    0.002    0.118    0.420
##  .withdW1P1 ~~                                                          
##    .withdW1P2         0.099    0.033    2.970    0.003    0.099    0.302
##  .withdW2S1 ~~                                                          
##    .withdW2S2         0.060    0.022    2.745    0.006    0.060    0.259
##  .withdW2P1 ~~                                                          
##    .withdW2P2         0.031    0.019    1.629    0.103    0.031    0.113
##  .withdW3S1 ~~                                                          
##    .withdW3S2         0.041    0.018    2.311    0.021    0.041    0.172
##  .withdW3P1 ~~                                                          
##    .withdW3P2         0.029    0.034    0.855    0.393    0.029    0.092
##  .withdW4S1 ~~                                                          
##    .withdW4S2         0.039    0.032    1.211    0.226    0.039    0.167
##  .withdW4P1 ~~                                                          
##    .withdW4P2         0.097    0.036    2.701    0.007    0.097    0.336
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .withdW1S1         2.970    0.047   63.127    0.000    2.970    3.926
##    .withdW1S2         3.020    0.045   67.177    0.000    3.020    4.177
##    .withdW1P1         2.587    0.052   50.128    0.000    2.587    3.864
##    .withdW1P2         2.484    0.054   45.855    0.000    2.484    3.545
##    .withdW2S1         3.015    0.051   58.761    0.000    3.015    3.926
##    .withdW2S2         3.042    0.048   63.305    0.000    3.042    4.191
##    .withdW2P1         2.602    0.052   49.642    0.000    2.602    3.854
##    .withdW2P2         2.538    0.051   49.318    0.000    2.538    3.835
##    .withdW3S1         2.950    0.051   57.887    0.000    2.950    3.919
##    .withdW3S2         3.041    0.046   66.672    0.000    3.041    4.441
##    .withdW3P1         2.613    0.056   46.731    0.000    2.613    3.749
##    .withdW3P2         2.584    0.052   49.595    0.000    2.584    3.913
##    .withdW4S1         2.942    0.055   53.698    0.000    2.942    3.886
##    .withdW4S2         2.979    0.048   62.547    0.000    2.979    4.419
##    .withdW4P1         2.641    0.058   45.178    0.000    2.641    3.921
##    .withdW4P2         2.595    0.058   44.617    0.000    2.595    4.032
##     withd1            0.000                               0.000    0.000
##    .withd2            0.000                               0.000    0.000
##    .withd3            0.000                               0.000    0.000
##    .withd4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .withdW1S1         0.285    0.060    4.721    0.000    0.285    0.499
##    .withdW1S2         0.276    0.058    4.767    0.000    0.276    0.528
##    .withdW1P1         0.303    0.071    4.277    0.000    0.303    0.676
##    .withdW1P2         0.356    0.080    4.435    0.000    0.356    0.725
##    .withdW2S1         0.238    0.066    3.603    0.000    0.238    0.404
##    .withdW2S2         0.224    0.052    4.350    0.000    0.224    0.426
##    .withdW2P1         0.277    0.088    3.151    0.002    0.277    0.609
##    .withdW2P2         0.272    0.088    3.087    0.002    0.272    0.622
##    .withdW3S1         0.270    0.077    3.516    0.000    0.270    0.477
##    .withdW3S2         0.214    0.046    4.649    0.000    0.214    0.456
##    .withdW3P1         0.336    0.109    3.077    0.002    0.336    0.691
##    .withdW3P2         0.297    0.099    2.991    0.003    0.297    0.680
##    .withdW4S1         0.274    0.075    3.633    0.000    0.274    0.478
##    .withdW4S2         0.197    0.054    3.650    0.000    0.197    0.434
##    .withdW4P1         0.302    0.083    3.658    0.000    0.302    0.666
##    .withdW4P2         0.274    0.073    3.730    0.000    0.274    0.660
##     withd1            0.287    0.083    3.457    0.001    1.000    1.000
##    .withd2           -0.029    0.035   -0.806    0.420   -0.081   -0.081
##    .withd3            0.021    0.016    1.258    0.208    0.070    0.070
##    .withd4            0.017    0.030    0.549    0.583    0.056    0.056
semPaths(lsmWithd, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Confusion

lsmConfu <- '

# factor at each time point with same loading
confu1 =~ confuW1S1        + a * confuW1S2 + 
           peer * confuW1P1 + aa * confuW1P2

confu2 =~ confuW2S1        + a * confuW2S2 + 
           peer * confuW2P1 + aa * confuW2P2

confu3 =~ confuW3S1        + a * confuW3S2 + 
           peer * confuW3P1 + aa * confuW3P2
  
confu4 =~ confuW4S1        + a * confuW4S2 + 
           peer * confuW4P1 + aa * confuW4P2

# structural paths between time points 
confu4 ~ confu3
confu3 ~ confu2
confu2 ~ confu1

# error covariance - similar parcels across waves
confuW1S1 ~~ confuW2S1 + confuW3S1 + confuW4S1
confuW2S1 ~~ confuW3S1 + confuW4S1
confuW3S1 ~~ confuW4S1

confuW1S2 ~~ confuW2S2 + confuW3S2 + confuW4S2
confuW2S2 ~~ confuW3S2 + confuW4S2
confuW3S2 ~~ confuW4S2

confuW1P1 ~~ confuW2P1 + confuW3P1 + confuW4P1
confuW2P1 ~~ confuW3P1 + confuW4P1
confuW3P1 ~~ confuW4P1

confuW1P2 ~~ confuW2P2 + confuW3P2 + confuW4P2
confuW2P2 ~~ confuW3P2 + confuW4P2
confuW3P2 ~~ confuW4P2

# error covariance - same method at one wave
confuW1S1 ~~ confuW1S2
confuW1P1 ~~ confuW1P2
confuW2S1 ~~ confuW2S2
confuW2P1 ~~ confuW2P2
confuW3S1 ~~ confuW3S2
confuW3P1 ~~ confuW3P2
confuW4S1 ~~ confuW4S2
confuW4P1 ~~ confuW4P2
'
lsmConfu <- sem(lsmConfu, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmConfu, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 101 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        55
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               154.307
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1406.278
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.941
##   Tucker-Lewis Index (TLI)                       0.909
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -2220.262
##   Loglikelihood unrestricted model (H1)      -2143.108
##                                                       
##   Akaike (AIC)                                4588.523
##   Bayesian (BIC)                              4851.729
##   Sample-size adjusted Bayesian (BIC)         4617.122
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.061
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.076
##   P-value RMSEA <= 0.05                          0.091
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.107
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   confu1 =~                                                             
##     cnfW1S1           1.000                               0.408    0.526
##     cnfW1S2    (a)    1.093    0.112    9.753    0.000    0.446    0.577
##     cnfW1P1 (peer)    0.975    0.167    5.824    0.000    0.397    0.471
##     cnfW1P2   (aa)    0.756    0.145    5.209    0.000    0.308    0.476
##   confu2 =~                                                             
##     cnfW2S1           1.000                               0.457    0.619
##     cnfW2S2    (a)    1.093    0.112    9.753    0.000    0.500    0.639
##     cnfW2P1 (peer)    0.975    0.167    5.824    0.000    0.446    0.619
##     cnfW2P2   (aa)    0.756    0.145    5.209    0.000    0.346    0.520
##   confu3 =~                                                             
##     cnfW3S1           1.000                               0.507    0.639
##     cnfW3S2    (a)    1.093    0.112    9.753    0.000    0.554    0.654
##     cnfW3P1 (peer)    0.975    0.167    5.824    0.000    0.494    0.676
##     cnfW3P2   (aa)    0.756    0.145    5.209    0.000    0.383    0.560
##   confu4 =~                                                             
##     cnfW4S1           1.000                               0.428    0.571
##     cnfW4S2    (a)    1.093    0.112    9.753    0.000    0.468    0.601
##     cnfW4P1 (peer)    0.975    0.167    5.824    0.000    0.417    0.572
##     cnfW4P2   (aa)    0.756    0.145    5.209    0.000    0.324    0.449
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   confu4 ~                                                              
##     confu3            0.835    0.084    9.972    0.000    0.990    0.990
##   confu3 ~                                                              
##     confu2            1.029    0.092   11.196    0.000    0.928    0.928
##   confu2 ~                                                              
##     confu1            1.283    0.214    5.994    0.000    1.143    1.143
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .confuW1S1 ~~                                                          
##    .confuW2S1         0.087    0.032    2.722    0.006    0.087    0.226
##    .confuW3S1         0.085    0.032    2.675    0.007    0.085    0.212
##    .confuW4S1         0.125    0.034    3.644    0.000    0.125    0.309
##  .confuW2S1 ~~                                                          
##    .confuW3S1         0.101    0.034    2.936    0.003    0.101    0.285
##    .confuW4S1         0.118    0.035    3.421    0.001    0.118    0.331
##  .confuW3S1 ~~                                                          
##    .confuW4S1         0.130    0.036    3.616    0.000    0.130    0.347
##  .confuW1S2 ~~                                                          
##    .confuW2S2         0.081    0.036    2.274    0.023    0.081    0.213
##    .confuW3S2         0.062    0.034    1.832    0.067    0.062    0.154
##    .confuW4S2         0.037    0.037    0.999    0.318    0.037    0.093
##  .confuW2S2 ~~                                                          
##    .confuW3S2         0.156    0.041    3.858    0.000    0.156    0.405
##    .confuW4S2         0.107    0.043    2.497    0.013    0.107    0.285
##  .confuW3S2 ~~                                                          
##    .confuW4S2         0.140    0.045    3.089    0.002    0.140    0.351
##  .confuW1P1 ~~                                                          
##    .confuW2P1         0.187    0.053    3.504    0.000    0.187    0.444
##    .confuW3P1         0.200    0.052    3.852    0.000    0.200    0.499
##    .confuW4P1         0.158    0.060    2.627    0.009    0.158    0.354
##  .confuW2P1 ~~                                                          
##    .confuW3P1         0.140    0.050    2.833    0.005    0.140    0.460
##    .confuW4P1         0.158    0.055    2.876    0.004    0.158    0.466
##  .confuW3P1 ~~                                                          
##    .confuW4P1         0.168    0.054    3.138    0.002    0.168    0.522
##  .confuW1P2 ~~                                                          
##    .confuW2P2         0.157    0.039    3.995    0.000    0.157    0.485
##    .confuW3P2         0.121    0.038    3.168    0.002    0.121    0.375
##    .confuW4P2         0.221    0.047    4.728    0.000    0.221    0.603
##  .confuW2P2 ~~                                                          
##    .confuW3P2         0.191    0.043    4.417    0.000    0.191    0.591
##    .confuW4P2         0.225    0.047    4.754    0.000    0.225    0.615
##  .confuW3P2 ~~                                                          
##    .confuW4P2         0.187    0.048    3.914    0.000    0.187    0.510
##  .confuW1S1 ~~                                                          
##    .confuW1S2         0.155    0.039    3.933    0.000    0.155    0.373
##  .confuW1P1 ~~                                                          
##    .confuW1P2         0.121    0.035    3.477    0.001    0.121    0.286
##  .confuW2S1 ~~                                                          
##    .confuW2S2         0.057    0.026    2.175    0.030    0.057    0.162
##  .confuW2P1 ~~                                                          
##    .confuW2P2         0.032    0.023    1.421    0.155    0.032    0.100
##  .confuW3S1 ~~                                                          
##    .confuW3S2         0.124    0.032    3.832    0.000    0.124    0.318
##  .confuW3P1 ~~                                                          
##    .confuW3P2         0.055    0.027    2.016    0.044    0.055    0.178
##  .confuW4S1 ~~                                                          
##    .confuW4S2         0.095    0.046    2.064    0.039    0.095    0.248
##  .confuW4P1 ~~                                                          
##    .confuW4P2         0.058    0.039    1.501    0.133    0.058    0.151
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .confuW1S1         2.900    0.048   60.229    0.000    2.900    3.742
##    .confuW1S2         2.954    0.048   61.510    0.000    2.954    3.822
##    .confuW1P1         2.489    0.069   36.322    0.000    2.489    2.951
##    .confuW1P2         2.463    0.052   47.096    0.000    2.463    3.801
##    .confuW2S1         2.806    0.051   55.408    0.000    2.806    3.794
##    .confuW2S2         2.871    0.053   53.773    0.000    2.871    3.666
##    .confuW2P1         2.349    0.058   40.330    0.000    2.349    3.259
##    .confuW2P2         2.464    0.054   45.575    0.000    2.464    3.702
##    .confuW3S1         2.737    0.055   49.707    0.000    2.737    3.449
##    .confuW3S2         2.836    0.059   48.346    0.000    2.836    3.346
##    .confuW3P1         2.458    0.060   41.042    0.000    2.458    3.362
##    .confuW3P2         2.536    0.058   43.750    0.000    2.536    3.701
##    .confuW4S1         2.810    0.056   50.130    0.000    2.810    3.749
##    .confuW4S2         2.734    0.059   46.302    0.000    2.734    3.510
##    .confuW4P1         2.493    0.068   36.565    0.000    2.493    3.415
##    .confuW4P2         2.525    0.066   38.220    0.000    2.525    3.500
##     confu1            0.000                               0.000    0.000
##    .confu2            0.000                               0.000    0.000
##    .confu3            0.000                               0.000    0.000
##    .confu4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .confuW1S1         0.434    0.050    8.676    0.000    0.434    0.723
##    .confuW1S2         0.399    0.051    7.867    0.000    0.399    0.667
##    .confuW1P1         0.554    0.074    7.455    0.000    0.554    0.778
##    .confuW1P2         0.325    0.043    7.478    0.000    0.325    0.774
##    .confuW2S1         0.338    0.044    7.617    0.000    0.338    0.617
##    .confuW2S2         0.363    0.051    7.117    0.000    0.363    0.592
##    .confuW2P1         0.321    0.057    5.644    0.000    0.321    0.617
##    .confuW2P2         0.323    0.047    6.914    0.000    0.323    0.730
##    .confuW3S1         0.372    0.052    7.176    0.000    0.372    0.591
##    .confuW3S2         0.411    0.056    7.286    0.000    0.411    0.572
##    .confuW3P1         0.290    0.055    5.315    0.000    0.290    0.543
##    .confuW3P2         0.322    0.050    6.420    0.000    0.322    0.687
##    .confuW4S1         0.378    0.054    7.013    0.000    0.378    0.674
##    .confuW4S2         0.388    0.077    5.054    0.000    0.388    0.639
##    .confuW4P1         0.359    0.068    5.300    0.000    0.359    0.673
##    .confuW4P2         0.416    0.068    6.081    0.000    0.416    0.799
##     confu1            0.166    0.045    3.655    0.000    1.000    1.000
##    .confu2           -0.064    0.042   -1.547    0.122   -0.307   -0.307
##    .confu3            0.036    0.022    1.620    0.105    0.139    0.139
##    .confu4            0.004    0.034    0.113    0.910    0.021    0.021
semPaths(lsmConfu, what = "col", whatLabels = "est", structural = T, layout = "spring")

LSM Coherence

lsmCoher <- '

# factor at each time point with same loading
coher1 =~ coherW1S1        + a * coherW1S2 + 
           peer * coherW1P1 + aa * coherW1P2

coher2 =~ coherW2S1        + a * coherW2S2 + 
           peer * coherW2P1 + aa * coherW2P2

coher3 =~ coherW3S1        + a * coherW3S2 + 
           peer * coherW3P1 + aa * coherW3P2
  
coher4 =~ coherW4S1        + a * coherW4S2 + 
           peer * coherW4P1 + aa * coherW4P2

# structural paths between time points 
coher4 ~ coher3
coher3 ~ coher2
coher2 ~ coher1

# error covariance - similar parcels across waves
coherW1S1 ~~ coherW2S1 + coherW3S1 + coherW4S1
coherW2S1 ~~ coherW3S1 + coherW4S1
coherW3S1 ~~ coherW4S1

coherW1S2 ~~ coherW2S2 + coherW3S2 + coherW4S2
coherW2S2 ~~ coherW3S2 + coherW4S2
coherW3S2 ~~ coherW4S2

coherW1P1 ~~ coherW2P1 + coherW3P1 + coherW4P1
coherW2P1 ~~ coherW3P1 + coherW4P1
coherW3P1 ~~ coherW4P1

coherW1P2 ~~ coherW2P2 + coherW3P2 + coherW4P2
coherW2P2 ~~ coherW3P2 + coherW4P2
coherW3P2 ~~ coherW4P2

# error covariance - same method at one wave
coherW1S1 ~~ coherW1S2
coherW1P1 ~~ coherW1P2
coherW2S1 ~~ coherW2S2
coherW2P1 ~~ coherW2P2
coherW3S1 ~~ coherW3S2
coherW3P1 ~~ coherW3P2
coherW4S1 ~~ coherW4S2
coherW4P1 ~~ coherW4P2
'
lsmCoher <- sem(lsmCoher, data = data, missing = "ML")
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated lv
## variances are negative
summary(lsmCoher, fit.measures = T, standardized = T)
## lavaan 0.6-7 ended normally after 206 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         83
##   Number of equality constraints                     9
##                                                       
##   Number of observations                           259
##   Number of missing patterns                        55
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               172.603
##   Degrees of freedom                                78
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1489.355
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.894
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -1717.654
##   Loglikelihood unrestricted model (H1)      -1631.353
##                                                       
##   Akaike (AIC)                                3583.309
##   Bayesian (BIC)                              3846.514
##   Sample-size adjusted Bayesian (BIC)         3611.907
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.068
##   90 Percent confidence interval - lower         0.055
##   90 Percent confidence interval - upper         0.082
##   P-value RMSEA <= 0.05                          0.015
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.129
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   coher1 =~                                                             
##     chrW1S1           1.000                               0.176    0.263
##     chrW1S2    (a)    0.831    0.196    4.230    0.000    0.146    0.266
##     chrW1P1 (peer)    2.148    0.485    4.425    0.000    0.377    0.551
##     chrW1P2   (aa)    2.424    0.597    4.056    0.000    0.426    0.675
##   coher2 =~                                                             
##     chrW2S1           1.000                               0.220    0.323
##     chrW2S2    (a)    0.831    0.196    4.230    0.000    0.183    0.322
##     chrW2P1 (peer)    2.148    0.485    4.425    0.000    0.474    0.730
##     chrW2P2   (aa)    2.424    0.597    4.056    0.000    0.534    0.840
##   coher3 =~                                                             
##     chrW3S1           1.000                               0.250    0.338
##     chrW3S2    (a)    0.831    0.196    4.230    0.000    0.208    0.359
##     chrW3P1 (peer)    2.148    0.485    4.425    0.000    0.537    0.811
##     chrW3P2   (aa)    2.424    0.597    4.056    0.000    0.606    0.911
##   coher4 =~                                                             
##     chrW4S1           1.000                               0.171    0.265
##     chrW4S2    (a)    0.831    0.196    4.230    0.000    0.143    0.256
##     chrW4P1 (peer)    2.148    0.485    4.425    0.000    0.368    0.609
##     chrW4P2   (aa)    2.424    0.597    4.056    0.000    0.416    0.693
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   coher4 ~                                                              
##     coher3            0.801    0.072   11.187    0.000    1.169    1.169
##   coher3 ~                                                              
##     coher2            1.130    0.119    9.492    0.000    0.996    0.996
##   coher2 ~                                                              
##     coher1            1.219    0.329    3.706    0.000    0.972    0.972
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .coherW1S1 ~~                                                          
##    .coherW2S1         0.212    0.034    6.309    0.000    0.212    0.508
##    .coherW3S1         0.181    0.036    5.081    0.000    0.181    0.402
##    .coherW4S1         0.166    0.033    4.963    0.000    0.166    0.413
##  .coherW2S1 ~~                                                          
##    .coherW3S1         0.226    0.038    5.960    0.000    0.226    0.502
##    .coherW4S1         0.195    0.035    5.572    0.000    0.195    0.485
##  .coherW3S1 ~~                                                          
##    .coherW4S1         0.219    0.039    5.581    0.000    0.219    0.504
##  .coherW1S2 ~~                                                          
##    .coherW2S2         0.160    0.024    6.703    0.000    0.160    0.560
##    .coherW3S2         0.156    0.024    6.604    0.000    0.156    0.543
##    .coherW4S2         0.143    0.025    5.707    0.000    0.143    0.501
##  .coherW2S2 ~~                                                          
##    .coherW3S2         0.155    0.026    6.071    0.000    0.155    0.531
##    .coherW4S2         0.155    0.026    5.985    0.000    0.155    0.533
##  .coherW3S2 ~~                                                          
##    .coherW4S2         0.167    0.028    6.031    0.000    0.167    0.576
##  .coherW1P1 ~~                                                          
##    .coherW2P1         0.073    0.025    2.928    0.003    0.073    0.287
##    .coherW3P1         0.053    0.027    1.966    0.049    0.053    0.241
##    .coherW4P1         0.090    0.027    3.352    0.001    0.090    0.327
##  .coherW2P1 ~~                                                          
##    .coherW3P1         0.067    0.025    2.710    0.007    0.067    0.391
##    .coherW4P1         0.081    0.024    3.322    0.001    0.081    0.382
##  .coherW3P1 ~~                                                          
##    .coherW4P1         0.071    0.026    2.776    0.006    0.071    0.381
##  .coherW1P2 ~~                                                          
##    .coherW2P2        -0.001    0.025   -0.023    0.981   -0.001   -0.004
##    .coherW3P2         0.007    0.027    0.267    0.790    0.007    0.057
##    .coherW4P2         0.023    0.028    0.822    0.411    0.023    0.113
##  .coherW2P2 ~~                                                          
##    .coherW3P2        -0.004    0.030   -0.145    0.885   -0.004   -0.045
##    .coherW4P2        -0.011    0.029   -0.387    0.699   -0.011   -0.074
##  .coherW3P2 ~~                                                          
##    .coherW4P2         0.011    0.032    0.363    0.716    0.011    0.097
##  .coherW1S1 ~~                                                          
##    .coherW1S2         0.048    0.018    2.733    0.006    0.048    0.142
##  .coherW1P1 ~~                                                          
##    .coherW1P2         0.157    0.049    3.177    0.001    0.157    0.589
##  .coherW2S1 ~~                                                          
##    .coherW2S2         0.057    0.017    3.363    0.001    0.057    0.165
##  .coherW2P1 ~~                                                          
##    .coherW2P2         0.075    0.027    2.757    0.006    0.075    0.491
##  .coherW3S1 ~~                                                          
##    .coherW3S2         0.067    0.019    3.517    0.000    0.067    0.179
##  .coherW3P1 ~~                                                          
##    .coherW3P2         0.022    0.024    0.897    0.370    0.022    0.205
##  .coherW4S1 ~~                                                          
##    .coherW4S2         0.067    0.021    3.205    0.001    0.067    0.199
##  .coherW4P1 ~~                                                          
##    .coherW4P2         0.108    0.054    1.988    0.047    0.108    0.523
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .coherW1S1         3.467    0.042   83.407    0.000    3.467    5.183
##    .coherW1S2         3.940    0.034  115.366    0.000    3.940    7.168
##    .coherW1P1         4.029    0.058   69.705    0.000    4.029    5.879
##    .coherW1P2         3.982    0.053   75.481    0.000    3.982    6.314
##    .coherW2S1         3.513    0.047   75.235    0.000    3.513    5.149
##    .coherW2S2         3.933    0.039  101.445    0.000    3.933    6.900
##    .coherW2P1         4.022    0.053   75.518    0.000    4.022    6.198
##    .coherW2P2         4.004    0.052   76.773    0.000    4.004    6.295
##    .coherW3S1         3.504    0.052   67.753    0.000    3.504    4.737
##    .coherW3S2         3.965    0.040   99.673    0.000    3.965    6.848
##    .coherW3P1         3.956    0.055   71.591    0.000    3.956    5.970
##    .coherW3P2         3.946    0.055   72.079    0.000    3.946    5.931
##    .coherW4S1         3.518    0.049   72.067    0.000    3.518    5.448
##    .coherW4S2         4.024    0.041   97.520    0.000    4.024    7.243
##    .coherW4P1         3.932    0.054   72.396    0.000    3.932    6.509
##    .coherW4P2         3.924    0.054   72.176    0.000    3.924    6.545
##     coher1            0.000                               0.000    0.000
##    .coher2            0.000                               0.000    0.000
##    .coher3            0.000                               0.000    0.000
##    .coher4            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .coherW1S1         0.417    0.038   10.840    0.000    0.417    0.931
##    .coherW1S2         0.281    0.026   10.765    0.000    0.281    0.929
##    .coherW1P1         0.327    0.060    5.436    0.000    0.327    0.697
##    .coherW1P2         0.216    0.055    3.942    0.000    0.216    0.544
##    .coherW2S1         0.417    0.042    9.896    0.000    0.417    0.896
##    .coherW2S2         0.291    0.030    9.742    0.000    0.291    0.897
##    .coherW2P1         0.197    0.035    5.648    0.000    0.197    0.468
##    .coherW2P2         0.119    0.043    2.780    0.005    0.119    0.294
##    .coherW3S1         0.485    0.051    9.559    0.000    0.485    0.886
##    .coherW3S2         0.292    0.031    9.565    0.000    0.292    0.871
##    .coherW3P1         0.150    0.035    4.333    0.000    0.150    0.343
##    .coherW3P2         0.075    0.043    1.730    0.084    0.075    0.169
##    .coherW4S1         0.388    0.044    8.791    0.000    0.388    0.930
##    .coherW4S2         0.288    0.033    8.797    0.000    0.288    0.934
##    .coherW4P1         0.229    0.053    4.296    0.000    0.229    0.629
##    .coherW4P2         0.187    0.069    2.714    0.007    0.187    0.520
##     coher1            0.031    0.017    1.783    0.075    1.000    1.000
##    .coher2            0.003    0.012    0.230    0.818    0.056    0.056
##    .coher3            0.000    0.005    0.091    0.927    0.008    0.008
##    .coher4           -0.011    0.010   -1.059    0.290   -0.366   -0.366
semPaths(lsmCoher, what = "col", whatLabels = "est", structural = T, layout = "spring")