#read in data

setwd("~/Downloads/foldah")

ANES <- read.csv("ANES_clean_merged2.csv")

ANES_clean <- subset(ANES, !is.na(V240106b))


ANES_clean$Race3 <- with(ANES_clean,
  ifelse(White == 1, "White",
  ifelse(Black == 1, "Black",
  ifelse(Hispanic == 1, "Hispanic",
         NA
  ))))


ANES_clean$Race3 <- factor(ANES_clean$Race3,
                  levels = c("White", "Black", "Hispanic"))


ANES_cleanest <- subset(ANES_clean, !is.na(Race3))

library(lavaan)
## This is lavaan 0.6-19
## lavaan is FREE software! Please report any bugs.
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

#RICLPM IPE + CA, MLR

RICLPM1 <- '
  # Create between components (random intercepts)
  RIipe =~ 1*in_eff_w1 + 1*in_eff_w2 + 1*in_eff_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wipe1 =~ 1*in_eff_w1
  wipe2 =~ 1*in_eff_w2
  wipe3 =~ 1*in_eff_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wipe2 + wca2 ~ wipe1 + wca1
  wipe3 + wca3 ~ wipe2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wipe1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wipe2 ~~ wca2
  wipe3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIipe ~~ RIipe
  RIca ~~ RIca
  RIipe ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wipe1 ~~ wipe1 # Variances
  wca1 ~~ wca1 
  wipe2 ~~ wipe2 # Residual variances
  wca2 ~~ wca2 
  wipe3 ~~ wipe3 
  wca3 ~~ wca3'

RICLPM1fit <- lavaan(RICLPM1, 
  data = ANES_clean, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "MLR",
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM1fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 73 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        26
## 
##   Number of observations                          2070
##   Number of missing patterns                        12
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 0.486       0.313
##   Degrees of freedom                                 1           1
##   P-value (Chi-square)                           0.486       0.576
##   Scaling correction factor                                  1.553
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2871.247    1379.513
##   Degrees of freedom                                15          15
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.081
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       1.000
##   Tucker-Lewis Index (TLI)                       1.003       1.008
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            1.006
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -5534.689   -5534.689
##   Scaling correction factor                                  2.265
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -5534.446   -5534.446
##   Scaling correction factor                                  2.239
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               11121.378   11121.378
##   Bayesian (BIC)                             11267.895   11267.895
##   Sample-size adjusted Bayesian (SABIC)      11185.291   11185.291
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000       0.000
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.051       0.036
##   P-value H_0: RMSEA <= 0.050                    0.944       0.991
##   P-value H_0: RMSEA >= 0.080                    0.002       0.000
##                                                                   
##   Robust RMSEA                                               0.000
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.060
##   P-value H_0: Robust RMSEA <= 0.050                         0.905
##   P-value H_0: Robust RMSEA >= 0.080                         0.009
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.003       0.003
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIipe =~                                                              
##     in_eff_w1         1.000                               0.548    0.693
##     in_eff_w2         1.000                               0.548    0.645
##     in_eff_w3         1.000                               0.548    0.659
##   RIca =~                                                               
##     c_act_w1          1.000                               0.112    0.447
##     c_act_w2          1.000                               0.112    0.469
##     c_act_w3          1.000                               0.112    0.627
##   wipe1 =~                                                              
##     in_eff_w1         1.000                               0.571    0.721
##   wipe2 =~                                                              
##     in_eff_w2         1.000                               0.650    0.764
##   wipe3 =~                                                              
##     in_eff_w3         1.000                               0.626    0.752
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.224    0.894
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.211    0.883
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.139    0.779
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe2 ~                                                               
##     wipe1             0.146    0.073    1.987    0.047    0.128    0.128
##     wca1              0.403    0.122    3.308    0.001    0.139    0.139
##   wca2 ~                                                                
##     wipe1             0.046    0.015    3.061    0.002    0.126    0.126
##     wca1              0.251    0.041    6.056    0.000    0.266    0.266
##   wipe3 ~                                                               
##     wipe2             0.325    0.048    6.769    0.000    0.338    0.338
##     wca2              0.358    0.115    3.120    0.002    0.121    0.121
##   wca3 ~                                                                
##     wipe2             0.013    0.010    1.407    0.159    0.063    0.063
##     wca2              0.029    0.048    0.603    0.546    0.044    0.044
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe1 ~~                                                              
##     wca1              0.030    0.006    4.804    0.000    0.233    0.233
##  .wipe2 ~~                                                              
##    .wca2              0.018    0.005    3.690    0.000    0.142    0.142
##  .wipe3 ~~                                                              
##    .wca3              0.011    0.004    2.628    0.009    0.134    0.134
##   RIipe ~~                                                              
##     RIca              0.017    0.005    3.795    0.000    0.283    0.283
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .in_eff_w1         3.142    0.024  132.679    0.000    3.142    3.970
##    .in_eff_w2         3.259    0.026  124.842    0.000    3.259    3.831
##    .in_eff_w3         3.263    0.025  128.357    0.000    3.263    3.920
##    .c_act_w1          0.192    0.007   26.905    0.000    0.192    0.768
##    .c_act_w2          0.159    0.007   23.009    0.000    0.159    0.665
##    .c_act_w3          0.078    0.005   14.840    0.000    0.078    0.437
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIipe             0.301    0.029   10.369    0.000    1.000    1.000
##     RIca              0.013    0.002    5.759    0.000    1.000    1.000
##     wipe1             0.326    0.028   11.598    0.000    1.000    1.000
##     wca1              0.050    0.003   17.213    0.000    1.000    1.000
##    .wipe2             0.405    0.032   12.649    0.000    0.956    0.956
##    .wca2              0.040    0.003   15.625    0.000    0.898    0.898
##    .wipe3             0.335    0.019   17.451    0.000    0.855    0.855
##    .wca3              0.019    0.003    6.048    0.000    0.993    0.993
##    .in_eff_w1         0.000                               0.000    0.000
##    .in_eff_w2         0.000                               0.000    0.000
##    .in_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wipe2             0.044
##     wca2              0.102
##     wipe3             0.145
##     wca3              0.007
##     in_eff_w1         1.000
##     in_eff_w2         1.000
##     in_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM IPE + CA, MLR, Multi-Group by Race

RICLPM2 <- '
  # Create between components (random intercepts)
  RIipe =~ 1*in_eff_w1 + 1*in_eff_w2 + 1*in_eff_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wipe1 =~ 1*in_eff_w1
  wipe2 =~ 1*in_eff_w2
  wipe3 =~ 1*in_eff_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wipe2 + wca2 ~ wipe1 + wca1
  wipe3 + wca3 ~ wipe2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wipe1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wipe2 ~~ wca2
  wipe3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIipe ~~ RIipe
  RIca ~~ RIca
  RIipe ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wipe1 ~~ wipe1 # Variances
  wca1 ~~ wca1 
  wipe2 ~~ wipe2 # Residual variances
  wca2 ~~ wca2 
  wipe3 ~~ wipe3 
  wca3 ~~ wca3'

RICLPM2fit <- lavaan(RICLPM2, 
  data = ANES_cleanest, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "ML",
  group = 'Race3',
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM2fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 179 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        78
## 
##   Number of observations per group:                   
##     White                                         1537
##     Black                                          161
##     Hispanic                                       184
##   Number of missing patterns per group:               
##     White                                           11
##     Black                                            2
##     Hispanic                                         5
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 4.450       2.442
##   Degrees of freedom                                 3           3
##   P-value (Chi-square)                           0.217       0.486
##   Scaling correction factor                                  1.822
##     Yuan-Bentler correction (Mplus variant)                       
##   Test statistic for each group:
##     White                                        0.151       0.151
##     Black                                        0.143       0.143
##     Hispanic                                     2.148       2.148
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2645.972    1198.768
##   Degrees of freedom                                45          45
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.207
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.999       1.000
##   Tucker-Lewis Index (TLI)                       0.992       1.007
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            1.006
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4899.561   -4899.561
##   Scaling correction factor                                  2.671
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -4897.336   -4897.336
##   Scaling correction factor                                  2.640
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                                9955.122    9955.122
##   Bayesian (BIC)                             10387.249   10387.249
##   Sample-size adjusted Bayesian (SABIC)      10139.444   10139.444
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.028       0.000
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.078       0.048
##   P-value H_0: RMSEA <= 0.050                    0.707       0.959
##   P-value H_0: RMSEA >= 0.080                    0.041       0.001
##                                                                   
##   Robust RMSEA                                               0.000
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.084
##   P-value H_0: Robust RMSEA <= 0.050                         0.765
##   P-value H_0: Robust RMSEA >= 0.080                         0.064
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.006       0.006
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIipe =~                                                              
##     in_eff_w1         1.000                               0.567    0.715
##     in_eff_w2         1.000                               0.567    0.663
##     in_eff_w3         1.000                               0.567    0.683
##   RIca =~                                                               
##     c_act_w1          1.000                               0.115    0.459
##     c_act_w2          1.000                               0.115    0.481
##     c_act_w3          1.000                               0.115    0.656
##   wipe1 =~                                                              
##     in_eff_w1         1.000                               0.554    0.699
##   wipe2 =~                                                              
##     in_eff_w2         1.000                               0.641    0.749
##   wipe3 =~                                                              
##     in_eff_w3         1.000                               0.607    0.730
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.222    0.888
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.209    0.877
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.132    0.755
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe2 ~                                                               
##     wipe1             0.185    0.084    2.205    0.027    0.160    0.160
##     wca1              0.405    0.134    3.023    0.003    0.140    0.140
##   wca2 ~                                                                
##     wipe1             0.063    0.019    3.414    0.001    0.168    0.168
##     wca1              0.277    0.048    5.794    0.000    0.293    0.293
##   wipe3 ~                                                               
##     wipe2             0.332    0.058    5.762    0.000    0.351    0.351
##     wca2              0.269    0.140    1.919    0.055    0.093    0.093
##   wca3 ~                                                                
##     wipe2             0.016    0.010    1.578    0.115    0.079    0.079
##     wca2              0.035    0.052    0.676    0.499    0.056    0.056
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe1 ~~                                                              
##     wca1              0.026    0.007    3.529    0.000    0.211    0.211
##  .wipe2 ~~                                                              
##    .wca2              0.014    0.006    2.433    0.015    0.119    0.119
##  .wipe3 ~~                                                              
##    .wca3              0.006    0.003    1.695    0.090    0.078    0.078
##   RIipe ~~                                                              
##     RIca              0.024    0.005    4.607    0.000    0.367    0.367
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .in_eff_w1         3.134    0.027  114.768    0.000    3.134    3.951
##    .in_eff_w2         3.260    0.030  106.909    0.000    3.260    3.808
##    .in_eff_w3         3.253    0.029  112.050    0.000    3.253    3.916
##    .c_act_w1          0.187    0.008   22.785    0.000    0.187    0.750
##    .c_act_w2          0.158    0.008   19.992    0.000    0.158    0.665
##    .c_act_w3          0.077    0.006   14.005    0.000    0.077    0.442
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIipe             0.322    0.033    9.696    0.000    1.000    1.000
##     RIca              0.013    0.003    4.966    0.000    1.000    1.000
##     wipe1             0.307    0.032    9.723    0.000    1.000    1.000
##     wca1              0.049    0.004   13.052    0.000    1.000    1.000
##    .wipe2             0.389    0.035   11.178    0.000    0.945    0.945
##    .wca2              0.038    0.003   14.260    0.000    0.865    0.865
##    .wipe3             0.315    0.021   14.964    0.000    0.856    0.856
##    .wca3              0.017    0.002    7.521    0.000    0.989    0.989
##    .in_eff_w1         0.000                               0.000    0.000
##    .in_eff_w2         0.000                               0.000    0.000
##    .in_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wipe2             0.055
##     wca2              0.135
##     wipe3             0.144
##     wca3              0.011
##     in_eff_w1         1.000
##     in_eff_w2         1.000
##     in_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 2 [Black]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIipe =~                                                              
##     in_eff_w1         1.000                               0.435    0.542
##     in_eff_w2         1.000                               0.435    0.539
##     in_eff_w3         1.000                               0.435    0.538
##   RIca =~                                                               
##     c_act_w1          1.000                               0.115    0.450
##     c_act_w2          1.000                               0.115    0.495
##     c_act_w3          1.000                               0.115    0.672
##   wipe1 =~                                                              
##     in_eff_w1         1.000                               0.675    0.841
##   wipe2 =~                                                              
##     in_eff_w2         1.000                               0.679    0.842
##   wipe3 =~                                                              
##     in_eff_w3         1.000                               0.680    0.843
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.228    0.893
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.202    0.869
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.127    0.741
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe2 ~                                                               
##     wipe1             0.039    0.226    0.173    0.863    0.039    0.039
##     wca1              0.387    0.395    0.979    0.327    0.130    0.130
##   wca2 ~                                                                
##     wipe1             0.006    0.029    0.221    0.825    0.021    0.021
##     wca1              0.061    0.102    0.600    0.549    0.069    0.069
##   wipe3 ~                                                               
##     wipe2             0.334    0.170    1.968    0.049    0.334    0.334
##     wca2              0.788    0.360    2.191    0.028    0.234    0.234
##   wca3 ~                                                                
##     wipe2            -0.024    0.039   -0.609    0.542   -0.128   -0.128
##     wca2             -0.256    0.147   -1.741    0.082   -0.407   -0.407
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe1 ~~                                                              
##     wca1              0.022    0.017    1.330    0.183    0.143    0.143
##  .wipe2 ~~                                                              
##    .wca2             -0.009    0.017   -0.513    0.608   -0.066   -0.066
##  .wipe3 ~~                                                              
##    .wca3              0.030    0.015    1.960    0.050    0.413    0.413
##   RIipe ~~                                                              
##     RIca              0.005    0.010    0.481    0.631    0.094    0.094
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .in_eff_w1         3.196    0.083   38.687    0.000    3.196    3.982
##    .in_eff_w2         3.425    0.084   40.752    0.000    3.425    4.249
##    .in_eff_w3         3.456    0.083   41.653    0.000    3.456    4.280
##    .c_act_w1          0.220    0.025    8.740    0.000    0.220    0.859
##    .c_act_w2          0.158    0.023    6.835    0.000    0.158    0.679
##    .c_act_w3          0.082    0.020    4.013    0.000    0.082    0.479
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIipe             0.189    0.095    1.986    0.047    1.000    1.000
##     RIca              0.013    0.006    2.151    0.031    1.000    1.000
##     wipe1             0.455    0.097    4.673    0.000    1.000    1.000
##     wca1              0.052    0.008    6.816    0.000    1.000    1.000
##    .wipe2             0.452    0.120    3.776    0.000    0.980    0.980
##    .wca2              0.040    0.011    3.782    0.000    0.994    0.994
##    .wipe3             0.390    0.068    5.771    0.000    0.843    0.843
##    .wca3              0.013    0.011    1.229    0.219    0.824    0.824
##    .in_eff_w1         0.000                               0.000    0.000
##    .in_eff_w2         0.000                               0.000    0.000
##    .in_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wipe2             0.020
##     wca2              0.006
##     wipe3             0.157
##     wca3              0.176
##     in_eff_w1         1.000
##     in_eff_w2         1.000
##     in_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 3 [Hispanic]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIipe =~                                                              
##     in_eff_w1         1.000                               0.426    0.572
##     in_eff_w2         1.000                               0.426    0.507
##     in_eff_w3         1.000                               0.426    0.536
##   RIca =~                                                               
##     c_act_w1          1.000                               0.084    0.354
##     c_act_w2          1.000                               0.084    0.372
##     c_act_w3          1.000                               0.084    0.475
##   wipe1 =~                                                              
##     in_eff_w1         1.000                               0.610    0.820
##   wipe2 =~                                                              
##     in_eff_w2         1.000                               0.724    0.862
##   wipe3 =~                                                              
##     in_eff_w3         1.000                               0.671    0.844
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.222    0.935
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.210    0.928
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.156    0.880
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe2 ~                                                               
##     wipe1             0.322    0.187    1.726    0.084    0.272    0.272
##     wca1              0.039    0.410    0.096    0.924    0.012    0.012
##   wca2 ~                                                                
##     wipe1             0.029    0.040    0.737    0.461    0.085    0.085
##     wca1              0.216    0.118    1.835    0.067    0.229    0.229
##   wipe3 ~                                                               
##     wipe2             0.378    0.125    3.022    0.003    0.408    0.408
##     wca2              0.321    0.318    1.011    0.312    0.101    0.101
##   wca3 ~                                                                
##     wipe2             0.056    0.027    2.090    0.037    0.259    0.259
##     wca2             -0.057    0.116   -0.487    0.626   -0.076   -0.076
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wipe1 ~~                                                              
##     wca1              0.037    0.021    1.786    0.074    0.275    0.275
##  .wipe2 ~~                                                              
##    .wca2              0.050    0.013    3.793    0.000    0.356    0.356
##  .wipe3 ~~                                                              
##    .wca3              0.019    0.019    0.965    0.335    0.207    0.207
##   RIipe ~~                                                              
##     RIca             -0.007    0.014   -0.468    0.639   -0.184   -0.184
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .in_eff_w1         3.051    0.075   40.876    0.000    3.051    4.101
##    .in_eff_w2         3.027    0.084   36.104    0.000    3.027    3.605
##    .in_eff_w3         3.089    0.081   38.113    0.000    3.089    3.889
##    .c_act_w1          0.172    0.022    7.976    0.000    0.172    0.722
##    .c_act_w2          0.147    0.021    7.045    0.000    0.147    0.649
##    .c_act_w3          0.074    0.019    3.978    0.000    0.074    0.419
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIipe             0.181    0.111    1.628    0.104    1.000    1.000
##     RIca              0.007    0.005    1.454    0.146    1.000    1.000
##     wipe1             0.372    0.110    3.370    0.001    1.000    1.000
##     wca1              0.049    0.008    6.137    0.000    1.000    1.000
##    .wipe2             0.484    0.101    4.782    0.000    0.924    0.924
##    .wca2              0.041    0.008    5.133    0.000    0.930    0.930
##    .wipe3             0.357    0.053    6.711    0.000    0.793    0.793
##    .wca3              0.023    0.016    1.446    0.148    0.942    0.942
##    .in_eff_w1         0.000                               0.000    0.000
##    .in_eff_w2         0.000                               0.000    0.000
##    .in_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wipe2             0.076
##     wca2              0.070
##     wipe3             0.207
##     wca3              0.058
##     in_eff_w1         1.000
##     in_eff_w2         1.000
##     in_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM EPE + CA, MLR

RICLPM3 <- '
  # Create between components (random intercepts)
  RIepe =~ 1*ex_eff_w1 + 1*ex_eff_w2 + 1*ex_eff_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wepe1 =~ 1*ex_eff_w1
  wepe2 =~ 1*ex_eff_w2
  wepe3 =~ 1*ex_eff_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wepe2 + wca2 ~ wepe1 + wca1
  wepe3 + wca3 ~ wepe2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wepe1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wepe2 ~~ wca2
  wepe3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIepe ~~ RIepe
  RIca ~~ RIca
  RIepe ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wepe1 ~~ wepe1 # Variances
  wca1 ~~ wca1 
  wepe2 ~~ wepe2 # Residual variances
  wca2 ~~ wca2 
  wepe3 ~~ wepe3 
  wca3 ~~ wca3'

RICLPM3fit <- lavaan(RICLPM3, 
  data = ANES_clean, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "MLR",
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM3fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 70 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        26
## 
##   Number of observations                          2070
##   Number of missing patterns                        10
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 3.828       2.383
##   Degrees of freedom                                 1           1
##   P-value (Chi-square)                           0.050       0.123
##   Scaling correction factor                                  1.607
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1574.648     726.545
##   Degrees of freedom                                15          15
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.167
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.998       0.998
##   Tucker-Lewis Index (TLI)                       0.973       0.971
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.999
##   Robust Tucker-Lewis Index (TLI)                            0.980
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7305.490   -7305.490
##   Scaling correction factor                                  2.243
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -7303.576   -7303.576
##   Scaling correction factor                                  2.220
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               14662.981   14662.981
##   Bayesian (BIC)                             14809.499   14809.499
##   Sample-size adjusted Bayesian (SABIC)      14726.895   14726.895
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.037       0.026
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.079       0.060
##   P-value H_0: RMSEA <= 0.050                    0.625       0.855
##   P-value H_0: RMSEA >= 0.080                    0.046       0.003
##                                                                   
##   Robust RMSEA                                               0.032
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.091
##   P-value H_0: Robust RMSEA <= 0.050                         0.594
##   P-value H_0: Robust RMSEA >= 0.080                         0.102
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.008       0.008
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIepe =~                                                              
##     ex_eff_w1         1.000                               0.543    0.545
##     ex_eff_w2         1.000                               0.543    0.535
##     ex_eff_w3         1.000                               0.543    0.571
##   RIca =~                                                               
##     c_act_w1          1.000                               0.113    0.451
##     c_act_w2          1.000                               0.113    0.474
##     c_act_w3          1.000                               0.113    0.635
##   wepe1 =~                                                              
##     ex_eff_w1         1.000                               0.835    0.838
##   wepe2 =~                                                              
##     ex_eff_w2         1.000                               0.858    0.845
##   wepe3 =~                                                              
##     ex_eff_w3         1.000                               0.781    0.821
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.223    0.892
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.210    0.881
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.137    0.772
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe2 ~                                                               
##     wepe1             0.053    0.049    1.089    0.276    0.052    0.052
##     wca1              0.087    0.158    0.554    0.579    0.023    0.023
##   wca2 ~                                                                
##     wepe1            -0.016    0.010   -1.584    0.113   -0.063   -0.063
##     wca1              0.280    0.042    6.602    0.000    0.297    0.297
##   wepe3 ~                                                               
##     wepe2             0.164    0.046    3.588    0.000    0.181    0.181
##     wca2             -0.244    0.170   -1.430    0.153   -0.066   -0.066
##   wca3 ~                                                                
##     wepe2             0.007    0.008    0.980    0.327    0.047    0.047
##     wca2              0.027    0.049    0.563    0.573    0.042    0.042
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe1 ~~                                                              
##     wca1              0.013    0.008    1.572    0.116    0.068    0.068
##  .wepe2 ~~                                                              
##    .wca2              0.013    0.007    1.835    0.067    0.076    0.076
##  .wepe3 ~~                                                              
##    .wca3             -0.011    0.005   -2.086    0.037   -0.103   -0.103
##   RIepe ~~                                                              
##     RIca              0.015    0.006    2.508    0.012    0.244    0.244
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ex_eff_w1         2.563    0.030   86.501    0.000    2.563    2.572
##    .ex_eff_w2         2.363    0.030   79.307    0.000    2.363    2.328
##    .ex_eff_w3         2.208    0.028   79.045    0.000    2.208    2.322
##    .c_act_w1          0.192    0.007   26.917    0.000    0.192    0.766
##    .c_act_w2          0.159    0.007   23.008    0.000    0.159    0.665
##    .c_act_w3          0.078    0.005   14.844    0.000    0.078    0.438
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIepe             0.295    0.033    8.908    0.000    1.000    1.000
##     RIca              0.013    0.002    6.064    0.000    1.000    1.000
##     wepe1             0.698    0.040   17.350    0.000    1.000    1.000
##     wca1              0.050    0.003   17.343    0.000    1.000    1.000
##    .wepe2             0.733    0.045   16.121    0.000    0.997    0.997
##    .wca2              0.040    0.003   15.284    0.000    0.910    0.910
##    .wepe3             0.588    0.036   16.375    0.000    0.965    0.965
##    .wca3              0.019    0.003    6.057    0.000    0.996    0.996
##    .ex_eff_w1         0.000                               0.000    0.000
##    .ex_eff_w2         0.000                               0.000    0.000
##    .ex_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wepe2             0.003
##     wca2              0.090
##     wepe3             0.035
##     wca3              0.004
##     ex_eff_w1         1.000
##     ex_eff_w2         1.000
##     ex_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM EPE + CA, MLR, Multi-Group by Race

RICLPM4 <- '
  # Create between components (random intercepts)
  RIepe =~ 1*ex_eff_w1 + 1*ex_eff_w2 + 1*ex_eff_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wepe1 =~ 1*ex_eff_w1
  wepe2 =~ 1*ex_eff_w2
  wepe3 =~ 1*ex_eff_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wepe2 + wca2 ~ wepe1 + wca1
  wepe3 + wca3 ~ wepe2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wepe1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wepe2 ~~ wca2
  wepe3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIepe ~~ RIepe
  RIca ~~ RIca
  RIepe ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wepe1 ~~ wepe1 # Variances
  wca1 ~~ wca1 
  wepe2 ~~ wepe2 # Residual variances
  wca2 ~~ wca2 
  wepe3 ~~ wepe3 
  wca3 ~~ wca3'

RICLPM4fit <- lavaan(RICLPM4, 
  data = ANES_cleanest, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  group = 'Race3',
  estimator = "MLR",
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM4fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 183 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        78
## 
##   Number of observations per group:                   
##     White                                         1537
##     Black                                          161
##     Hispanic                                       184
##   Number of missing patterns per group:               
##     White                                           10
##     Black                                            2
##     Hispanic                                         4
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 6.621       4.304
##   Degrees of freedom                                 3           3
##   P-value (Chi-square)                           0.085       0.230
##   Scaling correction factor                                  1.538
##     Yuan-Bentler correction (Mplus variant)                       
##   Test statistic for each group:
##     White                                        0.013       0.013
##     Black                                        0.920       0.920
##     Hispanic                                     3.371       3.371
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1547.887     652.166
##   Degrees of freedom                                45          45
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.373
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.998       0.998
##   Tucker-Lewis Index (TLI)                       0.964       0.968
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            0.996
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -6480.929   -6480.929
##   Scaling correction factor                                  2.674
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -6477.619   -6477.619
##   Scaling correction factor                                  2.632
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               13117.858   13117.858
##   Bayesian (BIC)                             13549.985   13549.985
##   Sample-size adjusted Bayesian (SABIC)      13302.180   13302.180
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.044       0.026
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.090       0.067
##   P-value H_0: RMSEA <= 0.050                    0.513       0.794
##   P-value H_0: RMSEA >= 0.080                    0.108       0.011
##                                                                   
##   Robust RMSEA                                               0.014
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.099
##   P-value H_0: Robust RMSEA <= 0.050                         0.645
##   P-value H_0: Robust RMSEA >= 0.080                         0.130
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.006       0.006
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIepe =~                                                              
##     ex_eff_w1         1.000                               0.546    0.559
##     ex_eff_w2         1.000                               0.546    0.529
##     ex_eff_w3         1.000                               0.546    0.591
##   RIca =~                                                               
##     c_act_w1          1.000                               0.115    0.462
##     c_act_w2          1.000                               0.115    0.484
##     c_act_w3          1.000                               0.115    0.660
##   wepe1 =~                                                              
##     ex_eff_w1         1.000                               0.810    0.829
##   wepe2 =~                                                              
##     ex_eff_w2         1.000                               0.874    0.848
##   wepe3 =~                                                              
##     ex_eff_w3         1.000                               0.745    0.807
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.221    0.887
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.209    0.875
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.131    0.751
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe2 ~                                                               
##     wepe1             0.150    0.054    2.761    0.006    0.139    0.139
##     wca1              0.452    0.168    2.691    0.007    0.114    0.114
##   wca2 ~                                                                
##     wepe1             0.004    0.011    0.398    0.691    0.017    0.017
##     wca1              0.307    0.052    5.932    0.000    0.326    0.326
##   wepe3 ~                                                               
##     wepe2             0.162    0.045    3.577    0.000    0.190    0.190
##     wca2             -0.069    0.182   -0.379    0.705   -0.019   -0.019
##   wca3 ~                                                                
##     wepe2             0.011    0.008    1.349    0.177    0.076    0.076
##     wca2              0.035    0.053    0.656    0.512    0.055    0.055
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe1 ~~                                                              
##     wca1              0.018    0.007    2.401    0.016    0.098    0.098
##  .wepe2 ~~                                                              
##    .wca2              0.018    0.008    2.302    0.021    0.104    0.104
##  .wepe3 ~~                                                              
##    .wca3             -0.006    0.005   -1.132    0.258   -0.062   -0.062
##   RIepe ~~                                                              
##     RIca              0.009    0.006    1.597    0.110    0.145    0.145
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ex_eff_w1         2.553    0.032   79.440    0.000    2.553    2.614
##    .ex_eff_w2         2.312    0.034   67.886    0.000    2.312    2.243
##    .ex_eff_w3         2.188    0.030   73.002    0.000    2.188    2.369
##    .c_act_w1          0.187    0.008   22.798    0.000    0.187    0.751
##    .c_act_w2          0.158    0.008   19.990    0.000    0.158    0.665
##    .c_act_w3          0.077    0.006   14.004    0.000    0.077    0.442
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIepe             0.298    0.035    8.390    0.000    1.000    1.000
##     RIca              0.013    0.003    5.156    0.000    1.000    1.000
##     wepe1             0.657    0.040   16.436    0.000    1.000    1.000
##     wca1              0.049    0.004   13.140    0.000    1.000    1.000
##    .wepe2             0.738    0.043   17.272    0.000    0.965    0.965
##    .wca2              0.039    0.003   13.774    0.000    0.893    0.893
##    .wepe3             0.536    0.035   15.297    0.000    0.965    0.965
##    .wca3              0.017    0.002    7.459    0.000    0.990    0.990
##    .ex_eff_w1         0.000                               0.000    0.000
##    .ex_eff_w2         0.000                               0.000    0.000
##    .ex_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wepe2             0.035
##     wca2              0.107
##     wepe3             0.035
##     wca3              0.010
##     ex_eff_w1         1.000
##     ex_eff_w2         1.000
##     ex_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 2 [Black]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIepe =~                                                              
##     ex_eff_w1         1.000                               0.650    0.639
##     ex_eff_w2         1.000                               0.650    0.642
##     ex_eff_w3         1.000                               0.650    0.604
##   RIca =~                                                               
##     c_act_w1          1.000                               0.102    0.397
##     c_act_w2          1.000                               0.102    0.439
##     c_act_w3          1.000                               0.102    0.600
##   wepe1 =~                                                              
##     ex_eff_w1         1.000                               0.784    0.770
##   wepe2 =~                                                              
##     ex_eff_w2         1.000                               0.777    0.767
##   wepe3 =~                                                              
##     ex_eff_w3         1.000                               0.858    0.797
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.235    0.918
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.209    0.899
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.136    0.800
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe2 ~                                                               
##     wepe1            -0.185    0.170   -1.090    0.276   -0.187   -0.187
##     wca1             -0.688    0.429   -1.604    0.109   -0.208   -0.208
##   wca2 ~                                                                
##     wepe1             0.016    0.041    0.388    0.698    0.060    0.060
##     wca1              0.099    0.109    0.913    0.361    0.112    0.112
##   wepe3 ~                                                               
##     wepe2             0.067    0.193    0.347    0.729    0.061    0.061
##     wca2             -0.067    0.648   -0.104    0.917   -0.016   -0.016
##   wca3 ~                                                                
##     wepe2            -0.036    0.028   -1.280    0.201   -0.203   -0.203
##     wca2             -0.176    0.123   -1.427    0.154   -0.270   -0.270
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe1 ~~                                                              
##     wca1              0.055    0.022    2.468    0.014    0.298    0.298
##  .wepe2 ~~                                                              
##    .wca2              0.005    0.022    0.243    0.808    0.036    0.036
##  .wepe3 ~~                                                              
##    .wca3             -0.026    0.027   -0.978    0.328   -0.241   -0.241
##   RIepe ~~                                                              
##     RIca              0.023    0.015    1.485    0.138    0.342    0.342
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ex_eff_w1         2.548    0.104   24.514    0.000    2.548    2.501
##    .ex_eff_w2         2.602    0.105   24.876    0.000    2.602    2.569
##    .ex_eff_w3         2.247    0.112   20.045    0.000    2.247    2.087
##    .c_act_w1          0.220    0.025    8.740    0.000    0.220    0.857
##    .c_act_w2          0.158    0.023    6.835    0.000    0.158    0.679
##    .c_act_w3          0.082    0.020    4.013    0.000    0.082    0.483
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIepe             0.423    0.098    4.310    0.000    1.000    1.000
##     RIca              0.010    0.006    1.690    0.091    1.000    1.000
##     wepe1             0.614    0.127    4.832    0.000    1.000    1.000
##     wca1              0.055    0.008    6.545    0.000    1.000    1.000
##    .wepe2             0.542    0.171    3.163    0.002    0.899    0.899
##    .wca2              0.043    0.010    4.164    0.000    0.980    0.980
##    .wepe3             0.733    0.140    5.238    0.000    0.996    0.996
##    .wca3              0.016    0.011    1.429    0.153    0.887    0.887
##    .ex_eff_w1         0.000                               0.000    0.000
##    .ex_eff_w2         0.000                               0.000    0.000
##    .ex_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wepe2             0.101
##     wca2              0.020
##     wepe3             0.004
##     wca3              0.113
##     ex_eff_w1         1.000
##     ex_eff_w2         1.000
##     ex_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 3 [Hispanic]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIepe =~                                                              
##     ex_eff_w1         1.000                               0.260    0.240
##     ex_eff_w2         1.000                               0.260    0.274
##     ex_eff_w3         1.000                               0.260    0.297
##   RIca =~                                                               
##     c_act_w1          1.000                               0.094    0.391
##     c_act_w2          1.000                               0.094    0.414
##     c_act_w3          1.000                               0.094    0.530
##   wepe1 =~                                                              
##     ex_eff_w1         1.000                               1.050    0.971
##   wepe2 =~                                                              
##     ex_eff_w2         1.000                               0.912    0.962
##   wepe3 =~                                                              
##     ex_eff_w3         1.000                               0.834    0.955
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.221    0.920
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.206    0.910
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.150    0.848
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe2 ~                                                               
##     wepe1             0.087    0.128    0.685    0.493    0.101    0.101
##     wca1             -0.892    0.592   -1.505    0.132   -0.216   -0.216
##   wca2 ~                                                                
##     wepe1            -0.065    0.025   -2.636    0.008   -0.334   -0.334
##     wca1              0.198    0.103    1.911    0.056    0.212    0.212
##   wepe3 ~                                                               
##     wepe2             0.281    0.147    1.918    0.055    0.308    0.308
##     wca2             -0.983    0.568   -1.732    0.083   -0.243   -0.243
##   wca3 ~                                                                
##     wepe2             0.012    0.026    0.451    0.652    0.072    0.072
##     wca2             -0.023    0.110   -0.209    0.835   -0.032   -0.032
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wepe1 ~~                                                              
##     wca1             -0.015    0.043   -0.339    0.735   -0.063   -0.063
##  .wepe2 ~~                                                              
##    .wca2              0.003    0.024    0.123    0.902    0.017    0.017
##  .wepe3 ~~                                                              
##    .wca3             -0.009    0.015   -0.574    0.566   -0.078   -0.078
##   RIepe ~~                                                              
##     RIca              0.022    0.029    0.767    0.443    0.904    0.904
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ex_eff_w1         2.576    0.113   22.700    0.000    2.576    2.380
##    .ex_eff_w2         2.389    0.093   25.713    0.000    2.389    2.518
##    .ex_eff_w3         2.125    0.078   27.219    0.000    2.125    2.432
##    .c_act_w1          0.171    0.022    7.975    0.000    0.171    0.715
##    .c_act_w2          0.147    0.021    7.045    0.000    0.147    0.649
##    .c_act_w3          0.074    0.019    3.978    0.000    0.074    0.420
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIepe             0.068    0.150    0.449    0.653    1.000    1.000
##     RIca              0.009    0.005    1.908    0.056    1.000    1.000
##     wepe1             1.103    0.225    4.907    0.000    1.000    1.000
##     wca1              0.049    0.008    5.806    0.000    1.000    1.000
##    .wepe2             0.783    0.133    5.898    0.000    0.941    0.941
##    .wca2              0.035    0.007    5.113    0.000    0.835    0.835
##    .wepe3             0.581    0.084    6.938    0.000    0.836    0.836
##    .wca3              0.022    0.015    1.461    0.144    0.993    0.993
##    .ex_eff_w1         0.000                               0.000    0.000
##    .ex_eff_w2         0.000                               0.000    0.000
##    .ex_eff_w3         0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wepe2             0.059
##     wca2              0.165
##     wepe3             0.164
##     wca3              0.007
##     ex_eff_w1         1.000
##     ex_eff_w2         1.000
##     ex_eff_w3         1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM CR + CA, MLR

RICLPM5 <- '
  # Create between components (random intercepts)
  RIcr =~ 1*c_ref_w1 + 1*c_ref_w2 + 1*c_ref_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wcr1 =~ 1*c_ref_w1
  wcr2 =~ 1*c_ref_w2
  wcr3 =~ 1*c_ref_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wcr2 + wca2 ~ wcr1 + wca1
  wcr3 + wca3 ~ wcr2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wcr1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wcr2 ~~ wca2
  wcr3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIcr ~~ RIcr
  RIca ~~ RIca
  RIcr ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wcr1 ~~ wcr1 # Variances
  wca1 ~~ wca1 
  wcr2 ~~ wcr2 # Residual variances
  wca2 ~~ wca2 
  wcr3 ~~ wcr3 
  wca3 ~~ wca3'
RICLPM5fit <- lavaan(RICLPM5, 
  data = ANES_clean, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "MLR",
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM5fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 76 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        26
## 
##   Number of observations                          2070
##   Number of missing patterns                        10
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 1.978       1.013
##   Degrees of freedom                                 1           1
##   P-value (Chi-square)                           0.160       0.314
##   Scaling correction factor                                  1.954
##     Yuan-Bentler correction (Mplus variant)                       
## 
## Model Test Baseline Model:
## 
##   Test statistic                              3830.775    1602.897
##   Degrees of freedom                                15          15
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.390
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       1.000
##   Tucker-Lewis Index (TLI)                       0.996       1.000
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            1.000
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7490.719   -7490.719
##   Scaling correction factor                                  2.304
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -7489.729   -7489.729
##   Scaling correction factor                                  2.291
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               15033.437   15033.437
##   Bayesian (BIC)                             15179.955   15179.955
##   Sample-size adjusted Bayesian (SABIC)      15097.351   15097.351
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.022       0.002
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.067       0.044
##   P-value H_0: RMSEA <= 0.050                    0.808       0.977
##   P-value H_0: RMSEA >= 0.080                    0.013       0.000
##                                                                   
##   Robust RMSEA                                               0.006
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.081
##   P-value H_0: Robust RMSEA <= 0.050                         0.736
##   P-value H_0: Robust RMSEA >= 0.080                         0.054
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.006       0.006
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.969    0.790
##     c_ref_w2          1.000                               0.969    0.779
##     c_ref_w3          1.000                               0.969    0.802
##   RIca =~                                                               
##     c_act_w1          1.000                               0.113    0.452
##     c_act_w2          1.000                               0.113    0.473
##     c_act_w3          1.000                               0.113    0.632
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.751    0.613
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.781    0.628
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.722    0.598
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.223    0.892
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.210    0.881
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.138    0.775
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.121    0.071    1.704    0.088    0.116    0.116
##     wca1              0.211    0.150    1.411    0.158    0.060    0.060
##   wca2 ~                                                                
##     wcr1              0.049    0.016    3.088    0.002    0.175    0.175
##     wca1              0.260    0.041    6.290    0.000    0.276    0.276
##   wcr3 ~                                                                
##     wcr2              0.174    0.064    2.725    0.006    0.188    0.188
##     wca2              0.593    0.211    2.815    0.005    0.173    0.173
##   wca3 ~                                                                
##     wcr2              0.008    0.009    0.891    0.373    0.047    0.047
##     wca2              0.025    0.048    0.522    0.602    0.038    0.038
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.014    0.008    1.733    0.083    0.086    0.086
##  .wcr2 ~~                                                               
##    .wca2              0.034    0.008    4.182    0.000    0.225    0.225
##  .wcr3 ~~                                                               
##    .wca3              0.009    0.005    1.693    0.090    0.093    0.093
##   RIcr ~~                                                               
##     RIca              0.030    0.007    4.281    0.000    0.277    0.277
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          3.023    0.037   82.590    0.000    3.023    2.465
##    .c_ref_w2          3.234    0.036   89.365    0.000    3.234    2.599
##    .c_ref_w3          3.113    0.036   86.139    0.000    3.113    2.576
##    .c_act_w1          0.192    0.007   26.911    0.000    0.192    0.769
##    .c_act_w2          0.159    0.007   23.008    0.000    0.159    0.665
##    .c_act_w3          0.078    0.005   14.840    0.000    0.078    0.437
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.939    0.053   17.826    0.000    1.000    1.000
##     RIca              0.013    0.002    6.115    0.000    1.000    1.000
##     wcr1              0.565    0.043   13.166    0.000    1.000    1.000
##     wca1              0.050    0.003   17.431    0.000    1.000    1.000
##    .wcr2              0.598    0.046   12.986    0.000    0.982    0.982
##    .wca2              0.039    0.003   15.441    0.000    0.885    0.885
##    .wcr3              0.479    0.035   13.642    0.000    0.919    0.919
##    .wca3              0.019    0.003    6.168    0.000    0.995    0.995
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.018
##     wca2              0.115
##     wcr3              0.081
##     wca3              0.005
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM CR + CA, MLR, Multi-Group by Race

RICLPM6 <- '
  # Create between components (random intercepts)
  RIcr =~ 1*c_ref_w1 + 1*c_ref_w2 + 1*c_ref_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wcr1 =~ 1*c_ref_w1
  wcr2 =~ 1*c_ref_w2
  wcr3 =~ 1*c_ref_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wcr2 + wca2 ~ wcr1 + wca1
  wcr3 + wca3 ~ wcr2 + wca2
  
  # Estimate covariance between within-person centered variables at first wave
  wcr1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wcr2 ~~ wca2
  wcr3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIcr ~~ RIcr
  RIca ~~ RIca
  RIcr ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wcr1 ~~ wcr1 # Variances
  wca1 ~~ wca1 
  wcr2 ~~ wcr2 # Residual variances
  wca2 ~~ wca2 
  wcr3 ~~ wcr3 
  wca3 ~~ wca3'
RICLPM6fit <- lavaan(RICLPM6, 
  data = ANES_cleanest, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "MLR",
  group = 'Race3',
  meanstructure = T, 
  int.ov.free = T)

summary(RICLPM6fit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 204 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        78
## 
##   Number of observations per group:                   
##     White                                         1537
##     Black                                          161
##     Hispanic                                       184
##   Number of missing patterns per group:               
##     White                                           10
##     Black                                            4
##     Hispanic                                         3
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 3.888       1.416
##   Degrees of freedom                                 3           3
##   P-value (Chi-square)                           0.274       0.702
##   Scaling correction factor                                  2.746
##     Yuan-Bentler correction (Mplus variant)                       
##   Test statistic for each group:
##     White                                        0.041       0.041
##     Black                                        1.033       1.033
##     Hispanic                                     0.342       0.342
## 
## Model Test Baseline Model:
## 
##   Test statistic                              3382.209    1318.479
##   Degrees of freedom                                45          45
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.565
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       1.000
##   Tucker-Lewis Index (TLI)                       0.996       1.019
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            1.016
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -6584.676   -6584.676
##   Scaling correction factor                                  2.803
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -6582.732   -6582.732
##   Scaling correction factor                                  2.801
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               13325.353   13325.353
##   Bayesian (BIC)                             13757.480   13757.480
##   Sample-size adjusted Bayesian (SABIC)      13509.674   13509.674
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.022       0.000
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.074       0.023
##   P-value H_0: RMSEA <= 0.050                    0.759       0.999
##   P-value H_0: RMSEA >= 0.080                    0.030       0.000
##                                                                   
##   Robust RMSEA                                               0.000
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.082
##   P-value H_0: Robust RMSEA <= 0.050                         0.833
##   P-value H_0: Robust RMSEA >= 0.080                         0.056
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.006       0.006
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [White]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.976    0.797
##     c_ref_w2          1.000                               0.976    0.784
##     c_ref_w3          1.000                               0.976    0.811
##   RIca =~                                                               
##     c_act_w1          1.000                               0.117    0.467
##     c_act_w2          1.000                               0.117    0.490
##     c_act_w3          1.000                               0.117    0.668
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.740    0.604
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.772    0.620
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.703    0.585
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.221    0.884
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.208    0.872
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.130    0.744
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.159    0.082    1.937    0.053    0.153    0.153
##     wca1              0.399    0.168    2.379    0.017    0.114    0.114
##   wca2 ~                                                                
##     wcr1              0.050    0.019    2.703    0.007    0.180    0.180
##     wca1              0.288    0.049    5.836    0.000    0.306    0.306
##   wcr3 ~                                                                
##     wcr2              0.178    0.071    2.503    0.012    0.196    0.196
##     wca2              0.753    0.253    2.980    0.003    0.222    0.222
##   wca3 ~                                                                
##     wcr2              0.002    0.010    0.204    0.838    0.012    0.012
##     wca2              0.032    0.055    0.572    0.567    0.051    0.051
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.015    0.009    1.593    0.111    0.092    0.092
##  .wcr2 ~~                                                               
##    .wca2              0.036    0.009    4.129    0.000    0.248    0.248
##  .wcr3 ~~                                                               
##    .wca3              0.004    0.004    0.895    0.371    0.045    0.045
##   RIcr ~~                                                               
##     RIca              0.035    0.008    4.492    0.000    0.312    0.312
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          2.900    0.041   69.868    0.000    2.900    2.367
##    .c_ref_w2          3.078    0.040   76.285    0.000    3.078    2.474
##    .c_ref_w3          3.001    0.040   75.248    0.000    3.001    2.495
##    .c_act_w1          0.187    0.008   22.790    0.000    0.187    0.750
##    .c_act_w2          0.158    0.008   19.987    0.000    0.158    0.665
##    .c_act_w3          0.077    0.006   14.006    0.000    0.077    0.443
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.952    0.060   15.788    0.000    1.000    1.000
##     RIca              0.014    0.003    5.298    0.000    1.000    1.000
##     wcr1              0.548    0.047   11.548    0.000    1.000    1.000
##     wca1              0.049    0.004   13.314    0.000    1.000    1.000
##    .wcr2              0.572    0.050   11.528    0.000    0.960    0.960
##    .wca2              0.037    0.003   13.424    0.000    0.864    0.864
##    .wcr3              0.438    0.036   12.195    0.000    0.887    0.887
##    .wca3              0.017    0.002    7.401    0.000    0.997    0.997
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.040
##     wca2              0.136
##     wcr3              0.113
##     wca3              0.003
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 2 [Black]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.790    0.723
##     c_ref_w2          1.000                               0.790    0.755
##     c_ref_w3          1.000                               0.790    0.679
##   RIca =~                                                               
##     c_act_w1          1.000                               0.113    0.442
##     c_act_w2          1.000                               0.113    0.488
##     c_act_w3          1.000                               0.113    0.669
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.755    0.691
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.685    0.656
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.854    0.734
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.230    0.897
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.203    0.873
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.126    0.743
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1             -0.335    0.192   -1.748    0.081   -0.369   -0.369
##     wca1             -0.337    0.466   -0.723    0.470   -0.113   -0.113
##   wca2 ~                                                                
##     wcr1              0.051    0.032    1.555    0.120    0.188    0.188
##     wca1              0.069    0.088    0.783    0.434    0.078    0.078
##   wcr3 ~                                                                
##     wcr2             -0.117    0.269   -0.436    0.663   -0.094   -0.094
##     wca2              0.809    0.746    1.084    0.278    0.192    0.192
##   wca3 ~                                                                
##     wcr2              0.044    0.037    1.174    0.240    0.238    0.238
##     wca2             -0.272    0.144   -1.895    0.058   -0.438   -0.438
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.007    0.026    0.272    0.786    0.040    0.040
##  .wcr2 ~~                                                               
##    .wca2              0.035    0.025    1.389    0.165    0.280    0.280
##  .wcr3 ~~                                                               
##    .wca3              0.038    0.028    1.371    0.170    0.404    0.404
##   RIcr ~~                                                               
##     RIca             -0.007    0.013   -0.573    0.567   -0.082   -0.082
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          3.821    0.118   32.484    0.000    3.821    3.499
##    .c_ref_w2          4.093    0.123   33.371    0.000    4.093    3.914
##    .c_ref_w3          3.795    0.135   28.190    0.000    3.795    3.262
##    .c_act_w1          0.220    0.025    8.740    0.000    0.220    0.855
##    .c_act_w2          0.158    0.023    6.835    0.000    0.158    0.679
##    .c_act_w3          0.082    0.020    4.013    0.000    0.082    0.484
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.623    0.193    3.231    0.001    1.000    1.000
##     RIca              0.013    0.006    2.128    0.033    1.000    1.000
##     wcr1              0.569    0.118    4.819    0.000    1.000    1.000
##     wca1              0.053    0.008    6.673    0.000    1.000    1.000
##    .wcr2              0.398    0.185    2.155    0.031    0.848    0.848
##    .wca2              0.039    0.010    3.815    0.000    0.957    0.957
##    .wcr3              0.701    0.135    5.200    0.000    0.961    0.961
##    .wca3              0.012    0.010    1.283    0.200    0.787    0.787
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.152
##     wca2              0.043
##     wcr3              0.039
##     wca3              0.213
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 3 [Hispanic]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.767    0.734
##     c_ref_w2          1.000                               0.767    0.722
##     c_ref_w3          1.000                               0.767    0.731
##   RIca =~                                                               
##     c_act_w1          1.000                               0.082    0.349
##     c_act_w2          1.000                               0.082    0.362
##     c_act_w3          1.000                               0.082    0.459
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.709    0.679
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.734    0.691
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.715    0.682
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.220    0.937
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.211    0.932
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.159    0.889
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1             -0.054    0.194   -0.276    0.782   -0.052   -0.052
##     wca1             -0.500    0.648   -0.773    0.440   -0.150   -0.150
##   wca2 ~                                                                
##     wcr1              0.008    0.064    0.124    0.901    0.027    0.027
##     wca1              0.241    0.114    2.117    0.034    0.252    0.252
##   wcr3 ~                                                                
##     wcr2              0.277    0.168    1.653    0.098    0.285    0.285
##     wca2             -0.056    0.662   -0.085    0.932   -0.017   -0.017
##   wca3 ~                                                                
##     wcr2             -0.001    0.020   -0.066    0.948   -0.006   -0.006
##     wca2              0.030    0.110    0.275    0.783    0.040    0.040
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1             -0.022    0.032   -0.698    0.485   -0.144   -0.144
##  .wcr2 ~~                                                               
##    .wca2              0.040    0.033    1.238    0.216    0.272    0.272
##  .wcr3 ~~                                                               
##    .wca3              0.013    0.011    1.233    0.217    0.122    0.122
##   RIcr ~~                                                               
##     RIca              0.037    0.028    1.319    0.187    0.594    0.594
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          2.940    0.098   30.156    0.000    2.940    2.815
##    .c_ref_w2          3.292    0.096   34.435    0.000    3.292    3.101
##    .c_ref_w3          3.105    0.102   30.359    0.000    3.105    2.961
##    .c_act_w1          0.172    0.022    7.976    0.000    0.172    0.730
##    .c_act_w2          0.147    0.021    7.045    0.000    0.147    0.649
##    .c_act_w3          0.074    0.019    3.978    0.000    0.074    0.415
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.588    0.111    5.316    0.000    1.000    1.000
##     RIca              0.007    0.004    1.562    0.118    1.000    1.000
##     wcr1              0.503    0.092    5.453    0.000    1.000    1.000
##     wca1              0.048    0.008    6.138    0.000    1.000    1.000
##    .wcr2              0.526    0.137    3.831    0.000    0.977    0.977
##    .wca2              0.042    0.007    5.581    0.000    0.938    0.938
##    .wcr3              0.471    0.116    4.060    0.000    0.921    0.921
##    .wca3              0.025    0.016    1.609    0.108    0.998    0.998
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.023
##     wca2              0.062
##     wcr3              0.079
##     wca3              0.002
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#Mean split

ANES_clean$in_eff_ms_w2 <- ifelse(ANES_clean$in_eff_w2 > mean(ANES_clean$in_eff_w2, na.rm = TRUE), 1, 0)

ANES_clean$ex_eff_ms_w2 <- ifelse(ANES_clean$ex_eff_w2 > mean(ANES_clean$ex_eff_w2, na.rm = TRUE), 1, 0)

ANES_grouped_clean <- subset(ANES_clean, !is.na(ex_eff_ms_w2))


ANES_grouped2_clean <- subset(ANES_clean, !is.na(in_eff_ms_w2))

#RICLPM IPE Mod, MLR

RICLPMmod <- '
  # Create between components (random intercepts)
  RIcr =~ 1*c_ref_w1 + 1*c_ref_w2 + 1*c_ref_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wcr1 =~ 1*c_ref_w1
  wcr2 =~ 1*c_ref_w2
  wcr3 =~ 1*c_ref_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wcr2 ~ wcr1 + wca1
  wcr3 ~ wca2
  wcr3 ~ wcr2
  wca2 ~ wca1
  wca3 ~ wca2
  wca2 ~ wcr1
  wca3 ~ wcr2
  
  # Estimate covariance between within-person centered variables at first wave
  wcr1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wcr2 ~~ wca2
  wcr3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIcr ~~ RIcr
  RIca ~~ RIca
  RIcr ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wcr1 ~~ wcr1 # Variances
  wca1 ~~ wca1 
  wcr2 ~~ wcr2 # Residual variances
  wca2 ~~ wca2 
  wcr3 ~~ wcr3 
  wca3 ~~ wca3'

RICLPMmodfit <- lavaan(RICLPMmod, 
  data = ANES_grouped2_clean, 
  missing = 'FIML',
  sampling.weights = 'V240106b',
  estimator = "MLR",
  meanstructure = T, 
  group = "in_eff_ms_w2",
  int.ov.free = T)

summary(RICLPMmodfit, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 128 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        52
## 
##   Number of observations per group:                   
##     0                                              862
##     1                                             1199
##   Number of missing patterns per group:               
##     0                                                8
##     1                                                7
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 5.950       3.160
##   Degrees of freedom                                 2           2
##   P-value (Chi-square)                           0.051       0.206
##   Scaling correction factor                                  1.883
##     Yuan-Bentler correction (Mplus variant)                       
##   Test statistic for each group:
##     0                                            0.163       0.163
##     1                                            2.997       2.997
## 
## Model Test Baseline Model:
## 
##   Test statistic                              3704.261    1590.263
##   Degrees of freedom                                30          30
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.329
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.999       0.999
##   Tucker-Lewis Index (TLI)                       0.984       0.989
##                                                                   
##   Robust Comparative Fit Index (CFI)                         0.999
##   Robust Tucker-Lewis Index (TLI)                            0.992
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7319.465   -7319.465
##   Scaling correction factor                                  2.411
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -7316.490   -7316.490
##   Scaling correction factor                                  2.392
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               14742.930   14742.930
##   Bayesian (BIC)                             15035.739   15035.739
##   Sample-size adjusted Bayesian (SABIC)      14870.531   14870.531
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.044       0.024
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.086       0.058
##   P-value H_0: RMSEA <= 0.050                    0.520       0.883
##   P-value H_0: RMSEA >= 0.080                    0.086       0.002
##                                                                   
##   Robust RMSEA                                               0.031
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.098
##   P-value H_0: Robust RMSEA <= 0.050                         0.578
##   P-value H_0: Robust RMSEA >= 0.080                         0.138
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.010       0.010
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [0]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.851    0.769
##     c_ref_w2          1.000                               0.851    0.748
##     c_ref_w3          1.000                               0.851    0.753
##   RIca =~                                                               
##     c_act_w1          1.000                               0.098    0.429
##     c_act_w2          1.000                               0.098    0.517
##     c_act_w3          1.000                               0.098    0.615
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.708    0.640
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.755    0.664
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.743    0.658
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.207    0.903
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.163    0.856
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.126    0.789
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.098    0.114    0.855    0.392    0.092    0.092
##     wca1              0.013    0.234    0.056    0.955    0.004    0.004
##   wcr3 ~                                                                
##     wca2              0.077    0.414    0.185    0.853    0.017    0.017
##     wcr2              0.142    0.094    1.505    0.132    0.144    0.144
##   wca2 ~                                                                
##     wca1              0.174    0.054    3.252    0.001    0.221    0.221
##   wca3 ~                                                                
##     wca2             -0.111    0.081   -1.376    0.169   -0.144   -0.144
##   wca2 ~                                                                
##     wcr1              0.014    0.022    0.613    0.540    0.059    0.059
##   wca3 ~                                                                
##     wcr2              0.012    0.014    0.826    0.409    0.070    0.070
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.006    0.011    0.509    0.611    0.038    0.038
##  .wcr2 ~~                                                               
##    .wca2              0.015    0.010    1.445    0.149    0.124    0.124
##  .wcr3 ~~                                                               
##    .wca3              0.015    0.009    1.694    0.090    0.168    0.168
##   RIcr ~~                                                               
##     RIca              0.031    0.010    3.114    0.002    0.366    0.366
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          2.911    0.051   57.358    0.000    2.911    2.631
##    .c_ref_w2          3.096    0.051   61.182    0.000    3.096    2.722
##    .c_ref_w3          3.039    0.053   57.782    0.000    3.039    2.691
##    .c_act_w1          0.151    0.010   15.530    0.000    0.151    0.662
##    .c_act_w2          0.108    0.008   12.805    0.000    0.108    0.571
##    .c_act_w3          0.058    0.008    7.421    0.000    0.058    0.366
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.723    0.072   10.039    0.000    1.000    1.000
##     RIca              0.010    0.002    3.913    0.000    1.000    1.000
##     wcr1              0.501    0.058    8.589    0.000    1.000    1.000
##     wca1              0.043    0.003   13.134    0.000    1.000    1.000
##    .wcr2              0.565    0.067    8.420    0.000    0.992    0.992
##    .wca2              0.025    0.003    7.955    0.000    0.946    0.946
##    .wcr3              0.540    0.057    9.407    0.000    0.978    0.978
##    .wca3              0.015    0.005    3.024    0.002    0.977    0.977
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.008
##     wca2              0.054
##     wcr3              0.022
##     wca3              0.023
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 2 [1]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               1.058    0.805
##     c_ref_w2          1.000                               1.058    0.799
##     c_ref_w3          1.000                               1.058    0.830
##   RIca =~                                                               
##     c_act_w1          1.000                               0.121    0.459
##     c_act_w2          1.000                               0.121    0.450
##     c_act_w3          1.000                               0.121    0.625
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.781    0.594
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.796    0.601
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.712    0.558
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.233    0.888
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.240    0.893
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.151    0.781
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.122    0.091    1.334    0.182    0.119    0.119
##     wca1              0.209    0.198    1.054    0.292    0.061    0.061
##   wcr3 ~                                                                
##     wca2              0.788    0.251    3.136    0.002    0.266    0.266
##     wcr2              0.210    0.089    2.367    0.018    0.234    0.234
##   wca2 ~                                                                
##     wca1              0.288    0.055    5.248    0.000    0.280    0.280
##   wca3 ~                                                                
##     wca2              0.076    0.060    1.278    0.201    0.121    0.121
##   wca2 ~                                                                
##     wcr1              0.067    0.022    3.028    0.002    0.218    0.218
##   wca3 ~                                                                
##     wcr2              0.005    0.012    0.369    0.712    0.024    0.024
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.014    0.012    1.212    0.226    0.077    0.077
##  .wcr2 ~~                                                               
##    .wca2              0.046    0.013    3.637    0.000    0.264    0.264
##  .wcr3 ~~                                                               
##    .wca3              0.004    0.006    0.626    0.531    0.037    0.037
##   RIcr ~~                                                               
##     RIca              0.026    0.010    2.680    0.007    0.203    0.203
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          3.143    0.052   60.378    0.000    3.143    2.389
##    .c_ref_w2          3.373    0.051   65.816    0.000    3.373    2.548
##    .c_ref_w3          3.192    0.050   63.867    0.000    3.192    2.502
##    .c_act_w1          0.232    0.010   22.937    0.000    0.232    0.883
##    .c_act_w2          0.208    0.010   19.882    0.000    0.208    0.775
##    .c_act_w3          0.097    0.007   13.752    0.000    0.097    0.502
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              1.120    0.073   15.310    0.000    1.000    1.000
##     RIca              0.015    0.003    4.719    0.000    1.000    1.000
##     wcr1              0.611    0.058   10.560    0.000    1.000    1.000
##     wca1              0.055    0.004   12.348    0.000    1.000    1.000
##    .wcr2              0.621    0.064    9.644    0.000    0.981    0.981
##    .wca2              0.050    0.004   12.898    0.000    0.865    0.865
##    .wcr3              0.425    0.041   10.340    0.000    0.838    0.838
##    .wca3              0.022    0.003    7.218    0.000    0.983    0.983
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.019
##     wca2              0.135
##     wcr3              0.162
##     wca3              0.017
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000

#RICLPM EPE Mod, MLR

RICLPMmod9 <- '
  # Create between components (random intercepts)
  RIcr =~ 1*c_ref_w1 + 1*c_ref_w2 + 1*c_ref_w3 
  RIca =~ 1*c_act_w1 + 1*c_act_w2 + 1*c_act_w3 
  
  # Create within-person centered variables
  wcr1 =~ 1*c_ref_w1
  wcr2 =~ 1*c_ref_w2
  wcr3 =~ 1*c_ref_w3 

  wca1 =~ 1*c_act_w1
  wca2 =~ 1*c_act_w2
  wca3 =~ 1*c_act_w3
# Estimate lagged effects between within-person centered variables
  wcr2 ~ wcr1 + wca1
  wcr3 ~ wcr2 + wca2
  wca2 ~ wca1
  wca3 ~ wca2
  wca2 ~ wcr1
  wca3 ~ wcr2
  
  # Estimate covariance between within-person centered variables at first wave
  wcr1 ~~ wca1 # Covariance
  
  # Estimate covariances between residuals of within-person centered variables
  # (i.e., innovations)
  wcr2 ~~ wca2
  wcr3 ~~ wca3
  
  # Estimate variance and covariance of random intercepts
  RIcr ~~ RIcr
  RIca ~~ RIca
  RIcr ~~ RIca
  
  # Estimate (residual) variance of within-person centered variables
  wcr1 ~~ wcr1 # Variances
  wca1 ~~ wca1 
  wcr2 ~~ wcr2 # Residual variances
  wca2 ~~ wca2 
  wcr3 ~~ wcr3 
  wca3 ~~ wca3

'


RICLPMmodfit9 <- lavaan(RICLPMmod9, 
  data = ANES_grouped_clean, 
  missing = 'FIML',
  estimator = "MLR",
  sampling.weights = 'V240106b',
  meanstructure = T, 
  group = "ex_eff_ms_w2",
  int.ov.free = T)

summary(RICLPMmodfit9, fit.measures = T, standardized = T, rsquare = T)
## lavaan 0.6-19 ended normally after 129 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        52
## 
##   Number of observations per group:                   
##     0                                             1105
##     1                                              957
##   Number of missing patterns per group:               
##     0                                                8
##     1                                                7
##   Sampling weights variable                   V240106b
## 
## Model Test User Model:
##                                               Standard      Scaled
##   Test Statistic                                 3.044       1.645
##   Degrees of freedom                                 2           2
##   P-value (Chi-square)                           0.218       0.439
##   Scaling correction factor                                  1.850
##     Yuan-Bentler correction (Mplus variant)                       
##   Test statistic for each group:
##     0                                            0.846       0.846
##     1                                            0.799       0.799
## 
## Model Test Baseline Model:
## 
##   Test statistic                              3659.303    1581.180
##   Degrees of freedom                                30          30
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  2.314
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       1.000
##   Tucker-Lewis Index (TLI)                       0.996       1.003
##                                                                   
##   Robust Comparative Fit Index (CFI)                         1.000
##   Robust Tucker-Lewis Index (TLI)                            1.003
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7366.202   -7366.202
##   Scaling correction factor                                  2.223
##       for the MLR correction                                      
##   Loglikelihood unrestricted model (H1)      -7364.680   -7364.680
##   Scaling correction factor                                  2.209
##       for the MLR correction                                      
##                                                                   
##   Akaike (AIC)                               14836.403   14836.403
##   Bayesian (BIC)                             15129.238   15129.238
##   Sample-size adjusted Bayesian (SABIC)      14964.029   14964.029
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.022       0.000
##   90 Percent confidence interval - lower         0.000       0.000
##   90 Percent confidence interval - upper         0.070       0.045
##   P-value H_0: RMSEA <= 0.050                    0.785       0.974
##   P-value H_0: RMSEA >= 0.080                    0.018       0.000
##                                                                   
##   Robust RMSEA                                               0.000
##   90 Percent confidence interval - lower                     0.000
##   90 Percent confidence interval - upper                     0.079
##   P-value H_0: Robust RMSEA <= 0.050                         0.776
##   P-value H_0: Robust RMSEA >= 0.080                         0.048
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.008       0.008
## 
## Parameter Estimates:
## 
##   Standard errors                             Sandwich
##   Information bread                           Observed
##   Observed information based on                Hessian
## 
## 
## Group 1 [0]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.964    0.795
##     c_ref_w2          1.000                               0.964    0.769
##     c_ref_w3          1.000                               0.964    0.802
##   RIca =~                                                               
##     c_act_w1          1.000                               0.084    0.346
##     c_act_w2          1.000                               0.084    0.382
##     c_act_w3          1.000                               0.084    0.561
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.734    0.606
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.802    0.640
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.719    0.598
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.226    0.938
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.202    0.924
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.123    0.828
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.111    0.100    1.103    0.270    0.101    0.101
##     wca1              0.171    0.200    0.855    0.392    0.048    0.048
##   wcr3 ~                                                                
##     wcr2              0.164    0.078    2.099    0.036    0.183    0.183
##     wca2              0.521    0.297    1.753    0.080    0.146    0.146
##   wca2 ~                                                                
##     wca1              0.272    0.055    4.949    0.000    0.305    0.305
##   wca3 ~                                                                
##     wca2              0.052    0.057    0.900    0.368    0.085    0.085
##   wca2 ~                                                                
##     wcr1              0.027    0.022    1.222    0.222    0.096    0.096
##   wca3 ~                                                                
##     wcr2             -0.003    0.010   -0.277    0.782   -0.018   -0.018
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.011    0.011    0.984    0.325    0.068    0.068
##  .wcr2 ~~                                                               
##    .wca2              0.025    0.011    2.286    0.022    0.161    0.161
##  .wcr3 ~~                                                               
##    .wca3              0.003    0.005    0.605    0.546    0.036    0.036
##   RIcr ~~                                                               
##     RIca              0.019    0.008    2.365    0.018    0.236    0.236
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          2.835    0.050   56.795    0.000    2.835    2.340
##    .c_ref_w2          3.036    0.050   60.681    0.000    3.036    2.422
##    .c_ref_w3          2.896    0.049   58.990    0.000    2.896    2.409
##    .c_act_w1          0.184    0.010   18.674    0.000    0.184    0.764
##    .c_act_w2          0.139    0.009   15.632    0.000    0.139    0.638
##    .c_act_w3          0.058    0.006   10.114    0.000    0.058    0.392
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.928    0.071   13.096    0.000    1.000    1.000
##     RIca              0.007    0.002    3.461    0.001    1.000    1.000
##     wcr1              0.539    0.051   10.505    0.000    1.000    1.000
##     wca1              0.051    0.004   11.531    0.000    1.000    1.000
##    .wcr2              0.634    0.064    9.882    0.000    0.987    0.987
##    .wca2              0.036    0.003   12.129    0.000    0.893    0.893
##    .wcr3              0.483    0.045   10.712    0.000    0.935    0.935
##    .wca3              0.015    0.003    5.996    0.000    0.993    0.993
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.013
##     wca2              0.107
##     wcr3              0.065
##     wca3              0.007
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000
## 
## 
## Group 2 [1]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   RIcr =~                                                               
##     c_ref_w1          1.000                               0.916    0.763
##     c_ref_w2          1.000                               0.916    0.769
##     c_ref_w3          1.000                               0.916    0.785
##   RIca =~                                                               
##     c_act_w1          1.000                               0.138    0.532
##     c_act_w2          1.000                               0.138    0.534
##     c_act_w3          1.000                               0.138    0.671
##   wcr1 =~                                                               
##     c_ref_w1          1.000                               0.775    0.646
##   wcr2 =~                                                               
##     c_ref_w2          1.000                               0.762    0.639
##   wcr3 =~                                                               
##     c_ref_w3          1.000                               0.722    0.619
##   wca1 =~                                                               
##     c_act_w1          1.000                               0.220    0.846
##   wca2 =~                                                               
##     c_act_w2          1.000                               0.219    0.846
##   wca3 =~                                                               
##     c_act_w3          1.000                               0.153    0.741
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr2 ~                                                                
##     wcr1              0.140    0.098    1.424    0.154    0.142    0.142
##     wca1              0.269    0.226    1.191    0.234    0.078    0.078
##   wcr3 ~                                                                
##     wcr2              0.191    0.103    1.853    0.064    0.201    0.201
##     wca2              0.583    0.283    2.057    0.040    0.177    0.177
##   wca2 ~                                                                
##     wca1              0.240    0.062    3.836    0.000    0.240    0.240
##   wca3 ~                                                                
##     wca2             -0.021    0.076   -0.270    0.787   -0.030   -0.030
##   wca2 ~                                                                
##     wcr1              0.066    0.021    3.142    0.002    0.236    0.236
##   wca3 ~                                                                
##     wcr2              0.022    0.017    1.298    0.194    0.110    0.110
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   wcr1 ~~                                                               
##     wca1              0.018    0.012    1.488    0.137    0.108    0.108
##  .wcr2 ~~                                                               
##    .wca2              0.043    0.012    3.581    0.000    0.280    0.280
##  .wcr3 ~~                                                               
##    .wca3              0.013    0.009    1.468    0.142    0.129    0.129
##   RIcr ~~                                                               
##     RIca              0.035    0.011    3.146    0.002    0.279    0.279
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .c_ref_w1          3.258    0.052   62.355    0.000    3.258    2.715
##    .c_ref_w2          3.476    0.051   68.025    0.000    3.476    2.918
##    .c_ref_w3          3.376    0.051   66.310    0.000    3.376    2.895
##    .c_act_w1          0.203    0.010   19.474    0.000    0.203    0.783
##    .c_act_w2          0.183    0.011   17.000    0.000    0.183    0.708
##    .c_act_w3          0.102    0.009   11.104    0.000    0.102    0.493
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     RIcr              0.839    0.079   10.626    0.000    1.000    1.000
##     RIca              0.019    0.004    5.294    0.000    1.000    1.000
##     wcr1              0.601    0.071    8.458    0.000    1.000    1.000
##     wca1              0.048    0.003   14.712    0.000    1.000    1.000
##    .wcr2              0.564    0.067    8.428    0.000    0.971    0.971
##    .wca2              0.042    0.004   10.318    0.000    0.874    0.874
##    .wcr3              0.472    0.051    9.321    0.000    0.906    0.906
##    .wca3              0.023    0.006    4.008    0.000    0.989    0.989
##    .c_ref_w1          0.000                               0.000    0.000
##    .c_ref_w2          0.000                               0.000    0.000
##    .c_ref_w3          0.000                               0.000    0.000
##    .c_act_w1          0.000                               0.000    0.000
##    .c_act_w2          0.000                               0.000    0.000
##    .c_act_w3          0.000                               0.000    0.000
## 
## R-Square:
##                    Estimate
##     wcr2              0.029
##     wca2              0.126
##     wcr3              0.094
##     wca3              0.011
##     c_ref_w1          1.000
##     c_ref_w2          1.000
##     c_ref_w3          1.000
##     c_act_w1          1.000
##     c_act_w2          1.000
##     c_act_w3          1.000