<- read_dta(paste0(data.raw_path, "Katie_10Mar22.dta"))
dat.raw
<- dat.raw %>%
dat ::select(id = atwinid,
dplyr
sampsex,
seswq35,# social isolation mother report
sisoem5,
sisoem7,
sisoem10,
sisoem12,# social isolation teacher report
sisoet5,
sisoet7,
sisoet10,
sisoet12,
sisoe5,
sisoe7,
sisoe10,
sisoe12,# total ADHD mother report
tadhdem5,
tadhdem7,
tadhdem10,
tadhdem12,# total ADHD teacher report
tadhdet5,
tadhdet7,
tadhdet10,
tadhdet12,# hyperactivity ADHD mother report
hyem5,
hyem7,
hyem10,
hyem12, # hyperactivity ADHD teacher report
hyet5,
hyet7,
hyet10,
hyet12,# inattention ADHD mother report
inem5,
inem7,
inem10,
inem12,# inattention ADHD teacher report
inet5,
inet7,
inet10,
inet12,# prosocial total scores mother report
proem5,
proem7,
proem10,
proem12, # prosocial total scores teacher report
proet5,
proet7,
proet10,
proet12, # antisocial total scores mother report
asbem5,
asbem7,
asbem10,
asbem12, # antisocial total scores teacher report
asbet5,
asbet7,
asbet10,
asbet12
)
colnames(dat)
[1] “id” “sampsex” “seswq35” “sisoem5” “sisoem7” “sisoem10” [7] “sisoem12” “sisoet5” “sisoet7” “sisoet10” “sisoet12” “sisoe5”
[13] “sisoe7” “sisoe10” “sisoe12” “tadhdem5” “tadhdem7” “tadhdem10” [19] “tadhdem12” “tadhdet5” “tadhdet7” “tadhdet10” “tadhdet12” “hyem5”
[25] “hyem7” “hyem10” “hyem12” “hyet5” “hyet7” “hyet10”
[31] “hyet12” “inem5” “inem7” “inem10” “inem12” “inet5”
[37] “inet7” “inet10” “inet12” “proem5” “proem7” “proem10”
[43] “proem12” “proet5” “proet7” “proet10” “proet12” “asbem5”
[49] “asbem7” “asbem10” “asbem12” “asbet5” “asbet7” “asbet10”
[55] “asbet12”
Functions
# Table of model fit
<- function(model){
table.model.fit <- as.data.frame(t(as.data.frame(model$FIT))) %>%
model.fit ::select(chisq, df, chisq.scaled, cfi.robust, tli.robust, aic, bic, bic2, rmsea.robust, rmsea.ci.lower.robust, rmsea.ci.upper.robust, srmr) #can only be used with "MLR" estimator
dplyrreturn(model.fit)
}
# Table of regression and correlation (standardised covariance) - only constrained models have been made into tables.
<- function(model, ses){
table.model.coef if (ses == "Low"){
<- as.tibble(model$PE[c(86:101),]) %>% dplyr::select(-block, -group, -exo, -label, -std.lv, -std.nox)
model.coef return(model.coef)
else if(ses == "Middle"){
} <- as.tibble(model$PE[c(17:32),]) %>% dplyr::select(-block, -group, -exo, -label, -std.lv, -std.nox)
model.coef return(model.coef)
else if(ses == "High"){
} <- as.tibble(model$PE[c(155:170),]) %>% dplyr::select(-block, -group, -exo, -label, -std.lv, -std.nox)
model.coef return(model.coef)
else {model.coef <- NULL}
} }
First we need to recode SES as a factor, to show which level is which.
<- dat %>%
dat mutate(
SES =
recode_factor(as_factor(seswq35),
"1" = "Low",
"2" = "Middle",
"3" = "High"))
table(dat$SES)
Low Middle High 742 738 752
# age 5
<- dat %>%
dat mutate(tadhde5 =
case_when(
is.na(tadhdem5) & is.na(tadhdet5) ~ NA_real_,
is.na(tadhdem5) & !is.na(tadhdet5) ~ as.numeric(tadhdet5),
is.na(tadhdet5) & !is.na(tadhdem5) ~ as.numeric(tadhdem5),
!is.na(tadhdem5) & !is.na(tadhdet5) ~ as.numeric(rowMeans(across(.cols = c(tadhdem5,tadhdet5)))))
)# age 7
<- dat %>%
dat mutate(tadhde7 =
case_when(
is.na(tadhdem7) & is.na(tadhdet7) ~ NA_real_,
is.na(tadhdem7) & !is.na(tadhdet7) ~ as.numeric(tadhdet7),
is.na(tadhdet7) & !is.na(tadhdem7) ~ as.numeric(tadhdem7),
!is.na(tadhdem7) & !is.na(tadhdet7) ~ as.numeric(rowMeans(across(.cols = c(tadhdem7,tadhdet7)))))
)# age 10
<- dat %>%
dat mutate(tadhde10 =
case_when(
is.na(tadhdem10) & is.na(tadhdet10) ~ NA_real_,
is.na(tadhdem10) & !is.na(tadhdet10) ~ as.numeric(tadhdet10),
is.na(tadhdet10) & !is.na(tadhdem10) ~ as.numeric(tadhdem10),
!is.na(tadhdem10) & !is.na(tadhdet10) ~ as.numeric(rowMeans(across(.cols = c(tadhdem10,tadhdet10)))))
)# age 12
<- dat %>%
dat mutate(tadhde12 =
case_when(
is.na(tadhdem12) & is.na(tadhdet12) ~ NA_real_,
is.na(tadhdem12) & !is.na(tadhdet12) ~ as.numeric(tadhdet12),
is.na(tadhdet12) & !is.na(tadhdem12) ~ as.numeric(tadhdem12),
!is.na(tadhdem12) & !is.na(tadhdet12) ~ as.numeric(rowMeans(across(.cols = c(tadhdem12,tadhdet12)))))
)
# age 5
<- dat %>%
dat mutate(hye5 =
case_when(
is.na(hyem5) & is.na(hyet5) ~ NA_real_,
is.na(hyem5) & !is.na(hyet5) ~ as.numeric(hyet5),
is.na(hyet5) & !is.na(hyem5) ~ as.numeric(hyem5),
!is.na(hyem5) & !is.na(hyet5) ~ as.numeric(rowMeans(across(.cols = c(hyem5,hyet5)))))
)# age 7
<- dat %>%
dat mutate(hye7 =
case_when(
is.na(hyem7) & is.na(hyet7) ~ NA_real_,
is.na(hyem7) & !is.na(hyet7) ~ as.numeric(hyet7),
is.na(hyet7) & !is.na(hyem7) ~ as.numeric(hyem7),
!is.na(hyem7) & !is.na(hyet7) ~ as.numeric(rowMeans(across(.cols = c(hyem7,hyet7)))))
)# age 10
<- dat %>%
dat mutate(hye10 =
case_when(
is.na(hyem10) & is.na(hyet10) ~ NA_real_,
is.na(hyem10) & !is.na(hyet10) ~ as.numeric(hyet10),
is.na(hyet10) & !is.na(hyem10) ~ as.numeric(hyem10),
!is.na(hyem10) & !is.na(hyet10) ~ as.numeric(rowMeans(across(.cols = c(hyem10,hyet10)))))
)# age 12
<- dat %>%
dat mutate(hye12 =
case_when(
is.na(hyem12) & is.na(hyet12) ~ NA_real_,
is.na(hyem12) & !is.na(hyet12) ~ as.numeric(hyet12),
is.na(hyet12) & !is.na(hyem12) ~ as.numeric(hyem12),
!is.na(hyem12) & !is.na(hyet12) ~ as.numeric(rowMeans(across(.cols = c(hyem12,hyet12)))))
)
# age 5
<- dat %>%
dat mutate(ine5 =
case_when(
is.na(inem5) & is.na(inet5) ~ NA_real_,
is.na(inem5) & !is.na(inet5) ~ as.numeric(inet5),
is.na(inet5) & !is.na(inem5) ~ as.numeric(inem5),
!is.na(inem5) & !is.na(inet5) ~ as.numeric(rowMeans(across(.cols = c(inem5,inet5)))))
)# age 7
<- dat %>%
dat mutate(ine7 =
case_when(
is.na(inem7) & is.na(inet7) ~ NA_real_,
is.na(inem7) & !is.na(inet7) ~ as.numeric(inet7),
is.na(inet7) & !is.na(inem7) ~ as.numeric(inem7),
!is.na(inem7) & !is.na(inet7) ~ as.numeric(rowMeans(across(.cols = c(inem7,inet7)))))
)# age 10
<- dat %>%
dat mutate(ine10 =
case_when(
is.na(inem10) & is.na(inet10) ~ NA_real_,
is.na(inem10) & !is.na(inet10) ~ as.numeric(inet10),
is.na(inet10) & !is.na(inem10) ~ as.numeric(inem10),
!is.na(inem10) & !is.na(inet10) ~ as.numeric(rowMeans(across(.cols = c(inem10,inet10)))))
)# age 12
<- dat %>%
dat mutate(ine12 =
case_when(
is.na(inem12) & is.na(inet12) ~ NA_real_,
is.na(inem12) & !is.na(inet12) ~ as.numeric(inet12),
is.na(inet12) & !is.na(inem12) ~ as.numeric(inem12),
!is.na(inem12) & !is.na(inet12) ~ as.numeric(rowMeans(across(.cols = c(inem12,inet12)))))
)
In the script “RICLPM_isolation_adhd.Rmd” and “RICLPMcomb_isolation_adhd.Rmd”, we decided that combined and mother report models will be constrained to have equal cross lags onlly, and teacher report models will be constrained to have equal autoregressive and crosslags.
Here, we will apply sex difference testing to each of these reporter models.
All models are using robust test statistics and standard errors.
Imposing constraints to the model can be achieved through pre-multiplication. It means that we have to prepend the number that we want to fix the parameter to, and an asterisk, to the parameter in the model specification. For example, F =~ 0*x1
fixes the factor loading of item x1
to factor F
to 0. Using pre-multiplication we can also constrain parameters to be the same by giving them the same label. Below we specify an RI-CLPM with the following constraints:
Naming: a = lag in ad b = lag in si c = cross lag ad->si d = cross lag si->ad
sex.c = sex differences in constrained model lag.c = lag constrained model sex.lag.c = sex and lag constrained model
We will text for sex differences in two steps: 1) Estimate a model where constraints are applied across lags but not for each of the groups (low/middle/high) 2) Estimate a model where constraints are applied across both lags and the groups (low/middle/high)
An example of the constraining: For lag c, I have constrained each lag to be set to c1 for females and c2 for males. They layout for group specification is c(group 1, group 2, group 3). This provides the same estimates across each lag, but that they differ for different SES groups.
<- '
RICLPMcomb.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhde5 + 1*tadhde7 + 1*tadhde10 + 1*tadhde12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*tadhde5
wad7 =~ 1*tadhde7
wad10 =~ 1*tadhde10
wad12 =~ 1*tadhde12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Constrained lagged effects between the within-person centered variables. c(group1, group2) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMcomb.lag.c,
RICLPMcomb.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMcomb.lag.c.fit,
RICLPMcomb.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 221 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 8 High 8
Model Test User Model: Standard Robust Test Statistic 140.303 86.124 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.629 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 43.051 26.427 Low 24.532 15.059 High 72.720 44.638
Model Test Baseline Model:
Test statistic 6083.243 3268.692 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.861
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.983 0.985 Tucker-Lewis Index (TLI) 0.964 0.968
Robust Comparative Fit Index (CFI) 0.987 Robust Tucker-Lewis Index (TLI) 0.972
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -31303.851 -31303.851 Scaling correction factor 2.172 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.209 for the MLR correction
Akaike (AIC) 62793.701 62793.701 Bayesian (BIC) 63324.792 63324.792 Sample-size adjusted Bayesian (BIC) 63029.316 63029.316
Root Mean Square Error of Approximation:
RMSEA 0.059 0.040 90 Percent confidence interval - lower 0.049 0.031 90 Percent confidence interval - upper 0.070 0.049 P-value RMSEA <= 0.05 0.074 0.962
Robust RMSEA 0.051 90 Percent confidence interval - lower 0.037 90 Percent confidence interval - upper 0.066
Standardized Root Mean Square Residual:
SRMR 0.039 0.039
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhde5 1.000 1.615 0.622 tadhde7 1.000 1.615 0.650 tadhde10 1.000 1.615 0.711 tadhde12 1.000 1.615 0.673 RIsi =~
sisoe5 1.000 0.584 0.585 sisoe7 1.000 0.584 0.565 sisoe10 1.000 0.584 0.479 sisoe12 1.000 0.584 0.483 wad5 =~
tadhde5 1.000 2.032 0.783 wad7 =~
tadhde7 1.000 1.890 0.760 wad10 =~
tadhde10 1.000 1.596 0.703 wad12 =~
tadhde12 1.000 1.773 0.739 wsi5 =~
sisoe5 1.000 0.810 0.811 wsi7 =~
sisoe7 1.000 0.853 0.825 wsi10 =~
sisoe10 1.000 1.071 0.878 wsi12 =~
sisoe12 1.000 1.060 0.876
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.318 0.067 4.762 0.000 0.342 0.342 wsi5 (d1) -0.055 0.081 -0.674 0.500 -0.023 -0.023 wsi7 ~
wad5 (c1) 0.071 0.021 3.310 0.001 0.169 0.169 wsi5 0.056 0.097 0.575 0.565 0.053 0.053 wad10 ~
wad7 0.127 0.105 1.210 0.226 0.150 0.150 wsi7 (d1) -0.055 0.081 -0.674 0.500 -0.029 -0.029 wsi10 ~
wad7 (c1) 0.071 0.021 3.310 0.001 0.126 0.126 wsi7 0.167 0.089 1.871 0.061 0.133 0.133 wad12 ~
wad10 0.347 0.125 2.767 0.006 0.312 0.312 wsi10 (d1) -0.055 0.081 -0.674 0.500 -0.033 -0.033 wsi12 ~
wad10 (c1) 0.071 0.021 3.310 0.001 0.107 0.107 wsi10 0.459 0.058 7.896 0.000 0.463 0.463
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.480 0.139 3.449 0.001 0.292 0.292 .wad7 ~~
.wsi7 0.422 0.147 2.875 0.004 0.283 0.283 .wad10 ~~
.wsi10 0.410 0.112 3.662 0.000 0.248 0.248 .wad12 ~~
.wsi12 0.382 0.099 3.865 0.000 0.247 0.247 RIad ~~
RIsi 0.471 0.100 4.704 0.000 0.499 0.499
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhde5 2.042 0.095 21.549 0.000 2.042 0.787 .tadhde7 1.791 0.094 18.967 0.000 1.791 0.720 .tadhde10 1.373 0.084 16.333 0.000 1.373 0.605 .tadhde12 1.386 0.090 15.450 0.000 1.386 0.578 .sisoe5 0.727 0.037 19.702 0.000 0.727 0.728 .sisoe7 0.743 0.039 19.085 0.000 0.743 0.719 .sisoe10 0.813 0.046 17.833 0.000 0.813 0.666 .sisoe12 0.871 0.046 19.131 0.000 0.871 0.719 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 2.609 0.386 6.761 0.000 1.000 1.000 RIsi 0.341 0.070 4.866 0.000 1.000 1.000 wad5 4.128 0.492 8.391 0.000 1.000 1.000 wsi5 0.656 0.103 6.353 0.000 1.000 1.000 .wad7 3.171 0.394 8.048 0.000 0.887 0.887 .wsi7 0.702 0.096 7.312 0.000 0.963 0.963 .wad10 2.494 0.485 5.139 0.000 0.979 0.979 .wsi10 1.097 0.154 7.102 0.000 0.956 0.956 .wad12 2.851 0.387 7.374 0.000 0.907 0.907 .wsi12 0.841 0.076 11.001 0.000 0.748 0.748 .tadhde5 0.000 0.000 0.000 .tadhde7 0.000 0.000 0.000 .tadhde10 0.000 0.000 0.000 .tadhde12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhde5 1.000 1.991 0.645 tadhde7 1.000 1.991 0.686 tadhde10 1.000 1.991 0.702 tadhde12 1.000 1.991 0.660 RIsi =~
sisoe5 1.000 0.840 0.612 sisoe7 1.000 0.840 0.622 sisoe10 1.000 0.840 0.582 sisoe12 1.000 0.840 0.500 wad5 =~
tadhde5 1.000 2.357 0.764 wad7 =~
tadhde7 1.000 2.111 0.727 wad10 =~
tadhde10 1.000 2.023 0.713 wad12 =~
tadhde12 1.000 2.264 0.751 wsi5 =~
sisoe5 1.000 1.086 0.791 wsi7 =~
sisoe7 1.000 1.057 0.783 wsi10 =~
sisoe10 1.000 1.173 0.813 wsi12 =~
sisoe12 1.000 1.454 0.866
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.161 0.071 2.257 0.024 0.179 0.179 wsi5 (d2) 0.138 0.106 1.304 0.192 0.071 0.071 wsi7 ~
wad5 (c2) 0.055 0.025 2.211 0.027 0.123 0.123 wsi5 0.237 0.093 2.543 0.011 0.243 0.243 wad10 ~
wad7 0.099 0.097 1.016 0.309 0.103 0.103 wsi7 (d2) 0.138 0.106 1.304 0.192 0.072 0.072 wsi10 ~
wad7 (c2) 0.055 0.025 2.211 0.027 0.100 0.100 wsi7 0.222 0.099 2.235 0.025 0.200 0.200 wad12 ~
wad10 0.371 0.094 3.962 0.000 0.331 0.331 wsi10 (d2) 0.138 0.106 1.304 0.192 0.072 0.072 wsi12 ~
wad10 (c2) 0.055 0.025 2.211 0.027 0.077 0.077 wsi10 0.480 0.074 6.507 0.000 0.387 0.387
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.752 0.263 2.858 0.004 0.294 0.294 .wad7 ~~
.wsi7 0.687 0.211 3.262 0.001 0.331 0.331 .wad10 ~~
.wsi10 0.826 0.222 3.722 0.000 0.364 0.364 .wad12 ~~
.wsi12 0.849 0.203 4.192 0.000 0.306 0.306 RIad ~~
RIsi 0.867 0.169 5.136 0.000 0.519 0.519
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhde5 2.974 0.112 26.461 0.000 2.974 0.964 .tadhde7 2.340 0.108 21.612 0.000 2.340 0.806 .tadhde10 2.130 0.106 20.188 0.000 2.130 0.751 .tadhde12 2.061 0.113 18.313 0.000 2.061 0.684 .sisoe5 1.014 0.050 20.330 0.000 1.014 0.739 .sisoe7 1.042 0.050 20.853 0.000 1.042 0.772 .sisoe10 1.181 0.054 21.756 0.000 1.181 0.819 .sisoe12 1.252 0.063 19.967 0.000 1.252 0.745 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 3.964 0.466 8.515 0.000 1.000 1.000 RIsi 0.705 0.127 5.559 0.000 1.000 1.000 wad5 5.557 0.615 9.039 0.000 1.000 1.000 wsi5 1.179 0.252 4.669 0.000 1.000 1.000 .wad7 4.256 0.572 7.444 0.000 0.955 0.955 .wsi7 1.015 0.143 7.108 0.000 0.908 0.908 .wad10 4.003 0.534 7.500 0.000 0.979 0.979 .wsi10 1.286 0.158 8.135 0.000 0.936 0.936 .wad12 4.442 0.518 8.573 0.000 0.867 0.867 .wsi12 1.737 0.200 8.694 0.000 0.822 0.822 .tadhde5 0.000 0.000 0.000 .tadhde7 0.000 0.000 0.000 .tadhde10 0.000 0.000 0.000 .tadhde12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhde5 1.000 1.562 0.618 tadhde7 1.000 1.562 0.729 tadhde10 1.000 1.562 0.722 tadhde12 1.000 1.562 0.788 RIsi =~
sisoe5 1.000 0.531 0.528 sisoe7 1.000 0.531 0.498 sisoe10 1.000 0.531 0.461 sisoe12 1.000 0.531 0.506 wad5 =~
tadhde5 1.000 1.985 0.786 wad7 =~
tadhde7 1.000 1.468 0.685 wad10 =~
tadhde10 1.000 1.499 0.692 wad12 =~
tadhde12 1.000 1.222 0.616 wsi5 =~
sisoe5 1.000 0.855 0.849 wsi7 =~
sisoe7 1.000 0.923 0.867 wsi10 =~
sisoe10 1.000 1.021 0.887 wsi12 =~
sisoe12 1.000 0.905 0.863
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.192 0.065 2.968 0.003 0.260 0.260 wsi5 (d3) 0.046 0.088 0.529 0.597 0.027 0.027 wsi7 ~
wad5 (c3) -0.030 0.025 -1.201 0.230 -0.065 -0.065 wsi5 0.308 0.082 3.751 0.000 0.285 0.285 wad10 ~
wad7 0.015 0.110 0.134 0.893 0.015 0.015 wsi7 (d3) 0.046 0.088 0.529 0.597 0.029 0.029 wsi10 ~
wad7 (c3) -0.030 0.025 -1.201 0.230 -0.043 -0.043 wsi7 0.371 0.079 4.672 0.000 0.335 0.335 wad12 ~
wad10 0.020 0.117 0.168 0.867 0.024 0.024 wsi10 (d3) 0.046 0.088 0.529 0.597 0.039 0.039 wsi12 ~
wad10 (c3) -0.030 0.025 -1.201 0.230 -0.050 -0.050 wsi10 0.289 0.066 4.395 0.000 0.325 0.325
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.428 0.119 3.591 0.000 0.252 0.252 .wad7 ~~
.wsi7 0.052 0.090 0.574 0.566 0.041 0.041 .wad10 ~~
.wsi10 0.298 0.113 2.645 0.008 0.207 0.207 .wad12 ~~
.wsi12 0.109 0.077 1.427 0.153 0.104 0.104 RIad ~~
RIsi 0.433 0.090 4.794 0.000 0.522 0.522
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhde5 1.741 0.090 19.313 0.000 1.741 0.689 .tadhde7 1.319 0.080 16.526 0.000 1.319 0.615 .tadhde10 1.193 0.081 14.732 0.000 1.193 0.551 .tadhde12 0.924 0.073 12.724 0.000 0.924 0.466 .sisoe5 0.699 0.035 19.703 0.000 0.699 0.695 .sisoe7 0.709 0.040 17.906 0.000 0.709 0.666 .sisoe10 0.824 0.043 19.163 0.000 0.824 0.716 .sisoe12 0.700 0.040 17.621 0.000 0.700 0.668 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 2.439 0.382 6.380 0.000 1.000 1.000 RIsi 0.282 0.065 4.356 0.000 1.000 1.000 wad5 3.939 0.559 7.046 0.000 1.000 1.000 wsi5 0.730 0.096 7.642 0.000 1.000 1.000 .wad7 1.999 0.296 6.748 0.000 0.928 0.928 .wsi7 0.788 0.110 7.154 0.000 0.924 0.924 .wad10 2.243 0.545 4.119 0.000 0.999 0.999 .wsi10 0.924 0.103 8.969 0.000 0.887 0.887 .wad12 1.490 0.381 3.915 0.000 0.998 0.998 .wsi12 0.736 0.084 8.794 0.000 0.898 0.898 .tadhde5 0.000 0.000 0.000 .tadhde7 0.000 0.000 0.000 .tadhde10 0.000 0.000 0.000 .tadhde12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMcomb.lag.c.fit.summary)
RICLPMcomb.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMcomb.lag.c.fit.summary, ses = "Low")
RICLPMcomb.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMcomb.lag.c.fit.summary, ses = "Middle")
RICLPMcomb.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMcomb.lag.c.fit.summary, ses = "High")
RICLPMcomb.lag.c.fit.summary.reg.high
%>% select(lhs, op, rhs, std.all, pvalue) %>% mutate_if(is.numeric, round, 4) RICLPMcomb.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMcomb.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhde5 + 1*tadhde7 + 1*tadhde10 + 1*tadhde12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*tadhde5
wad7 =~ 1*tadhde7
wad10 =~ 1*tadhde10
wad12 =~ 1*tadhde12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMcomb.ses.lag.c,
RICLPMcomb.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMcomb.lag.c.fit, RICLPMcomb.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust test statistics (MLR estimation and satorra.bentler.2010 LRT method): The chi-square difference test of these two nested models is significant (p=0.003083).
<- '
RICLPMcomb_hyp.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hye5 + 1*hye7 + 1*hye10 + 1*hye12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*hye5
wad7 =~ 1*hye7
wad10 =~ 1*hye10
wad12 =~ 1*hye12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Constrained lagged effects between the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMcomb_hyp.lag.c,
RICLPMcomb_hyp.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMcomb_hyp.lag.c.fit,
RICLPMcomb_hyp.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 75 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 8 High 8
Model Test User Model: Standard Robust Test Statistic 123.393 81.934 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.506 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 40.574 26.942 Low 17.292 11.482 High 65.527 43.510
Model Test Baseline Model:
Test statistic 5550.649 3150.159 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.762
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.985 0.986 Tucker-Lewis Index (TLI) 0.967 0.970
Robust Comparative Fit Index (CFI) 0.988 Robust Tucker-Lewis Index (TLI) 0.974
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -26663.352 -26663.352 Scaling correction factor 2.073 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.094 for the MLR correction
Akaike (AIC) 53512.704 53512.704 Bayesian (BIC) 54043.794 54043.794 Sample-size adjusted Bayesian (BIC) 53748.319 53748.319
Root Mean Square Error of Approximation:
RMSEA 0.054 0.038 90 Percent confidence interval - lower 0.043 0.029 90 Percent confidence interval - upper 0.065 0.048 P-value RMSEA <= 0.05 0.259 0.978
Robust RMSEA 0.047 90 Percent confidence interval - lower 0.033 90 Percent confidence interval - upper 0.062
Standardized Root Mean Square Residual:
SRMR 0.036 0.036
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hye5 1.000 0.873 0.588 hye7 1.000 0.873 0.583 hye10 1.000 0.873 0.688 hye12 1.000 0.873 0.660 RIsi =~
sisoe5 1.000 0.587 0.589 sisoe7 1.000 0.587 0.568 sisoe10 1.000 0.587 0.480 sisoe12 1.000 0.587 0.484 wad5 =~
hye5 1.000 1.202 0.809 wad7 =~
hye7 1.000 1.216 0.812 wad10 =~
hye10 1.000 0.921 0.726 wad12 =~
hye12 1.000 0.993 0.751 wsi5 =~
sisoe5 1.000 0.805 0.808 wsi7 =~
sisoe7 1.000 0.851 0.823 wsi10 =~
sisoe10 1.000 1.072 0.877 wsi12 =~
sisoe12 1.000 1.061 0.875
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.329 0.065 5.050 0.000 0.325 0.325 wsi5 (d1) -0.025 0.040 -0.631 0.528 -0.017 -0.017 wsi7 ~
wad5 (c1) 0.129 0.034 3.790 0.000 0.182 0.182 wsi5 0.048 0.101 0.474 0.635 0.045 0.045 wad10 ~
wad7 0.163 0.083 1.956 0.050 0.216 0.216 wsi7 (d1) -0.025 0.040 -0.631 0.528 -0.023 -0.023 wsi10 ~
wad7 (c1) 0.129 0.034 3.790 0.000 0.146 0.146 wsi7 0.155 0.088 1.769 0.077 0.123 0.123 wad12 ~
wad10 0.341 0.112 3.055 0.002 0.316 0.316 wsi10 (d1) -0.025 0.040 -0.631 0.528 -0.027 -0.027 wsi12 ~
wad10 (c1) 0.129 0.034 3.790 0.000 0.112 0.112 wsi10 0.465 0.056 8.238 0.000 0.470 0.470
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.251 0.074 3.399 0.001 0.260 0.260 .wad7 ~~
.wsi7 0.254 0.090 2.830 0.005 0.265 0.265 .wad10 ~~
.wsi10 0.181 0.057 3.177 0.001 0.192 0.192 .wad12 ~~
.wsi12 0.159 0.059 2.684 0.007 0.184 0.184 RIad ~~
RIsi 0.199 0.049 4.069 0.000 0.389 0.389
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hye5 1.272 0.054 23.564 0.000 1.272 0.857 .hye7 1.109 0.057 19.393 0.000 1.109 0.741 .hye10 0.731 0.047 15.645 0.000 0.731 0.576 .hye12 0.722 0.049 14.601 0.000 0.722 0.546 .sisoe5 0.727 0.037 19.702 0.000 0.727 0.730 .sisoe7 0.744 0.039 19.090 0.000 0.744 0.719 .sisoe10 0.813 0.046 17.807 0.000 0.813 0.665 .sisoe12 0.871 0.045 19.150 0.000 0.871 0.718 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.762 0.113 6.760 0.000 1.000 1.000 RIsi 0.344 0.072 4.766 0.000 1.000 1.000 wad5 1.445 0.142 10.154 0.000 1.000 1.000 wsi5 0.647 0.104 6.221 0.000 1.000 1.000 .wad7 1.326 0.172 7.702 0.000 0.897 0.897 .wsi7 0.696 0.097 7.201 0.000 0.961 0.961 .wad10 0.811 0.144 5.653 0.000 0.956 0.956 .wsi10 1.095 0.155 7.064 0.000 0.952 0.952 .wad12 0.891 0.133 6.697 0.000 0.903 0.903 .wsi12 0.838 0.076 11.084 0.000 0.744 0.744 .hye5 0.000 0.000 0.000 .hye7 0.000 0.000 0.000 .hye10 0.000 0.000 0.000 .hye12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hye5 1.000 1.066 0.605 hye7 1.000 1.066 0.656 hye10 1.000 1.066 0.659 hye12 1.000 1.066 0.629 RIsi =~
sisoe5 1.000 0.846 0.617 sisoe7 1.000 0.846 0.626 sisoe10 1.000 0.846 0.586 sisoe12 1.000 0.846 0.503 wad5 =~
hye5 1.000 1.402 0.796 wad7 =~
hye7 1.000 1.226 0.755 wad10 =~
hye10 1.000 1.217 0.752 wad12 =~
hye12 1.000 1.319 0.778 wsi5 =~
sisoe5 1.000 1.080 0.787 wsi7 =~
sisoe7 1.000 1.053 0.780 wsi10 =~
sisoe10 1.000 1.170 0.810 wsi12 =~
sisoe12 1.000 1.453 0.864
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.172 0.061 2.828 0.005 0.196 0.196 wsi5 (d2) 0.073 0.060 1.221 0.222 0.065 0.065 wsi7 ~
wad5 (c2) 0.067 0.039 1.737 0.082 0.089 0.089 wsi5 0.249 0.094 2.637 0.008 0.255 0.255 wad10 ~
wad7 0.103 0.084 1.219 0.223 0.103 0.103 wsi7 (d2) 0.073 0.060 1.221 0.222 0.063 0.063 wsi10 ~
wad7 (c2) 0.067 0.039 1.737 0.082 0.070 0.070 wsi7 0.239 0.098 2.438 0.015 0.215 0.215 wad12 ~
wad10 0.319 0.083 3.836 0.000 0.294 0.294 wsi10 (d2) 0.073 0.060 1.221 0.222 0.065 0.065 wsi12 ~
wad10 (c2) 0.067 0.039 1.737 0.082 0.056 0.056 wsi10 0.491 0.075 6.498 0.000 0.395 0.395
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.232 0.114 2.043 0.041 0.153 0.153 .wad7 ~~
.wsi7 0.337 0.115 2.937 0.003 0.279 0.279 .wad10 ~~
.wsi10 0.467 0.119 3.912 0.000 0.341 0.341 .wad12 ~~
.wsi12 0.411 0.109 3.763 0.000 0.249 0.249 RIad ~~
RIsi 0.401 0.090 4.451 0.000 0.445 0.445
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hye5 1.773 0.064 27.520 0.000 1.773 1.006 .hye7 1.382 0.060 22.844 0.000 1.382 0.850 .hye10 1.177 0.060 19.483 0.000 1.177 0.727 .hye12 1.151 0.063 18.177 0.000 1.151 0.678 .sisoe5 1.014 0.050 20.330 0.000 1.014 0.739 .sisoe7 1.042 0.050 20.853 0.000 1.042 0.772 .sisoe10 1.181 0.054 21.770 0.000 1.181 0.818 .sisoe12 1.252 0.063 19.969 0.000 1.252 0.745 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.137 0.128 8.890 0.000 1.000 1.000 RIsi 0.715 0.124 5.788 0.000 1.000 1.000 wad5 1.966 0.186 10.554 0.000 1.000 1.000 wsi5 1.166 0.251 4.653 0.000 1.000 1.000 .wad7 1.433 0.165 8.706 0.000 0.953 0.953 .wsi7 1.021 0.144 7.109 0.000 0.920 0.920 .wad10 1.454 0.177 8.216 0.000 0.981 0.981 .wsi10 1.286 0.160 8.062 0.000 0.940 0.940 .wad12 1.559 0.170 9.162 0.000 0.896 0.896 .wsi12 1.740 0.199 8.754 0.000 0.825 0.825 .hye5 0.000 0.000 0.000 .hye7 0.000 0.000 0.000 .hye10 0.000 0.000 0.000 .hye12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hye5 1.000 0.887 0.582 hye7 1.000 0.887 0.698 hye10 1.000 0.887 0.772 hye12 1.000 0.887 0.804 RIsi =~
sisoe5 1.000 0.520 0.522 sisoe7 1.000 0.520 0.490 sisoe10 1.000 0.520 0.450 sisoe12 1.000 0.520 0.492 wad5 =~
hye5 1.000 1.241 0.814 wad7 =~
hye7 1.000 0.909 0.716 wad10 =~
hye10 1.000 0.729 0.635 wad12 =~
hye12 1.000 0.656 0.594 wsi5 =~
sisoe5 1.000 0.850 0.853 wsi7 =~
sisoe7 1.000 0.925 0.872 wsi10 =~
sisoe10 1.000 1.032 0.893 wsi12 =~
sisoe12 1.000 0.919 0.870
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.248 0.050 4.954 0.000 0.339 0.339 wsi5 (d3) 0.029 0.054 0.527 0.598 0.027 0.027 wsi7 ~
wad5 (c3) -0.026 0.035 -0.741 0.459 -0.035 -0.035 wsi5 0.299 0.085 3.529 0.000 0.274 0.274 wad10 ~
wad7 0.034 0.077 0.439 0.661 0.042 0.042 wsi7 (d3) 0.029 0.054 0.527 0.598 0.036 0.036 wsi10 ~
wad7 (c3) -0.026 0.035 -0.741 0.459 -0.023 -0.023 wsi7 0.385 0.080 4.809 0.000 0.346 0.346 wad12 ~
wad10 -0.052 0.174 -0.300 0.765 -0.058 -0.058 wsi10 (d3) 0.029 0.054 0.527 0.598 0.045 0.045 wsi12 ~
wad10 (c3) -0.026 0.035 -0.741 0.459 -0.021 -0.021 wsi10 0.297 0.066 4.485 0.000 0.333 0.333
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.243 0.071 3.424 0.001 0.230 0.230 .wad7 ~~
.wsi7 0.009 0.047 0.200 0.841 0.012 0.012 .wad10 ~~
.wsi10 0.123 0.061 2.011 0.044 0.174 0.174 .wad12 ~~
.wsi12 0.033 0.040 0.832 0.405 0.058 0.058 RIad ~~
RIsi 0.206 0.045 4.592 0.000 0.446 0.446
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hye5 1.073 0.054 19.792 0.000 1.073 0.703 .hye7 0.796 0.047 16.946 0.000 0.796 0.627 .hye10 0.600 0.043 14.027 0.000 0.600 0.522 .hye12 0.470 0.041 11.542 0.000 0.470 0.426 .sisoe5 0.699 0.035 19.703 0.000 0.699 0.702 .sisoe7 0.709 0.040 17.897 0.000 0.709 0.668 .sisoe10 0.824 0.043 19.155 0.000 0.824 0.713 .sisoe12 0.700 0.040 17.624 0.000 0.700 0.663 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.787 0.116 6.783 0.000 1.000 1.000 RIsi 0.270 0.065 4.170 0.000 1.000 1.000 wad5 1.541 0.177 8.684 0.000 1.000 1.000 wsi5 0.723 0.096 7.513 0.000 1.000 1.000 .wad7 0.728 0.091 8.022 0.000 0.880 0.880 .wsi7 0.795 0.114 6.988 0.000 0.928 0.928 .wad10 0.530 0.140 3.776 0.000 0.997 0.997 .wsi10 0.937 0.104 9.041 0.000 0.880 0.880 .wad12 0.428 0.114 3.762 0.000 0.996 0.996 .wsi12 0.752 0.085 8.882 0.000 0.891 0.891 .hye5 0.000 0.000 0.000 .hye7 0.000 0.000 0.000 .hye10 0.000 0.000 0.000 .hye12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMcomb_hyp.lag.c.fit.summary)
RICLPMcomb_hyp.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMcomb_hyp.lag.c.fit.summary, ses = "Low")
RICLPMcomb_hyp.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMcomb_hyp.lag.c.fit.summary, ses = "Middle")
RICLPMcomb_hyp.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMcomb_hyp.lag.c.fit.summary, ses = "High")
RICLPMcomb_hyp.lag.c.fit.summary.reg.high
%>% select(lhs, op, rhs, std.all, pvalue) %>% mutate_if(is.numeric, round, 4) RICLPMcomb_hyp.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMcomb_hyp.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hye5 + 1*hye7 + 1*hye10 + 1*hye12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*hye5
wad7 =~ 1*hye7
wad10 =~ 1*hye10
wad12 =~ 1*hye12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMcomb_hyp.ses.lag.c,
RICLPMcomb_hyp.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMcomb_hyp.lag.c.fit, RICLPMcomb_hyp.ses.lag.c.fit, method = "satorra.bentler.2010")
The chi-square difference test of these two nested models is significant (p=0.003312).
<- '
RICLPMcomb_inat.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*ine5 + 1*ine7 + 1*ine10 + 1*ine12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*ine5
wad7 =~ 1*ine7
wad10 =~ 1*ine10
wad12 =~ 1*ine12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Constrained lagged effects between the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMcomb_inat.lag.c,
RICLPMcomb_inat.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMcomb_inat.lag.c.fit,
RICLPMcomb_inat.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 77 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 8 High 8
Model Test User Model: Standard Robust Test Statistic 142.574 86.791 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.643 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 36.612 22.288 Low 33.694 20.511 High 72.268 43.993
Model Test Baseline Model:
Test statistic 5507.670 2909.524 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.893
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.981 0.983 Tucker-Lewis Index (TLI) 0.959 0.964
Robust Comparative Fit Index (CFI) 0.985 Robust Tucker-Lewis Index (TLI) 0.968
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -26068.939 -26068.939 Scaling correction factor 2.220 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.251 for the MLR correction
Akaike (AIC) 52323.877 52323.877 Bayesian (BIC) 52854.968 52854.968 Sample-size adjusted Bayesian (BIC) 52559.492 52559.492
Root Mean Square Error of Approximation:
RMSEA 0.060 0.041 90 Percent confidence interval - lower 0.049 0.032 90 Percent confidence interval - upper 0.070 0.050 P-value RMSEA <= 0.05 0.060 0.958
Robust RMSEA 0.052 90 Percent confidence interval - lower 0.037 90 Percent confidence interval - upper 0.067
Standardized Root Mean Square Residual:
SRMR 0.038 0.038
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
ine5 1.000 0.815 0.614 ine7 1.000 0.815 0.642 ine10 1.000 0.815 0.644 ine12 1.000 0.815 0.605 RIsi =~
sisoe5 1.000 0.599 0.596 sisoe7 1.000 0.599 0.577 sisoe10 1.000 0.599 0.493 sisoe12 1.000 0.599 0.497 wad5 =~
ine5 1.000 1.048 0.790 wad7 =~
ine7 1.000 0.973 0.767 wad10 =~
ine10 1.000 0.969 0.765 wad12 =~
ine12 1.000 1.071 0.796 wsi5 =~
sisoe5 1.000 0.807 0.803 wsi7 =~
sisoe7 1.000 0.848 0.817 wsi10 =~
sisoe10 1.000 1.057 0.870 wsi12 =~
sisoe12 1.000 1.046 0.868
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.266 0.090 2.953 0.003 0.287 0.287 wsi5 (d1) -0.040 0.044 -0.898 0.369 -0.033 -0.033 wsi7 ~
wad5 (c1) 0.070 0.039 1.777 0.076 0.086 0.086 wsi5 0.085 0.094 0.905 0.365 0.081 0.081 wad10 ~
wad7 0.091 0.105 0.865 0.387 0.091 0.091 wsi7 (d1) -0.040 0.044 -0.898 0.369 -0.035 -0.035 wsi10 ~
wad7 (c1) 0.070 0.039 1.777 0.076 0.064 0.064 wsi7 0.174 0.088 1.966 0.049 0.139 0.139 wad12 ~
wad10 0.357 0.101 3.549 0.000 0.323 0.323 wsi10 (d1) -0.040 0.044 -0.898 0.369 -0.039 -0.039 wsi12 ~
wad10 (c1) 0.070 0.039 1.777 0.076 0.065 0.065 wsi10 0.458 0.060 7.653 0.000 0.463 0.463
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.202 0.071 2.843 0.004 0.238 0.238 .wad7 ~~
.wsi7 0.163 0.068 2.402 0.016 0.208 0.208 .wad10 ~~
.wsi10 0.221 0.076 2.903 0.004 0.219 0.219 .wad12 ~~
.wsi12 0.231 0.058 3.960 0.000 0.248 0.248 RIad ~~
RIsi 0.286 0.058 4.961 0.000 0.587 0.587
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .ine5 0.769 0.049 15.593 0.000 0.769 0.579 .ine7 0.683 0.048 14.331 0.000 0.683 0.538 .ine10 0.633 0.047 13.388 0.000 0.633 0.500 .ine12 0.662 0.050 13.270 0.000 0.662 0.492 .sisoe5 0.727 0.037 19.702 0.000 0.727 0.723 .sisoe7 0.743 0.039 19.078 0.000 0.743 0.715 .sisoe10 0.812 0.045 17.861 0.000 0.812 0.668 .sisoe12 0.871 0.045 19.145 0.000 0.871 0.723 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.664 0.107 6.185 0.000 1.000 1.000 RIsi 0.359 0.071 5.027 0.000 1.000 1.000 wad5 1.099 0.152 7.210 0.000 1.000 1.000 wsi5 0.652 0.100 6.507 0.000 1.000 1.000 .wad7 0.871 0.114 7.633 0.000 0.921 0.921 .wsi7 0.707 0.098 7.211 0.000 0.983 0.983 .wad10 0.931 0.161 5.801 0.000 0.992 0.992 .wsi10 1.087 0.153 7.081 0.000 0.972 0.972 .wad12 1.033 0.141 7.340 0.000 0.900 0.900 .wsi12 0.841 0.077 10.890 0.000 0.769 0.769 .ine5 0.000 0.000 0.000 .ine7 0.000 0.000 0.000 .ine10 0.000 0.000 0.000 .ine12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
ine5 1.000 1.029 0.633 ine7 1.000 1.029 0.672 ine10 1.000 1.029 0.691 ine12 1.000 1.029 0.649 RIsi =~
sisoe5 1.000 0.829 0.606 sisoe7 1.000 0.829 0.616 sisoe10 1.000 0.829 0.573 sisoe12 1.000 0.829 0.493 wad5 =~
ine5 1.000 1.258 0.774 wad7 =~
ine7 1.000 1.133 0.740 wad10 =~
ine10 1.000 1.076 0.723 wad12 =~
ine12 1.000 1.207 0.761 wsi5 =~
sisoe5 1.000 1.090 0.796 wsi7 =~
sisoe7 1.000 1.062 0.788 wsi10 =~
sisoe10 1.000 1.185 0.819 wsi12 =~
sisoe12 1.000 1.462 0.870
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.087 0.076 1.145 0.252 0.097 0.097 wsi5 (d2) 0.090 0.053 1.704 0.088 0.086 0.086 wsi7 ~
wad5 (c2) 0.106 0.046 2.302 0.021 0.126 0.126 wsi5 0.233 0.101 2.306 0.021 0.239 0.239 wad10 ~
wad7 0.054 0.094 0.573 0.566 0.057 0.057 wsi7 (d2) 0.090 0.053 1.704 0.088 0.089 0.089 wsi10 ~
wad7 (c2) 0.106 0.046 2.302 0.021 0.102 0.102 wsi7 0.239 0.106 2.247 0.025 0.214 0.214 wad12 ~
wad10 0.328 0.089 3.678 0.000 0.292 0.292 wsi10 (d2) 0.090 0.053 1.704 0.088 0.088 0.088 wsi12 ~
wad10 (c2) 0.106 0.046 2.302 0.021 0.078 0.078 wsi10 0.492 0.072 6.799 0.000 0.399 0.399
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.519 0.169 3.074 0.002 0.378 0.378 .wad7 ~~
.wsi7 0.364 0.107 3.414 0.001 0.322 0.322 .wad10 ~~
.wsi10 0.369 0.116 3.187 0.001 0.302 0.302 .wad12 ~~
.wsi12 0.452 0.107 4.229 0.000 0.301 0.301 RIad ~~
RIsi 0.466 0.087 5.382 0.000 0.546 0.546
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .ine5 1.197 0.059 20.267 0.000 1.197 0.737 .ine7 0.958 0.057 16.744 0.000 0.958 0.626 .ine10 0.951 0.055 17.304 0.000 0.951 0.639 .ine12 0.906 0.059 15.281 0.000 0.906 0.571 .sisoe5 1.014 0.050 20.330 0.000 1.014 0.741 .sisoe7 1.042 0.050 20.840 0.000 1.042 0.773 .sisoe10 1.181 0.054 21.741 0.000 1.181 0.816 .sisoe12 1.252 0.063 19.963 0.000 1.252 0.745 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.058 0.133 7.955 0.000 1.000 1.000 RIsi 0.688 0.133 5.165 0.000 1.000 1.000 wad5 1.583 0.203 7.814 0.000 1.000 1.000 wsi5 1.187 0.258 4.608 0.000 1.000 1.000 .wad7 1.254 0.177 7.080 0.000 0.977 0.977 .wsi7 1.019 0.147 6.943 0.000 0.904 0.904 .wad10 1.140 0.171 6.679 0.000 0.985 0.985 .wsi10 1.305 0.158 8.256 0.000 0.929 0.929 .wad12 1.298 0.148 8.772 0.000 0.890 0.890 .wsi12 1.741 0.201 8.647 0.000 0.815 0.815 .ine5 0.000 0.000 0.000 .ine7 0.000 0.000 0.000 .ine10 0.000 0.000 0.000 .ine12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
ine5 1.000 0.776 0.621 ine7 1.000 0.776 0.702 ine10 1.000 0.776 0.626 ine12 1.000 0.776 0.726 RIsi =~
sisoe5 1.000 0.544 0.542 sisoe7 1.000 0.544 0.509 sisoe10 1.000 0.544 0.472 sisoe12 1.000 0.544 0.517 wad5 =~
ine5 1.000 0.979 0.784 wad7 =~
ine7 1.000 0.787 0.712 wad10 =~
ine10 1.000 0.966 0.780 wad12 =~
ine12 1.000 0.735 0.688 wsi5 =~
sisoe5 1.000 0.844 0.840 wsi7 =~
sisoe7 1.000 0.921 0.861 wsi10 =~
sisoe10 1.000 1.016 0.881 wsi12 =~
sisoe12 1.000 0.901 0.856
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.109 0.079 1.381 0.167 0.136 0.136 wsi5 (d3) 0.031 0.044 0.688 0.492 0.033 0.033 wsi7 ~
wad5 (c3) -0.052 0.050 -1.046 0.296 -0.056 -0.056 wsi5 0.295 0.083 3.558 0.000 0.271 0.271 wad10 ~
wad7 -0.028 0.135 -0.207 0.836 -0.023 -0.023 wsi7 (d3) 0.031 0.044 0.688 0.492 0.029 0.029 wsi10 ~
wad7 (c3) -0.052 0.050 -1.046 0.296 -0.041 -0.041 wsi7 0.367 0.082 4.488 0.000 0.333 0.333 wad12 ~
wad10 0.094 0.067 1.393 0.164 0.123 0.123 wsi10 (d3) 0.031 0.044 0.688 0.492 0.042 0.042 wsi12 ~
wad10 (c3) -0.052 0.050 -1.046 0.296 -0.056 -0.056 wsi10 0.284 0.067 4.232 0.000 0.320 0.320
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.176 0.059 3.007 0.003 0.213 0.213 .wad7 ~~
.wsi7 0.034 0.053 0.655 0.512 0.050 0.050 .wad10 ~~
.wsi10 0.193 0.071 2.717 0.007 0.209 0.209 .wad12 ~~
.wsi12 0.102 0.043 2.388 0.017 0.163 0.163 RIad ~~
RIsi 0.215 0.048 4.476 0.000 0.510 0.510
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .ine5 0.666 0.045 14.671 0.000 0.666 0.533 .ine7 0.517 0.041 12.596 0.000 0.517 0.468 .ine10 0.593 0.047 12.664 0.000 0.593 0.478 .ine12 0.455 0.039 11.737 0.000 0.455 0.426 .sisoe5 0.699 0.035 19.703 0.000 0.699 0.696 .sisoe7 0.709 0.040 17.923 0.000 0.709 0.663 .sisoe10 0.824 0.043 19.159 0.000 0.824 0.715 .sisoe12 0.701 0.040 17.610 0.000 0.701 0.666 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.602 0.096 6.270 0.000 1.000 1.000 RIsi 0.296 0.065 4.538 0.000 1.000 1.000 wad5 0.958 0.146 6.565 0.000 1.000 1.000 wsi5 0.713 0.094 7.572 0.000 1.000 1.000 .wad7 0.606 0.105 5.757 0.000 0.979 0.979 .wsi7 0.789 0.114 6.921 0.000 0.930 0.930 .wad10 0.931 0.176 5.288 0.000 0.999 0.999 .wsi10 0.917 0.103 8.921 0.000 0.889 0.889 .wad12 0.530 0.107 4.970 0.000 0.981 0.981 .wsi12 0.731 0.085 8.654 0.000 0.902 0.902 .ine5 0.000 0.000 0.000 .ine7 0.000 0.000 0.000 .ine10 0.000 0.000 0.000 .ine12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMcomb_inat.lag.c.fit.summary)
RICLPMcomb_inat.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMcomb_inat.lag.c.fit.summary, ses = "Low")
RICLPMcomb_inat.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMcomb_inat.lag.c.fit.summary, ses = "Middle")
RICLPMcomb_inat.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMcomb_inat.lag.c.fit.summary, ses = "High")
RICLPMcomb_inat.lag.c.fit.summary.reg.high
%>% select(lhs, op, rhs, std.all, pvalue) %>% mutate_if(is.numeric, round, 4) RICLPMcomb_hyp.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMcomb_inat.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*ine5 + 1*ine7 + 1*ine10 + 1*ine12 #x
RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y
# Create within-person centered variables
wad5 =~ 1*ine5
wad7 =~ 1*ine7
wad10 =~ 1*ine10
wad12 =~ 1*ine12
wsi5 =~ 1*sisoe5
wsi7 =~ 1*sisoe7
wsi10 =~ 1*sisoe10
wsi12 =~ 1*sisoe12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMcomb_inat.ses.lag.c,
RICLPMcomb_inat.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMcomb_inat.lag.c.fit, RICLPMcomb_inat.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is significant (p=0.01348),
<- '
RICLPM.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhdem5 + 1*tadhdem7 + 1*tadhdem10 + 1*tadhdem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*tadhdem5
wad7 =~ 1*tadhdem7
wad10 =~ 1*tadhdem10
wad12 =~ 1*tadhdem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Constrained lagged effects between the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPM.lag.c,
RICLPM.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPM.lag.c.fit,
RICLPM.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 328 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 10 High 8
Model Test User Model: Standard Robust Test Statistic 131.241 85.355 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.538 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 45.902 29.853 Low 62.316 40.528 High 23.024 14.974
Model Test Baseline Model:
Test statistic 6402.441 3691.661 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.734
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.985 0.987 Tucker-Lewis Index (TLI) 0.969 0.972
Robust Comparative Fit Index (CFI) 0.989 Robust Tucker-Lewis Index (TLI) 0.975
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -36006.915 -36006.915 Scaling correction factor 1.847 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 1.923 for the MLR correction
Akaike (AIC) 72199.830 72199.830 Bayesian (BIC) 72730.921 72730.921 Sample-size adjusted Bayesian (BIC) 72435.445 72435.445
Root Mean Square Error of Approximation:
RMSEA 0.056 0.040 90 Percent confidence interval - lower 0.046 0.031 90 Percent confidence interval - upper 0.067 0.049 P-value RMSEA <= 0.05 0.152 0.962
Robust RMSEA 0.050 90 Percent confidence interval - lower 0.035 90 Percent confidence interval - upper 0.064
Standardized Root Mean Square Residual:
SRMR 0.034 0.034
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdem5 1.000 2.489 0.635 tadhdem7 1.000 2.489 0.696 tadhdem10 1.000 2.489 0.771 tadhdem12 1.000 2.489 0.744 RIsi =~
sisoem5 1.000 0.723 0.537 sisoem7 1.000 0.723 0.524 sisoem10 1.000 0.723 0.493 sisoem12 1.000 0.723 0.487 wad5 =~
tadhdem5 1.000 3.029 0.773 wad7 =~
tadhdem7 1.000 2.566 0.718 wad10 =~
tadhdem10 1.000 2.054 0.636 wad12 =~
tadhdem12 1.000 2.233 0.668 wsi5 =~
sisoem5 1.000 1.135 0.843 wsi7 =~
sisoem7 1.000 1.175 0.852 wsi10 =~
sisoem10 1.000 1.275 0.870 wsi12 =~
sisoem12 1.000 1.296 0.873
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.264 0.068 3.880 0.000 0.311 0.311 wsi5 (d1) 0.005 0.097 0.049 0.961 0.002 0.002 wsi7 ~
wad5 (c1) 0.020 0.021 0.964 0.335 0.052 0.052 wsi5 0.257 0.092 2.807 0.005 0.248 0.248 wad10 ~
wad7 0.004 0.106 0.037 0.971 0.005 0.005 wsi7 (d1) 0.005 0.097 0.049 0.961 0.003 0.003 wsi10 ~
wad7 (c1) 0.020 0.021 0.964 0.335 0.041 0.041 wsi7 0.308 0.096 3.219 0.001 0.284 0.284 wad12 ~
wad10 0.303 0.123 2.465 0.014 0.278 0.278 wsi10 (d1) 0.005 0.097 0.049 0.961 0.003 0.003 wsi12 ~
wad10 (c1) 0.020 0.021 0.964 0.335 0.032 0.032 wsi10 0.509 0.063 8.135 0.000 0.500 0.500
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.947 0.279 3.391 0.001 0.275 0.275 .wad7 ~~
.wsi7 0.309 0.214 1.448 0.148 0.112 0.112 .wad10 ~~
.wsi10 0.411 0.183 2.254 0.024 0.164 0.164 .wad12 ~~
.wsi12 0.374 0.145 2.570 0.010 0.156 0.156 RIad ~~
RIsi 0.929 0.184 5.050 0.000 0.516 0.516
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdem5 3.190 0.142 22.499 0.000 3.190 0.814 .tadhdem7 2.604 0.136 19.111 0.000 2.604 0.728 .tadhdem10 1.926 0.120 16.046 0.000 1.926 0.597 .tadhdem12 1.949 0.123 15.833 0.000 1.949 0.583 .sisoem5 0.902 0.049 18.330 0.000 0.902 0.671 .sisoem7 0.857 0.052 16.477 0.000 0.857 0.621 .sisoem10 0.967 0.055 17.688 0.000 0.967 0.660 .sisoem12 0.969 0.056 17.347 0.000 0.969 0.653 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 6.196 0.795 7.790 0.000 1.000 1.000 RIsi 0.522 0.105 4.984 0.000 1.000 1.000 wad5 9.173 0.912 10.061 0.000 1.000 1.000 wsi5 1.287 0.178 7.213 0.000 1.000 1.000 .wad7 5.945 0.687 8.648 0.000 0.903 0.903 .wsi7 1.282 0.171 7.483 0.000 0.929 0.929 .wad10 4.219 0.926 4.557 0.000 1.000 1.000 .wsi10 1.486 0.177 8.393 0.000 0.914 0.914 .wad12 4.600 0.604 7.622 0.000 0.922 0.922 .wsi12 1.249 0.116 10.741 0.000 0.744 0.744 .tadhdem5 0.000 0.000 0.000 .tadhdem7 0.000 0.000 0.000 .tadhdem10 0.000 0.000 0.000 .tadhdem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdem5 1.000 2.676 0.626 tadhdem7 1.000 2.676 0.666 tadhdem10 1.000 2.676 0.688 tadhdem12 1.000 2.676 0.690 RIsi =~
sisoem5 1.000 1.202 0.701 sisoem7 1.000 1.202 0.679 sisoem10 1.000 1.202 0.619 sisoem12 1.000 1.202 0.588 wad5 =~
tadhdem5 1.000 3.331 0.780 wad7 =~
tadhdem7 1.000 2.998 0.746 wad10 =~
tadhdem10 1.000 2.821 0.726 wad12 =~
tadhdem12 1.000 2.806 0.724 wsi5 =~
sisoem5 1.000 1.222 0.713 wsi7 =~
sisoem7 1.000 1.301 0.734 wsi10 =~
sisoem10 1.000 1.527 0.786 wsi12 =~
sisoem12 1.000 1.652 0.809
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.224 0.069 3.230 0.001 0.249 0.249 wsi5 (d2) 0.121 0.117 1.032 0.302 0.049 0.049 wsi7 ~
wad5 (c2) 0.056 0.025 2.292 0.022 0.144 0.144 wsi5 0.166 0.108 1.545 0.122 0.156 0.156 wad10 ~
wad7 0.130 0.102 1.275 0.202 0.138 0.138 wsi7 (d2) 0.121 0.117 1.032 0.302 0.056 0.056 wsi10 ~
wad7 (c2) 0.056 0.025 2.292 0.022 0.110 0.110 wsi7 0.118 0.121 0.978 0.328 0.101 0.101 wad12 ~
wad10 0.395 0.083 4.748 0.000 0.397 0.397 wsi10 (d2) 0.121 0.117 1.032 0.302 0.066 0.066 wsi12 ~
wad10 (c2) 0.056 0.025 2.292 0.022 0.096 0.096 wsi10 0.405 0.079 5.102 0.000 0.374 0.374
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.622 0.249 2.497 0.013 0.153 0.153 .wad7 ~~
.wsi7 0.925 0.305 3.029 0.002 0.252 0.252 .wad10 ~~
.wsi10 1.273 0.313 4.063 0.000 0.304 0.304 .wad12 ~~
.wsi12 1.238 0.261 4.736 0.000 0.324 0.324 RIad ~~
RIsi 1.398 0.321 4.355 0.000 0.434 0.434
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdem5 4.326 0.156 27.785 0.000 4.326 1.013 .tadhdem7 3.405 0.150 22.724 0.000 3.405 0.847 .tadhdem10 2.993 0.145 20.689 0.000 2.993 0.770 .tadhdem12 2.804 0.146 19.221 0.000 2.804 0.723 .sisoem5 1.228 0.061 19.977 0.000 1.228 0.716 .sisoem7 1.291 0.067 19.299 0.000 1.291 0.729 .sisoem10 1.379 0.073 18.939 0.000 1.379 0.710 .sisoem12 1.385 0.076 18.272 0.000 1.385 0.678 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 7.159 0.906 7.900 0.000 1.000 1.000 RIsi 1.446 0.236 6.120 0.000 1.000 1.000 wad5 11.093 0.840 13.210 0.000 1.000 1.000 wsi5 1.493 0.260 5.741 0.000 1.000 1.000 .wad7 8.379 0.938 8.935 0.000 0.932 0.932 .wsi7 1.604 0.221 7.247 0.000 0.948 0.948 .wad10 7.746 0.925 8.376 0.000 0.973 0.973 .wsi10 2.265 0.252 8.999 0.000 0.971 0.971 .wad12 6.464 0.559 11.558 0.000 0.821 0.821 .wsi12 2.259 0.227 9.969 0.000 0.827 0.827 .tadhdem5 0.000 0.000 0.000 .tadhdem7 0.000 0.000 0.000 .tadhdem10 0.000 0.000 0.000 .tadhdem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdem5 1.000 2.225 0.611 tadhdem7 1.000 2.225 0.710 tadhdem10 1.000 2.225 0.769 tadhdem12 1.000 2.225 0.798 RIsi =~
sisoem5 1.000 0.609 0.487 sisoem7 1.000 0.609 0.472 sisoem10 1.000 0.609 0.452 sisoem12 1.000 0.609 0.479 wad5 =~
tadhdem5 1.000 2.886 0.792 wad7 =~
tadhdem7 1.000 2.206 0.704 wad10 =~
tadhdem10 1.000 1.852 0.640 wad12 =~
tadhdem12 1.000 1.678 0.602 wsi5 =~
sisoem5 1.000 1.093 0.873 wsi7 =~
sisoem7 1.000 1.136 0.881 wsi10 =~
sisoem10 1.000 1.202 0.892 wsi12 =~
sisoem12 1.000 1.117 0.878
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.256 0.060 4.247 0.000 0.335 0.335 wsi5 (d3) 0.081 0.091 0.892 0.372 0.040 0.040 wsi7 ~
wad5 (c3) 0.005 0.018 0.289 0.772 0.013 0.013 wsi5 0.310 0.085 3.652 0.000 0.298 0.298 wad10 ~
wad7 -0.040 0.098 -0.407 0.684 -0.047 -0.047 wsi7 (d3) 0.081 0.091 0.892 0.372 0.050 0.050 wsi10 ~
wad7 (c3) 0.005 0.018 0.289 0.772 0.010 0.010 wsi7 0.363 0.078 4.683 0.000 0.343 0.343 wad12 ~
wad10 0.176 0.133 1.317 0.188 0.194 0.194 wsi10 (d3) 0.081 0.091 0.892 0.372 0.058 0.058 wsi12 ~
wad10 (c3) 0.005 0.018 0.289 0.772 0.009 0.009 wsi10 0.378 0.068 5.590 0.000 0.407 0.407
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.688 0.260 2.645 0.008 0.218 0.218 .wad7 ~~
.wsi7 0.085 0.128 0.666 0.505 0.038 0.038 .wad10 ~~
.wsi10 0.519 0.167 3.105 0.002 0.249 0.249 .wad12 ~~
.wsi12 0.207 0.108 1.911 0.056 0.124 0.124 RIad ~~
RIsi 0.559 0.145 3.859 0.000 0.412 0.412
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdem5 2.600 0.131 19.827 0.000 2.600 0.714 .tadhdem7 1.886 0.115 16.334 0.000 1.886 0.602 .tadhdem10 1.661 0.108 15.340 0.000 1.661 0.574 .tadhdem12 1.354 0.103 13.133 0.000 1.354 0.486 .sisoem5 0.794 0.045 17.622 0.000 0.794 0.635 .sisoem7 0.813 0.048 17.000 0.000 0.813 0.631 .sisoem10 0.946 0.050 18.852 0.000 0.946 0.702 .sisoem12 0.790 0.048 16.611 0.000 0.790 0.621 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 4.951 0.752 6.587 0.000 1.000 1.000 RIsi 0.371 0.107 3.480 0.001 1.000 1.000 wad5 8.327 0.951 8.759 0.000 1.000 1.000 wsi5 1.194 0.184 6.480 0.000 1.000 1.000 .wad7 4.285 0.555 7.719 0.000 0.881 0.881 .wsi7 1.174 0.143 8.218 0.000 0.909 0.909 .wad10 3.414 0.721 4.734 0.000 0.996 0.996 .wsi10 1.273 0.129 9.880 0.000 0.881 0.881 .wad12 2.683 0.447 5.998 0.000 0.954 0.954 .wsi12 1.039 0.127 8.176 0.000 0.833 0.833 .tadhdem5 0.000 0.000 0.000 .tadhdem7 0.000 0.000 0.000 .tadhdem10 0.000 0.000 0.000 .tadhdem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPM.lag.c.fit.summary)
RICLPM.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPM.lag.c.fit.summary, ses = "Low")
RICLPM.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPM.lag.c.fit.summary, ses = "Middle")
RICLPM.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPM.lag.c.fit.summary, ses = "High") RICLPM.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPM.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhdem5 + 1*tadhdem7 + 1*tadhdem10 + 1*tadhdem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*tadhdem5
wad7 =~ 1*tadhdem7
wad10 =~ 1*tadhdem10
wad12 =~ 1*tadhdem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPM.ses.lag.c,
RICLPM.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPM.lag.c.fit, RICLPM.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust test statistics (MLR estimation and satorra.bentler.2010 LRT method): The chi-square difference test of these two nested models is non significant (p=0.5758).
For non-rubust statistics: The chi-square difference test of these two nested models is significant (p=0.009818), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - Low SES has significant ADHD -> social isolation cross-lag (p=0.022) - Non-significant cross-lags in middle SES. - Non-significant cross-lags in high SES. - Some differences in atuoregressive paths - but need to see what this means
<- '
RICLPM_hyp.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hyem5 + 1*hyem7 + 1*hyem10 + 1*hyem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*hyem5
wad7 =~ 1*hyem7
wad10 =~ 1*hyem10
wad12 =~ 1*hyem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Constrained lagged effects between the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPM_hyp.lag.c,
RICLPM_hyp.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPM_hyp.lag.c.fit,
RICLPM_hyp.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 166 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 10 High 8
Model Test User Model: Standard Robust Test Statistic 117.523 81.050 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.450 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 42.052 29.001 Low 50.062 34.525 High 25.410 17.524
Model Test Baseline Model:
Test statistic 6013.687 3674.936 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.636
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.987 0.988 Tucker-Lewis Index (TLI) 0.971 0.975
Robust Comparative Fit Index (CFI) 0.990 Robust Tucker-Lewis Index (TLI) 0.978
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -31652.274 -31652.274 Scaling correction factor 1.727 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 1.802 for the MLR correction
Akaike (AIC) 63490.548 63490.548 Bayesian (BIC) 64021.639 64021.639 Sample-size adjusted Bayesian (BIC) 63726.163 63726.163
Root Mean Square Error of Approximation:
RMSEA 0.052 0.038 90 Percent confidence interval - lower 0.041 0.028 90 Percent confidence interval - upper 0.063 0.048 P-value RMSEA <= 0.05 0.361 0.980
Robust RMSEA 0.046 90 Percent confidence interval - lower 0.032 90 Percent confidence interval - upper 0.060
Standardized Root Mean Square Residual:
SRMR 0.032 0.032
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyem5 1.000 1.411 0.606 hyem7 1.000 1.411 0.628 hyem10 1.000 1.411 0.741 hyem12 1.000 1.411 0.739 RIsi =~
sisoem5 1.000 0.739 0.551 sisoem7 1.000 0.739 0.538 sisoem10 1.000 0.739 0.502 sisoem12 1.000 0.739 0.496 wad5 =~
hyem5 1.000 1.854 0.796 wad7 =~
hyem7 1.000 1.749 0.778 wad10 =~
hyem10 1.000 1.280 0.672 wad12 =~
hyem12 1.000 1.286 0.674 wsi5 =~
sisoem5 1.000 1.120 0.835 wsi7 =~
sisoem7 1.000 1.159 0.843 wsi10 =~
sisoem10 1.000 1.272 0.865 wsi12 =~
sisoem12 1.000 1.293 0.868
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.317 0.064 4.960 0.000 0.336 0.336 wsi5 (d1) 0.034 0.058 0.586 0.558 0.022 0.022 wsi7 ~
wad5 (c1) 0.049 0.031 1.565 0.118 0.079 0.079 wsi5 0.234 0.093 2.501 0.012 0.226 0.226 wad10 ~
wad7 0.089 0.085 1.053 0.293 0.122 0.122 wsi7 (d1) 0.034 0.058 0.586 0.558 0.031 0.031 wsi10 ~
wad7 (c1) 0.049 0.031 1.565 0.118 0.068 0.068 wsi7 0.295 0.093 3.155 0.002 0.269 0.269 wad12 ~
wad10 0.297 0.114 2.603 0.009 0.295 0.295 wsi10 (d1) 0.034 0.058 0.586 0.558 0.034 0.034 wsi12 ~
wad10 (c1) 0.049 0.031 1.565 0.118 0.049 0.049 wsi10 0.501 0.060 8.347 0.000 0.493 0.493
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.473 0.146 3.236 0.001 0.228 0.228 .wad7 ~~
.wsi7 0.186 0.118 1.568 0.117 0.101 0.101 .wad10 ~~
.wsi10 0.289 0.114 2.549 0.011 0.187 0.187 .wad12 ~~
.wsi12 0.131 0.082 1.600 0.110 0.096 0.096 RIad ~~
RIsi 0.424 0.102 4.179 0.000 0.407 0.407
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyem5 2.071 0.084 24.532 0.000 2.071 0.889 .hyem7 1.711 0.086 19.960 0.000 1.711 0.761 .hyem10 1.103 0.071 15.566 0.000 1.103 0.579 .hyem12 1.044 0.070 14.856 0.000 1.044 0.547 .sisoem5 0.902 0.049 18.330 0.000 0.902 0.672 .sisoem7 0.856 0.052 16.478 0.000 0.856 0.623 .sisoem10 0.967 0.055 17.666 0.000 0.967 0.658 .sisoem12 0.970 0.056 17.360 0.000 0.970 0.651 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.991 0.258 7.710 0.000 1.000 1.000 RIsi 0.546 0.108 5.042 0.000 1.000 1.000 wad5 3.436 0.285 12.047 0.000 1.000 1.000 wsi5 1.254 0.177 7.104 0.000 1.000 1.000 .wad7 2.703 0.253 10.666 0.000 0.883 0.883 .wsi7 1.256 0.172 7.309 0.000 0.935 0.935 .wad10 1.612 0.293 5.500 0.000 0.983 0.983 .wsi10 1.485 0.177 8.411 0.000 0.918 0.918 .wad12 1.501 0.192 7.835 0.000 0.908 0.908 .wsi12 1.246 0.115 10.821 0.000 0.745 0.745 .hyem5 0.000 0.000 0.000 .hyem7 0.000 0.000 0.000 .hyem10 0.000 0.000 0.000 .hyem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyem5 1.000 1.569 0.604 hyem7 1.000 1.569 0.663 hyem10 1.000 1.569 0.685 hyem12 1.000 1.569 0.691 RIsi =~
sisoem5 1.000 1.208 0.704 sisoem7 1.000 1.208 0.683 sisoem10 1.000 1.208 0.620 sisoem12 1.000 1.208 0.591 wad5 =~
hyem5 1.000 2.070 0.797 wad7 =~
hyem7 1.000 1.773 0.749 wad10 =~
hyem10 1.000 1.667 0.728 wad12 =~
hyem12 1.000 1.640 0.722 wsi5 =~
sisoem5 1.000 1.219 0.710 wsi7 =~
sisoem7 1.000 1.291 0.730 wsi10 =~
sisoem10 1.000 1.527 0.784 wsi12 =~
sisoem12 1.000 1.648 0.806
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.215 0.054 4.010 0.000 0.251 0.251 wsi5 (d2) 0.059 0.065 0.905 0.366 0.041 0.041 wsi7 ~
wad5 (c2) 0.058 0.035 1.653 0.098 0.094 0.094 wsi5 0.173 0.107 1.618 0.106 0.164 0.164 wad10 ~
wad7 0.118 0.078 1.500 0.134 0.125 0.125 wsi7 (d2) 0.059 0.065 0.905 0.366 0.046 0.046 wsi10 ~
wad7 (c2) 0.058 0.035 1.653 0.098 0.068 0.068 wsi7 0.136 0.121 1.130 0.259 0.115 0.115 wad12 ~
wad10 0.288 0.076 3.784 0.000 0.293 0.293 wsi10 (d2) 0.059 0.065 0.905 0.366 0.055 0.055 wsi12 ~
wad10 (c2) 0.058 0.035 1.653 0.098 0.059 0.059 wsi10 0.415 0.079 5.263 0.000 0.385 0.385
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.128 0.131 0.972 0.331 0.051 0.051 .wad7 ~~
.wsi7 0.401 0.154 2.608 0.009 0.185 0.185 .wad10 ~~
.wsi10 0.712 0.192 3.701 0.000 0.285 0.285 .wad12 ~~
.wsi12 0.687 0.151 4.536 0.000 0.293 0.293 RIad ~~
RIsi 0.703 0.168 4.194 0.000 0.371 0.371
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyem5 2.767 0.096 28.963 0.000 2.767 1.065 .hyem7 2.143 0.088 24.448 0.000 2.143 0.905 .hyem10 1.714 0.085 20.081 0.000 1.714 0.748 .hyem12 1.607 0.085 18.806 0.000 1.607 0.708 .sisoem5 1.228 0.061 19.978 0.000 1.228 0.716 .sisoem7 1.292 0.067 19.297 0.000 1.292 0.731 .sisoem10 1.380 0.073 18.947 0.000 1.380 0.709 .sisoem12 1.386 0.076 18.276 0.000 1.386 0.679 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 2.463 0.243 10.142 0.000 1.000 1.000 RIsi 1.459 0.233 6.275 0.000 1.000 1.000 wad5 4.284 0.284 15.078 0.000 1.000 1.000 wsi5 1.485 0.260 5.716 0.000 1.000 1.000 .wad7 2.937 0.263 11.153 0.000 0.934 0.934 .wsi7 1.605 0.215 7.451 0.000 0.963 0.963 .wad10 2.724 0.274 9.946 0.000 0.980 0.980 .wsi10 2.282 0.252 9.039 0.000 0.979 0.979 .wad12 2.424 0.203 11.954 0.000 0.902 0.902 .wsi12 2.266 0.225 10.063 0.000 0.835 0.835 .hyem5 0.000 0.000 0.000 .hyem7 0.000 0.000 0.000 .hyem10 0.000 0.000 0.000 .hyem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyem5 1.000 1.286 0.574 hyem7 1.000 1.286 0.665 hyem10 1.000 1.286 0.783 hyem12 1.000 1.286 0.826 RIsi =~
sisoem5 1.000 0.603 0.482 sisoem7 1.000 0.603 0.469 sisoem10 1.000 0.603 0.448 sisoem12 1.000 0.603 0.474 wad5 =~
hyem5 1.000 1.836 0.819 wad7 =~
hyem7 1.000 1.442 0.746 wad10 =~
hyem10 1.000 1.023 0.623 wad12 =~
hyem12 1.000 0.877 0.563 wsi5 =~
sisoem5 1.000 1.096 0.876 wsi7 =~
sisoem7 1.000 1.136 0.883 wsi10 =~
sisoem10 1.000 1.204 0.894 wsi12 =~
sisoem12 1.000 1.120 0.880
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.313 0.048 6.465 0.000 0.398 0.398 wsi5 (d3) 0.028 0.058 0.491 0.624 0.022 0.022 wsi7 ~
wad5 (c3) 0.009 0.028 0.317 0.751 0.015 0.015 wsi5 0.311 0.086 3.626 0.000 0.301 0.301 wad10 ~
wad7 0.018 0.084 0.216 0.829 0.026 0.026 wsi7 (d3) 0.028 0.058 0.491 0.624 0.031 0.031 wsi10 ~
wad7 (c3) 0.009 0.028 0.317 0.751 0.011 0.011 wsi7 0.366 0.080 4.544 0.000 0.345 0.345 wad12 ~
wad10 0.087 0.165 0.529 0.597 0.102 0.102 wsi10 (d3) 0.028 0.058 0.491 0.624 0.039 0.039 wsi12 ~
wad10 (c3) 0.009 0.028 0.317 0.751 0.008 0.008 wsi10 0.379 0.068 5.561 0.000 0.408 0.408
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.379 0.155 2.448 0.014 0.188 0.188 .wad7 ~~
.wsi7 0.039 0.081 0.481 0.631 0.027 0.027 .wad10 ~~
.wsi10 0.236 0.094 2.507 0.012 0.204 0.204 .wad12 ~~
.wsi12 0.062 0.059 1.036 0.300 0.069 0.069 RIad ~~
RIsi 0.328 0.084 3.913 0.000 0.423 0.423
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyem5 1.650 0.080 20.546 0.000 1.650 0.736 .hyem7 1.201 0.071 16.862 0.000 1.201 0.622 .hyem10 0.872 0.062 14.148 0.000 0.872 0.530 .hyem12 0.668 0.057 11.663 0.000 0.668 0.429 .sisoem5 0.794 0.045 17.622 0.000 0.794 0.635 .sisoem7 0.813 0.048 17.007 0.000 0.813 0.632 .sisoem10 0.946 0.050 18.843 0.000 0.946 0.702 .sisoem12 0.790 0.048 16.623 0.000 0.790 0.621 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.653 0.240 6.892 0.000 1.000 1.000 RIsi 0.364 0.107 3.408 0.001 1.000 1.000 wad5 3.369 0.314 10.735 0.000 1.000 1.000 wsi5 1.202 0.185 6.497 0.000 1.000 1.000 .wad7 1.743 0.168 10.387 0.000 0.838 0.838 .wsi7 1.171 0.145 8.066 0.000 0.908 0.908 .wad10 1.045 0.243 4.308 0.000 0.998 0.998 .wsi10 1.276 0.130 9.807 0.000 0.880 0.880 .wad12 0.758 0.151 5.024 0.000 0.987 0.987 .wsi12 1.043 0.126 8.267 0.000 0.832 0.832 .hyem5 0.000 0.000 0.000 .hyem7 0.000 0.000 0.000 .hyem10 0.000 0.000 0.000 .hyem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPM_hyp.lag.c.fit.summary)
RICLPM_hyp.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPM_hyp.lag.c.fit.summary, ses = "Low")
RICLPM_hyp.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPM_hyp.lag.c.fit.summary, ses = "Middle")
RICLPM_hyp.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPM_hyp.lag.c.fit.summary, ses = "High") RICLPM_hyp.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPM_hyp.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hyem5 + 1*hyem7 + 1*hyem10 + 1*hyem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*hyem5
wad7 =~ 1*hyem7
wad10 =~ 1*hyem10
wad12 =~ 1*hyem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPM_hyp.ses.lag.c,
RICLPM_hyp.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPM_hyp.lag.c.fit, RICLPM_hyp.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is non significant (p=0.6128).
Fro non-robust statistics: The chi-square difference test of these two nested models is significant (p=0.02456), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - Low SES has non-sig (p=0.098) ADHD -> social isolation cross-lag - Non-significant cross-lags in middle and high SES.
Can conclude here that there are no SES differences - no differences in significance of the cross-lags
<- '
RICLPM_inat.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*inem5 + 1*inem7 + 1*inem10 + 1*inem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*inem5
wad7 =~ 1*inem7
wad10 =~ 1*inem10
wad12 =~ 1*inem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Constrained lagged effects between the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags.
wad7 ~ wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + wsi5
wad10 ~ wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + wsi7
wad12 ~ wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPM_inat.lag.c,
RICLPM_inat.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPM_inat.lag.c.fit,
RICLPM_inat.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 139 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 12
Number of observations per group:
Middle 738 Low 742 High 752 Number of missing patterns per group:
Middle 7 Low 9 High 8
Model Test User Model: Standard Robust Test Statistic 128.447 81.025 Degrees of freedom 39 39 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.585 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 38.272 24.142 Low 71.939 45.380 High 18.235 11.503
Model Test Baseline Model:
Test statistic 5654.024 3192.320 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 1.771
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.984 0.986 Tucker-Lewis Index (TLI) 0.965 0.971
Robust Comparative Fit Index (CFI) 0.988 Robust Tucker-Lewis Index (TLI) 0.974
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -30594.374 -30594.374 Scaling correction factor 1.937 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.009 for the MLR correction
Akaike (AIC) 61374.748 61374.748 Bayesian (BIC) 61905.838 61905.838 Sample-size adjusted Bayesian (BIC) 61610.363 61610.363
Root Mean Square Error of Approximation:
RMSEA 0.056 0.038 90 Percent confidence interval - lower 0.045 0.029 90 Percent confidence interval - upper 0.066 0.047 P-value RMSEA <= 0.05 0.186 0.984
Robust RMSEA 0.048 90 Percent confidence interval - lower 0.033 90 Percent confidence interval - upper 0.063
Standardized Root Mean Square Residual:
SRMR 0.033 0.033
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inem5 1.000 1.198 0.609 inem7 1.000 1.198 0.686 inem10 1.000 1.198 0.710 inem12 1.000 1.198 0.671 RIsi =~
sisoem5 1.000 0.730 0.540 sisoem7 1.000 0.730 0.528 sisoem10 1.000 0.730 0.501 sisoem12 1.000 0.730 0.495 wad5 =~
inem5 1.000 1.559 0.793 wad7 =~
inem7 1.000 1.270 0.727 wad10 =~
inem10 1.000 1.186 0.704 wad12 =~
inem12 1.000 1.325 0.742 wsi5 =~
sisoem5 1.000 1.139 0.842 wsi7 =~
sisoem7 1.000 1.173 0.849 wsi10 =~
sisoem10 1.000 1.262 0.866 wsi12 =~
sisoem12 1.000 1.282 0.869
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.199 0.071 2.779 0.005 0.244 0.244 wsi5 (d1) -0.039 0.049 -0.805 0.421 -0.035 -0.035 wsi7 ~
wad5 (c1) 0.002 0.037 0.059 0.953 0.003 0.003 wsi5 0.273 0.091 3.010 0.003 0.265 0.265 wad10 ~
wad7 -0.009 0.109 -0.087 0.931 -0.010 -0.010 wsi7 (d1) -0.039 0.049 -0.805 0.421 -0.039 -0.039 wsi10 ~
wad7 (c1) 0.002 0.037 0.059 0.953 0.002 0.002 wsi7 0.300 0.100 3.005 0.003 0.279 0.279 wad12 ~
wad10 0.325 0.105 3.096 0.002 0.291 0.291 wsi10 (d1) -0.039 0.049 -0.805 0.421 -0.037 -0.037 wsi12 ~
wad10 (c1) 0.002 0.037 0.059 0.953 0.002 0.002 wsi10 0.502 0.064 7.787 0.000 0.494 0.494
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.448 0.148 3.028 0.002 0.252 0.252 .wad7 ~~
.wsi7 0.109 0.112 0.979 0.328 0.078 0.078 .wad10 ~~
.wsi10 0.121 0.093 1.303 0.193 0.084 0.084 .wad12 ~~
.wsi12 0.248 0.083 2.991 0.003 0.176 0.176 RIad ~~
RIsi 0.506 0.099 5.104 0.000 0.579 0.579
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inem5 1.119 0.072 15.591 0.000 1.119 0.569 .inem7 0.893 0.066 13.475 0.000 0.893 0.512 .inem10 0.822 0.063 13.085 0.000 0.822 0.487 .inem12 0.908 0.066 13.781 0.000 0.908 0.508 .sisoem5 0.902 0.049 18.330 0.000 0.902 0.667 .sisoem7 0.857 0.052 16.484 0.000 0.857 0.620 .sisoem10 0.967 0.055 17.719 0.000 0.967 0.663 .sisoem12 0.970 0.056 17.351 0.000 0.970 0.657 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.435 0.219 6.546 0.000 1.000 1.000 RIsi 0.533 0.103 5.171 0.000 1.000 1.000 wad5 2.431 0.257 9.445 0.000 1.000 1.000 wsi5 1.298 0.175 7.396 0.000 1.000 1.000 .wad7 1.522 0.209 7.284 0.000 0.944 0.944 .wsi7 1.280 0.172 7.443 0.000 0.929 0.929 .wad10 1.405 0.280 5.021 0.000 0.998 0.998 .wsi10 1.469 0.179 8.223 0.000 0.922 0.922 .wad12 1.607 0.190 8.435 0.000 0.915 0.915 .wsi12 1.242 0.115 10.782 0.000 0.755 0.755 .inem5 0.000 0.000 0.000 .inem7 0.000 0.000 0.000 .inem10 0.000 0.000 0.000 .inem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inem5 1.000 1.269 0.600 inem7 1.000 1.269 0.624 inem10 1.000 1.269 0.637 inem12 1.000 1.269 0.628 RIsi =~
sisoem5 1.000 1.198 0.701 sisoem7 1.000 1.198 0.677 sisoem10 1.000 1.198 0.616 sisoem12 1.000 1.198 0.585 wad5 =~
inem5 1.000 1.694 0.800 wad7 =~
inem7 1.000 1.591 0.782 wad10 =~
inem10 1.000 1.535 0.771 wad12 =~
inem12 1.000 1.571 0.778 wsi5 =~
sisoem5 1.000 1.221 0.714 wsi7 =~
sisoem7 1.000 1.304 0.736 wsi10 =~
sisoem10 1.000 1.532 0.788 wsi12 =~
sisoem12 1.000 1.661 0.811
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.168 0.082 2.045 0.041 0.178 0.178 wsi5 (d2) 0.079 0.060 1.322 0.186 0.060 0.060 wsi7 ~
wad5 (c2) 0.124 0.045 2.744 0.006 0.161 0.161 wsi5 0.154 0.108 1.431 0.152 0.144 0.144 wad10 ~
wad7 0.132 0.103 1.282 0.200 0.137 0.137 wsi7 (d2) 0.079 0.060 1.322 0.186 0.067 0.067 wsi10 ~
wad7 (c2) 0.124 0.045 2.744 0.006 0.129 0.129 wsi7 0.122 0.122 1.003 0.316 0.104 0.104 wad12 ~
wad10 0.427 0.080 5.362 0.000 0.417 0.417 wsi10 (d2) 0.079 0.060 1.322 0.186 0.077 0.077 wsi12 ~
wad10 (c2) 0.124 0.045 2.744 0.006 0.114 0.114 wsi10 0.409 0.079 5.181 0.000 0.377 0.377
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.477 0.155 3.084 0.002 0.231 0.231 .wad7 ~~
.wsi7 0.539 0.171 3.156 0.002 0.273 0.273 .wad10 ~~
.wsi10 0.562 0.148 3.808 0.000 0.247 0.247 .wad12 ~~
.wsi12 0.578 0.136 4.239 0.000 0.273 0.273 RIad ~~
RIsi 0.701 0.167 4.205 0.000 0.461 0.461
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inem5 1.559 0.077 20.373 0.000 1.559 0.737 .inem7 1.262 0.077 16.488 0.000 1.262 0.620 .inem10 1.281 0.074 17.322 0.000 1.281 0.643 .inem12 1.195 0.076 15.813 0.000 1.195 0.592 .sisoem5 1.228 0.061 19.976 0.000 1.228 0.718 .sisoem7 1.291 0.067 19.293 0.000 1.291 0.729 .sisoem10 1.379 0.073 18.932 0.000 1.379 0.709 .sisoem12 1.385 0.076 18.266 0.000 1.385 0.676 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.610 0.270 5.961 0.000 1.000 1.000 RIsi 1.436 0.234 6.131 0.000 1.000 1.000 wad5 2.868 0.271 10.568 0.000 1.000 1.000 wsi5 1.490 0.258 5.773 0.000 1.000 1.000 .wad7 2.429 0.313 7.764 0.000 0.960 0.960 .wsi7 1.604 0.220 7.295 0.000 0.943 0.943 .wad10 2.288 0.270 8.478 0.000 0.971 0.971 .wsi10 2.263 0.253 8.935 0.000 0.965 0.965 .wad12 1.982 0.186 10.645 0.000 0.803 0.803 .wsi12 2.267 0.230 9.838 0.000 0.822 0.822 .inem5 0.000 0.000 0.000 .inem7 0.000 0.000 0.000 .inem10 0.000 0.000 0.000 .inem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inem5 1.000 1.097 0.620 inem7 1.000 1.097 0.713 inem10 1.000 1.097 0.680 inem12 1.000 1.097 0.704 RIsi =~
sisoem5 1.000 0.619 0.497 sisoem7 1.000 0.619 0.479 sisoem10 1.000 0.619 0.457 sisoem12 1.000 0.619 0.484 wad5 =~
inem5 1.000 1.390 0.785 wad7 =~
inem7 1.000 1.079 0.701 wad10 =~
inem10 1.000 1.182 0.733 wad12 =~
inem12 1.000 1.107 0.710 wsi5 =~
sisoem5 1.000 1.081 0.868 wsi7 =~
sisoem7 1.000 1.135 0.878 wsi10 =~
sisoem10 1.000 1.204 0.890 wsi12 =~
sisoem12 1.000 1.117 0.875
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 0.140 0.074 1.901 0.057 0.181 0.181 wsi5 (d3) 0.060 0.038 1.548 0.122 0.060 0.060 wsi7 ~
wad5 (c3) 0.011 0.032 0.355 0.722 0.014 0.014 wsi5 0.304 0.085 3.571 0.000 0.290 0.290 wad10 ~
wad7 -0.068 0.108 -0.628 0.530 -0.062 -0.062 wsi7 (d3) 0.060 0.038 1.548 0.122 0.057 0.057 wsi10 ~
wad7 (c3) 0.011 0.032 0.355 0.722 0.010 0.010 wsi7 0.371 0.079 4.682 0.000 0.350 0.350 wad12 ~
wad10 0.268 0.086 3.098 0.002 0.286 0.286 wsi10 (d3) 0.060 0.038 1.548 0.122 0.065 0.065 wsi12 ~
wad10 (c3) 0.011 0.032 0.355 0.722 0.012 0.012 wsi10 0.377 0.067 5.596 0.000 0.407 0.407
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.293 0.122 2.411 0.016 0.195 0.195 .wad7 ~~
.wsi7 0.049 0.065 0.760 0.447 0.043 0.043 .wad10 ~~
.wsi10 0.291 0.092 3.166 0.002 0.219 0.219 .wad12 ~~
.wsi12 0.156 0.065 2.412 0.016 0.145 0.145 RIad ~~
RIsi 0.229 0.072 3.166 0.002 0.337 0.337
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inem5 0.950 0.065 14.635 0.000 0.950 0.536 .inem7 0.684 0.057 12.085 0.000 0.684 0.444 .inem10 0.790 0.060 13.087 0.000 0.790 0.490 .inem12 0.687 0.058 11.905 0.000 0.687 0.440 .sisoem5 0.794 0.045 17.622 0.000 0.794 0.637 .sisoem7 0.813 0.048 16.992 0.000 0.813 0.629 .sisoem10 0.945 0.050 18.848 0.000 0.945 0.698 .sisoem12 0.791 0.048 16.597 0.000 0.791 0.619 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 1.204 0.190 6.328 0.000 1.000 1.000 RIsi 0.383 0.105 3.629 0.000 1.000 1.000 wad5 1.933 0.267 7.254 0.000 1.000 1.000 wsi5 1.169 0.181 6.449 0.000 1.000 1.000 .wad7 1.117 0.181 6.162 0.000 0.960 0.960 .wsi7 1.177 0.142 8.290 0.000 0.914 0.914 .wad10 1.388 0.233 5.956 0.000 0.993 0.993 .wsi10 1.272 0.129 9.876 0.000 0.877 0.877 .wad12 1.111 0.152 7.298 0.000 0.906 0.906 .wsi12 1.039 0.128 8.092 0.000 0.832 0.832 .inem5 0.000 0.000 0.000 .inem7 0.000 0.000 0.000 .inem10 0.000 0.000 0.000 .inem12 0.000 0.000 0.000 .sisoem5 0.000 0.000 0.000 .sisoem7 0.000 0.000 0.000 .sisoem10 0.000 0.000 0.000 .sisoem12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPM_inat.lag.c.fit.summary)
RICLPM_inat.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPM_inat.lag.c.fit.summary, ses = "Low")
RICLPM_inat.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPM_inat.lag.c.fit.summary, ses = "Middle")
RICLPM_inat.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPM_inat.lag.c.fit.summary, ses = "High") RICLPM_inat.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPM_inat.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*inem5 + 1*inem7 + 1*inem10 + 1*inem12 #x
RIsi =~ 1*sisoem5 + 1*sisoem7 + 1*sisoem10 + 1*sisoem12 #y
# Create within-person centered variables
wad5 =~ 1*inem5
wad7 =~ 1*inem7
wad10 =~ 1*inem10
wad12 =~ 1*inem12
wsi5 =~ 1*sisoem5
wsi7 =~ 1*sisoem7
wsi10 =~ 1*sisoem10
wsi12 =~ 1*sisoem12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a1,a1,a1)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b1,b1,b1)*wsi5
wad10 ~ c(a2,a2,a2)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b2,b2,b2)*wsi7
wad12 ~ c(a3,a3,a3)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b3,b3,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPM_inat.ses.lag.c,
RICLPM_inat.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPM_inat.lag.c.fit, RICLPM_inat.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is non significant (p=0.4287),
For non-robust statistics: The chi-square difference test of these two nested models is significant (p=0.002148), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - Low SES has significant (p=0.006) ADHD -> social isolation cross-lag - Non-significant cross-lags in middle and high SES.
Can conclude here that there are SES differences - low SES association remains only.
<- '
RICLPMt.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhdet5 + 1*tadhdet7 + 1*tadhdet10 + 1*tadhdet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*tadhdet5
wad7 =~ 1*tadhdet7
wad10 =~ 1*tadhdet10
wad12 =~ 1*tadhdet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Constrained lagged effects between the within-person centered variables. c(group1/middle, group2/low, group3/high) - different values across groups, but the same values within groups and across lags (all lags constrained).
wad7 ~ c(a1,a2,a3)*wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + c(b1,b2,b3)*wsi5
wad10 ~ c(a1,a2,a3)*wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + c(b1,b2,b3)*wsi7
wad12 ~ c(a1,a2,a3)*wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + c(b1,b2,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMt.lag.c,
RICLPMt.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMt.lag.c.fit,
RICLPMt.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 177 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 24
Number of observations per group: Used Total Middle 732 738 Low 742 742 High 750 752 Number of missing patterns per group:
Middle 21
Low 28
High 23
Model Test User Model: Standard Robust Test Statistic 175.977 79.873 Degrees of freedom 51 51 P-value (Chi-square) 0.000 0.006 Scaling correction factor 2.203 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 33.914 15.393 Low 49.357 22.402 High 92.706 42.078
Model Test Baseline Model:
Test statistic 2370.816 1031.395 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 2.299
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.945 0.970 Tucker-Lewis Index (TLI) 0.910 0.950
Robust Comparative Fit Index (CFI) 0.971 Robust Tucker-Lewis Index (TLI) 0.952
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -29649.212 -29649.212 Scaling correction factor 2.785 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 3.067 for the MLR correction
Akaike (AIC) 59460.424 59460.424 Bayesian (BIC) 59922.696 59922.696 Sample-size adjusted Bayesian (BIC) 59665.347 59665.347
Root Mean Square Error of Approximation:
RMSEA 0.057 0.028 90 Percent confidence interval - lower 0.048 0.019 90 Percent confidence interval - upper 0.067 0.035 P-value RMSEA <= 0.05 0.087 1.000
Robust RMSEA 0.041 90 Percent confidence interval - lower 0.022 90 Percent confidence interval - upper 0.058
Standardized Root Mean Square Residual:
SRMR 0.051 0.051
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdet5 1.000 0.880 0.366 tadhdet7 1.000 0.880 0.366 tadhdet10 1.000 0.880 0.445 tadhdet12 1.000 0.880 0.464 RIsi =~
sisoet5 1.000 0.588 0.509 sisoet7 1.000 0.588 0.474 sisoet10 1.000 0.588 0.416 sisoet12 1.000 0.588 0.433 wad5 =~
tadhdet5 1.000 2.239 0.931 wad7 =~
tadhdet7 1.000 2.242 0.931 wad10 =~
tadhdet10 1.000 1.770 0.895 wad12 =~
tadhdet12 1.000 1.679 0.886 wsi5 =~
sisoet5 1.000 0.995 0.861 wsi7 =~
sisoet7 1.000 1.092 0.881 wsi10 =~
sisoet10 1.000 1.285 0.909 wsi12 =~
sisoet12 1.000 1.223 0.901
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a1) 0.077 0.047 1.628 0.104 0.077 0.077 wsi5 (d1) -0.088 0.067 -1.311 0.190 -0.039 -0.039 wsi7 ~
wad5 (c1) 0.048 0.024 2.060 0.039 0.099 0.099 wsi5 (b1) 0.029 0.055 0.535 0.593 0.027 0.027 wad10 ~
wad7 (a1) 0.077 0.047 1.628 0.104 0.097 0.097 wsi7 (d1) -0.088 0.067 -1.311 0.190 -0.054 -0.054 wsi10 ~
wad7 (c1) 0.048 0.024 2.060 0.039 0.084 0.084 wsi7 (b1) 0.029 0.055 0.535 0.593 0.025 0.025 wad12 ~
wad10 (a1) 0.077 0.047 1.628 0.104 0.081 0.081 wsi10 (d1) -0.088 0.067 -1.311 0.190 -0.067 -0.067 wsi12 ~
wad10 (c1) 0.048 0.024 2.060 0.039 0.070 0.070 wsi10 (b1) 0.029 0.055 0.535 0.593 0.031 0.031
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.505 0.169 2.980 0.003 0.227 0.227 .wad7 ~~
.wsi7 0.369 0.164 2.250 0.024 0.152 0.152 .wad10 ~~
.wsi10 0.685 0.216 3.177 0.001 0.304 0.304 .wad12 ~~
.wsi12 0.619 0.217 2.856 0.004 0.304 0.304 RIad ~~
RIsi 0.291 0.080 3.618 0.000 0.562 0.562
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdet5 0.840 0.092 9.085 0.000 0.840 0.349 .tadhdet7 0.876 0.095 9.240 0.000 0.876 0.364 .tadhdet10 0.591 0.079 7.457 0.000 0.591 0.299 .tadhdet12 0.520 0.076 6.869 0.000 0.520 0.274 .sisoet5 0.560 0.044 12.729 0.000 0.560 0.485 .sisoet7 0.621 0.048 13.077 0.000 0.621 0.501 .sisoet10 0.601 0.056 10.759 0.000 0.601 0.425 .sisoet12 0.700 0.056 12.509 0.000 0.700 0.516 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.775 0.244 3.177 0.001 1.000 1.000 RIsi 0.346 0.074 4.696 0.000 1.000 1.000 wad5 5.012 0.940 5.335 0.000 1.000 1.000 wsi5 0.991 0.142 6.982 0.000 1.000 1.000 .wad7 4.995 0.742 6.728 0.000 0.994 0.994 .wsi7 1.179 0.151 7.826 0.000 0.988 0.988 .wad10 3.098 0.718 4.314 0.000 0.989 0.989 .wsi10 1.637 0.308 5.317 0.000 0.992 0.992 .wad12 2.799 0.591 4.739 0.000 0.992 0.992 .wsi12 1.485 0.189 7.854 0.000 0.993 0.993 .tadhdet5 0.000 0.000 0.000 .tadhdet7 0.000 0.000 0.000 .tadhdet10 0.000 0.000 0.000 .tadhdet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdet5 1.000 1.448 0.481 tadhdet7 1.000 1.448 0.498 tadhdet10 1.000 1.448 0.547 tadhdet12 1.000 1.448 0.565 RIsi =~
sisoet5 1.000 0.562 0.403 sisoet7 1.000 0.562 0.376 sisoet10 1.000 0.562 0.376 sisoet12 1.000 0.562 0.340 wad5 =~
tadhdet5 1.000 2.636 0.877 wad7 =~
tadhdet7 1.000 2.520 0.867 wad10 =~
tadhdet10 1.000 2.213 0.837 wad12 =~
tadhdet12 1.000 2.115 0.825 wsi5 =~
sisoet5 1.000 1.274 0.915 wsi7 =~
sisoet7 1.000 1.385 0.927 wsi10 =~
sisoet10 1.000 1.386 0.927 wsi12 =~
sisoet12 1.000 1.555 0.941
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a2) 0.185 0.070 2.644 0.008 0.193 0.193 wsi5 (d2) -0.046 0.104 -0.446 0.656 -0.023 -0.023 wsi7 ~
wad5 (c2) 0.063 0.034 1.876 0.061 0.120 0.120 wsi5 (b2) 0.211 0.059 3.587 0.000 0.194 0.194 wad10 ~
wad7 (a2) 0.185 0.070 2.644 0.008 0.210 0.210 wsi7 (d2) -0.046 0.104 -0.446 0.656 -0.029 -0.029 wsi10 ~
wad7 (c2) 0.063 0.034 1.876 0.061 0.115 0.115 wsi7 (b2) 0.211 0.059 3.587 0.000 0.211 0.211 wad12 ~
wad10 (a2) 0.185 0.070 2.644 0.008 0.193 0.193 wsi10 (d2) -0.046 0.104 -0.446 0.656 -0.030 -0.030 wsi12 ~
wad10 (c2) 0.063 0.034 1.876 0.061 0.090 0.090 wsi10 (b2) 0.211 0.059 3.587 0.000 0.188 0.188
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 1.109 0.307 3.608 0.000 0.330 0.330 .wad7 ~~
.wsi7 0.777 0.254 3.056 0.002 0.235 0.235 .wad10 ~~
.wsi10 0.977 0.312 3.130 0.002 0.337 0.337 .wad12 ~~
.wsi12 0.608 0.250 2.432 0.015 0.194 0.194 RIad ~~
RIsi 0.650 0.203 3.197 0.001 0.799 0.799
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdet5 1.355 0.115 11.832 0.000 1.355 0.450 .tadhdet7 1.160 0.110 10.533 0.000 1.160 0.399 .tadhdet10 0.998 0.102 9.795 0.000 0.998 0.378 .tadhdet12 0.925 0.107 8.682 0.000 0.925 0.361 .sisoet5 0.723 0.053 13.584 0.000 0.723 0.519 .sisoet7 0.763 0.056 13.547 0.000 0.763 0.510 .sisoet10 0.920 0.060 15.363 0.000 0.920 0.615 .sisoet12 1.016 0.069 14.661 0.000 1.016 0.615 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 2.095 0.480 4.363 0.000 1.000 1.000 RIsi 0.316 0.103 3.069 0.002 1.000 1.000 wad5 6.951 0.951 7.307 0.000 1.000 1.000 wsi5 1.624 0.272 5.959 0.000 1.000 1.000 .wad7 6.128 0.932 6.577 0.000 0.965 0.965 .wsi7 1.789 0.249 7.186 0.000 0.933 0.933 .wad10 4.691 0.772 6.076 0.000 0.958 0.958 .wsi10 1.788 0.241 7.431 0.000 0.930 0.930 .wad12 4.321 0.855 5.055 0.000 0.966 0.966 .wsi12 2.284 0.318 7.175 0.000 0.945 0.945 .tadhdet5 0.000 0.000 0.000 .tadhdet7 0.000 0.000 0.000 .tadhdet10 0.000 0.000 0.000 .tadhdet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
tadhdet5 1.000 0.893 0.419 tadhdet7 1.000 0.893 0.431 tadhdet10 1.000 0.893 0.468 tadhdet12 1.000 0.893 0.581 RIsi =~
sisoet5 1.000 0.550 0.456 sisoet7 1.000 0.550 0.452 sisoet10 1.000 0.550 0.382 sisoet12 1.000 0.550 0.416 wad5 =~
tadhdet5 1.000 1.937 0.908 wad7 =~
tadhdet7 1.000 1.868 0.902 wad10 =~
tadhdet10 1.000 1.686 0.884 wad12 =~
tadhdet12 1.000 1.251 0.814 wsi5 =~
sisoet5 1.000 1.071 0.890 wsi7 =~
sisoet7 1.000 1.085 0.892 wsi10 =~
sisoet10 1.000 1.329 0.924 wsi12 =~
sisoet12 1.000 1.201 0.909
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a3) 0.136 0.090 1.515 0.130 0.142 0.142 wsi5 (d3) -0.044 0.061 -0.722 0.470 -0.025 -0.025 wsi7 ~
wad5 (c3) 0.007 0.037 0.198 0.843 0.013 0.013 wsi5 (b3) 0.199 0.075 2.665 0.008 0.197 0.197 wad10 ~
wad7 (a3) 0.136 0.090 1.515 0.130 0.151 0.151 wsi7 (d3) -0.044 0.061 -0.722 0.470 -0.028 -0.028 wsi10 ~
wad7 (c3) 0.007 0.037 0.198 0.843 0.010 0.010 wsi7 (b3) 0.199 0.075 2.665 0.008 0.163 0.163 wad12 ~
wad10 (a3) 0.136 0.090 1.515 0.130 0.184 0.184 wsi10 (d3) -0.044 0.061 -0.722 0.470 -0.047 -0.047 wsi12 ~
wad10 (c3) 0.007 0.037 0.198 0.843 0.010 0.010 wsi10 (b3) 0.199 0.075 2.665 0.008 0.221 0.221
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.536 0.163 3.287 0.001 0.258 0.258 .wad7 ~~
.wsi7 0.389 0.204 1.906 0.057 0.198 0.198 .wad10 ~~
.wsi10 0.398 0.209 1.905 0.057 0.182 0.182 .wad12 ~~
.wsi12 0.224 0.130 1.721 0.085 0.155 0.155 RIad ~~
RIsi 0.304 0.104 2.913 0.004 0.619 0.619
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhdet5 0.748 0.081 9.194 0.000 0.748 0.351 .tadhdet7 0.682 0.081 8.424 0.000 0.682 0.329 .tadhdet10 0.573 0.076 7.515 0.000 0.573 0.301 .tadhdet12 0.372 0.058 6.397 0.000 0.372 0.242 .sisoet5 0.584 0.045 13.053 0.000 0.584 0.485 .sisoet7 0.563 0.047 11.934 0.000 0.563 0.463 .sisoet10 0.678 0.057 11.862 0.000 0.678 0.471 .sisoet12 0.581 0.052 11.076 0.000 0.581 0.440 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.797 0.275 2.901 0.004 1.000 1.000 RIsi 0.302 0.096 3.161 0.002 1.000 1.000 wad5 3.753 0.735 5.107 0.000 1.000 1.000 wsi5 1.147 0.198 5.790 0.000 1.000 1.000 .wad7 3.424 0.689 4.969 0.000 0.981 0.981 .wsi7 1.130 0.192 5.877 0.000 0.960 0.960 .wad10 2.780 0.614 4.524 0.000 0.978 0.978 .wsi10 1.719 0.243 7.079 0.000 0.973 0.973 .wad12 1.512 0.338 4.470 0.000 0.967 0.967 .wsi12 1.370 0.221 6.205 0.000 0.950 0.950 .tadhdet5 0.000 0.000 0.000 .tadhdet7 0.000 0.000 0.000 .tadhdet10 0.000 0.000 0.000 .tadhdet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMt.lag.c.fit.summary)
RICLPMt.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMt.lag.c.fit.summary, ses = "Low")
RICLPMt.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMt.lag.c.fit.summary, ses = "Middle")
RICLPMt.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMt.lag.c.fit.summary, ses = "High") RICLPMt.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMt.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*tadhdet5 + 1*tadhdet7 + 1*tadhdet10 + 1*tadhdet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*tadhdet5
wad7 =~ 1*tadhdet7
wad10 =~ 1*tadhdet10
wad12 =~ 1*tadhdet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a,a,a)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b,b,b)*wsi5
wad10 ~ c(a,a,a)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b,b,b)*wsi7
wad12 ~ c(a,a,a)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b,b,b)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMt.ses.lag.c,
RICLPMt.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMt.lag.c.fit, RICLPMt.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is non significant (p=0.3931).
For non-robust statistics: The chi-square difference test of these two nested models is significant (p=0.004629), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - Low SES has non significant but close (p=0.061) ADHD -> social isolation cross-lag - Middle SES has significant (p=0.039) ADHD -> social isolation crosslag. - No significant cross-lags in high SES.
Can conclude here that there are SES differences - middle SES association remains only (close for low SES).
<- '
RICLPMt_hyp.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hyet5 + 1*hyet7 + 1*hyet10 + 1*hyet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*hyet5
wad7 =~ 1*hyet7
wad10 =~ 1*hyet10
wad12 =~ 1*hyet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Constrained lagged effects between the within-person centered variables. c(group1/middle, group2/low, group3/high) - different values across groups, but the same values within groups and across lags (all lags constrained).
wad7 ~ c(a1,a2,a3)*wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + c(b1,b2,b3)*wsi5
wad10 ~ c(a1,a2,a3)*wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + c(b1,b2,b3)*wsi7
wad12 ~ c(a1,a2,a3)*wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + c(b1,b2,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMt_hyp.lag.c,
RICLPMt_hyp.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMt_hyp.lag.c.fit,
RICLPMt_hyp.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 92 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 24
Number of observations per group: Used Total Middle 732 738 Low 742 742 High 750 752 Number of missing patterns per group:
Middle 21
Low 28
High 21
Model Test User Model: Standard Robust Test Statistic 177.732 78.414 Degrees of freedom 51 51 P-value (Chi-square) 0.000 0.008 Scaling correction factor 2.267 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 41.225 18.188 Low 69.054 30.466 High 67.454 29.760
Model Test Baseline Model:
Test statistic 1934.992 864.121 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 2.239
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.932 0.965 Tucker-Lewis Index (TLI) 0.887 0.942
Robust Comparative Fit Index (CFI) 0.964 Robust Tucker-Lewis Index (TLI) 0.941
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -25085.815 -25085.815 Scaling correction factor 2.871 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 3.159 for the MLR correction
Akaike (AIC) 50333.629 50333.629 Bayesian (BIC) 50795.901 50795.901 Sample-size adjusted Bayesian (BIC) 50538.552 50538.552
Root Mean Square Error of Approximation:
RMSEA 0.058 0.027 90 Percent confidence interval - lower 0.049 0.019 90 Percent confidence interval - upper 0.067 0.035 P-value RMSEA <= 0.05 0.077 1.000
Robust RMSEA 0.041 90 Percent confidence interval - lower 0.021 90 Percent confidence interval - upper 0.058
Standardized Root Mean Square Residual:
SRMR 0.050 0.050
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyet5 1.000 0.332 0.248 hyet7 1.000 0.332 0.263 hyet10 1.000 0.332 0.350 hyet12 1.000 0.332 0.328 RIsi =~
sisoet5 1.000 0.583 0.504 sisoet7 1.000 0.583 0.468 sisoet10 1.000 0.583 0.413 sisoet12 1.000 0.583 0.431 wad5 =~
hyet5 1.000 1.296 0.969 wad7 =~
hyet7 1.000 1.221 0.965 wad10 =~
hyet10 1.000 0.890 0.937 wad12 =~
hyet12 1.000 0.957 0.945 wsi5 =~
sisoet5 1.000 0.998 0.863 wsi7 =~
sisoet7 1.000 1.101 0.884 wsi10 =~
sisoet10 1.000 1.285 0.911 wsi12 =~
sisoet12 1.000 1.222 0.903
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a1) 0.110 0.055 1.996 0.046 0.117 0.117 wsi5 (d1) -0.030 0.028 -1.053 0.293 -0.024 -0.024 wsi7 ~
wad5 (c1) 0.109 0.044 2.457 0.014 0.128 0.128 wsi5 (b1) 0.033 0.055 0.599 0.549 0.030 0.030 wad10 ~
wad7 (a1) 0.110 0.055 1.996 0.046 0.151 0.151 wsi7 (d1) -0.030 0.028 -1.053 0.293 -0.037 -0.037 wsi10 ~
wad7 (c1) 0.109 0.044 2.457 0.014 0.103 0.103 wsi7 (b1) 0.033 0.055 0.599 0.549 0.028 0.028 wad12 ~
wad10 (a1) 0.110 0.055 1.996 0.046 0.102 0.102 wsi10 (d1) -0.030 0.028 -1.053 0.293 -0.040 -0.040 wsi12 ~
wad10 (c1) 0.109 0.044 2.457 0.014 0.079 0.079 wsi10 (b1) 0.033 0.055 0.599 0.549 0.034 0.034
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.311 0.097 3.200 0.001 0.241 0.241 .wad7 ~~
.wsi7 0.180 0.090 2.001 0.045 0.136 0.136 .wad10 ~~
.wsi10 0.239 0.088 2.724 0.006 0.212 0.212 .wad12 ~~
.wsi12 0.280 0.129 2.166 0.030 0.242 0.242 RIad ~~
RIsi 0.093 0.035 2.695 0.007 0.481 0.481
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyet5 0.427 0.051 8.350 0.000 0.427 0.319 .hyet7 0.410 0.050 8.204 0.000 0.410 0.324 .hyet10 0.240 0.039 6.216 0.000 0.240 0.253 .hyet12 0.237 0.041 5.775 0.000 0.237 0.234 .sisoet5 0.560 0.044 12.730 0.000 0.560 0.485 .sisoet7 0.621 0.048 13.068 0.000 0.621 0.499 .sisoet10 0.601 0.056 10.725 0.000 0.601 0.426 .sisoet12 0.704 0.056 12.537 0.000 0.704 0.520 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.110 0.063 1.753 0.080 1.000 1.000 RIsi 0.340 0.073 4.683 0.000 1.000 1.000 wad5 1.680 0.285 5.897 0.000 1.000 1.000 wsi5 0.995 0.143 6.937 0.000 1.000 1.000 .wad7 1.472 0.232 6.342 0.000 0.987 0.987 .wsi7 1.188 0.150 7.907 0.000 0.981 0.981 .wad10 0.775 0.199 3.883 0.000 0.977 0.977 .wsi10 1.632 0.306 5.338 0.000 0.988 0.988 .wad12 0.907 0.237 3.824 0.000 0.990 0.990 .wsi12 1.480 0.188 7.855 0.000 0.991 0.991 .hyet5 0.000 0.000 0.000 .hyet7 0.000 0.000 0.000 .hyet10 0.000 0.000 0.000 .hyet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyet5 1.000 0.703 0.455 hyet7 1.000 0.703 0.457 hyet10 1.000 0.703 0.484 hyet12 1.000 0.703 0.519 RIsi =~
sisoet5 1.000 0.567 0.408 sisoet7 1.000 0.567 0.381 sisoet10 1.000 0.567 0.378 sisoet12 1.000 0.567 0.340 wad5 =~
hyet5 1.000 1.376 0.891 wad7 =~
hyet7 1.000 1.366 0.889 wad10 =~
hyet10 1.000 1.270 0.875 wad12 =~
hyet12 1.000 1.157 0.855 wsi5 =~
sisoet5 1.000 1.270 0.913 wsi7 =~
sisoet7 1.000 1.376 0.925 wsi10 =~
sisoet10 1.000 1.389 0.926 wsi12 =~
sisoet12 1.000 1.570 0.941
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a2) 0.181 0.076 2.375 0.018 0.182 0.182 wsi5 (d2) 0.023 0.053 0.436 0.663 0.022 0.022 wsi7 ~
wad5 (c2) 0.156 0.059 2.645 0.008 0.156 0.156 wsi5 (b2) 0.206 0.060 3.429 0.001 0.190 0.190 wad10 ~
wad7 (a2) 0.181 0.076 2.375 0.018 0.195 0.195 wsi7 (d2) 0.023 0.053 0.436 0.663 0.025 0.025 wsi10 ~
wad7 (c2) 0.156 0.059 2.645 0.008 0.153 0.153 wsi7 (b2) 0.206 0.060 3.429 0.001 0.204 0.204 wad12 ~
wad10 (a2) 0.181 0.076 2.375 0.018 0.199 0.199 wsi10 (d2) 0.023 0.053 0.436 0.663 0.028 0.028 wsi12 ~
wad10 (c2) 0.156 0.059 2.645 0.008 0.126 0.126 wsi10 (b2) 0.206 0.060 3.429 0.001 0.183 0.183
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.416 0.153 2.716 0.007 0.238 0.238 .wad7 ~~
.wsi7 0.406 0.133 3.043 0.002 0.228 0.228 .wad10 ~~
.wsi10 0.443 0.155 2.863 0.004 0.268 0.268 .wad12 ~~
.wsi12 0.185 0.114 1.625 0.104 0.108 0.108 RIad ~~
RIsi 0.249 0.098 2.524 0.012 0.624 0.624
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyet5 0.605 0.059 10.311 0.000 0.605 0.392 .hyet7 0.541 0.058 9.252 0.000 0.541 0.352 .hyet10 0.477 0.056 8.542 0.000 0.477 0.328 .hyet12 0.452 0.057 7.871 0.000 0.452 0.334 .sisoet5 0.724 0.053 13.541 0.000 0.724 0.521 .sisoet7 0.767 0.056 13.588 0.000 0.767 0.515 .sisoet10 0.922 0.060 15.398 0.000 0.922 0.615 .sisoet12 1.020 0.069 14.674 0.000 1.020 0.611 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.494 0.136 3.643 0.000 1.000 1.000 RIsi 0.322 0.108 2.985 0.003 1.000 1.000 wad5 1.893 0.279 6.779 0.000 1.000 1.000 wsi5 1.613 0.279 5.774 0.000 1.000 1.000 .wad7 1.801 0.291 6.189 0.000 0.964 0.964 .wsi7 1.753 0.246 7.117 0.000 0.925 0.925 .wad10 1.547 0.301 5.145 0.000 0.959 0.959 .wsi10 1.772 0.241 7.345 0.000 0.918 0.918 .wad12 1.280 0.269 4.755 0.000 0.956 0.956 .wsi12 2.311 0.325 7.114 0.000 0.937 0.937 .hyet5 0.000 0.000 0.000 .hyet7 0.000 0.000 0.000 .hyet10 0.000 0.000 0.000 .hyet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
hyet5 1.000 0.513 0.414 hyet7 1.000 0.513 0.444 hyet10 1.000 0.513 0.516 hyet12 1.000 0.513 0.573 RIsi =~
sisoet5 1.000 0.560 0.465 sisoet7 1.000 0.560 0.461 sisoet10 1.000 0.560 0.389 sisoet12 1.000 0.560 0.424 wad5 =~
hyet5 1.000 1.128 0.910 wad7 =~
hyet7 1.000 1.036 0.896 wad10 =~
hyet10 1.000 0.852 0.857 wad12 =~
hyet12 1.000 0.733 0.819 wsi5 =~
sisoet5 1.000 1.067 0.885 wsi7 =~
sisoet7 1.000 1.078 0.887 wsi10 =~
sisoet10 1.000 1.328 0.921 wsi12 =~
sisoet12 1.000 1.197 0.906
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a3) 0.099 0.080 1.240 0.215 0.107 0.107 wsi5 (d3) -0.026 0.038 -0.693 0.488 -0.027 -0.027 wsi7 ~
wad5 (c3) -0.012 0.059 -0.198 0.843 -0.012 -0.012 wsi5 (b3) 0.197 0.076 2.608 0.009 0.195 0.195 wad10 ~
wad7 (a3) 0.099 0.080 1.240 0.215 0.120 0.120 wsi7 (d3) -0.026 0.038 -0.693 0.488 -0.033 -0.033 wsi10 ~
wad7 (c3) -0.012 0.059 -0.198 0.843 -0.009 -0.009 wsi7 (b3) 0.197 0.076 2.608 0.009 0.160 0.160 wad12 ~
wad10 (a3) 0.099 0.080 1.240 0.215 0.115 0.115 wsi10 (d3) -0.026 0.038 -0.693 0.488 -0.048 -0.048 wsi12 ~
wad10 (c3) -0.012 0.059 -0.198 0.843 -0.008 -0.008 wsi10 (b3) 0.197 0.076 2.608 0.009 0.219 0.219
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.232 0.102 2.277 0.023 0.193 0.193 .wad7 ~~
.wsi7 0.163 0.104 1.568 0.117 0.150 0.150 .wad10 ~~
.wsi10 0.150 0.098 1.526 0.127 0.135 0.135 .wad12 ~~
.wsi12 0.074 0.075 0.983 0.325 0.087 0.087 RIad ~~
RIsi 0.149 0.066 2.251 0.024 0.517 0.517
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .hyet5 0.394 0.047 8.403 0.000 0.394 0.318 .hyet7 0.352 0.045 7.816 0.000 0.352 0.304 .hyet10 0.266 0.039 6.867 0.000 0.266 0.267 .hyet12 0.200 0.035 5.758 0.000 0.200 0.223 .sisoet5 0.584 0.045 13.069 0.000 0.584 0.484 .sisoet7 0.564 0.047 11.934 0.000 0.564 0.464 .sisoet10 0.678 0.057 11.863 0.000 0.678 0.470 .sisoet12 0.581 0.053 11.048 0.000 0.581 0.440 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.263 0.084 3.114 0.002 1.000 1.000 RIsi 0.314 0.097 3.254 0.001 1.000 1.000 wad5 1.272 0.209 6.078 0.000 1.000 1.000 wsi5 1.138 0.199 5.710 0.000 1.000 1.000 .wad7 1.061 0.189 5.601 0.000 0.989 0.989 .wsi7 1.119 0.190 5.879 0.000 0.963 0.963 .wad10 0.715 0.160 4.480 0.000 0.986 0.986 .wsi10 1.720 0.245 7.020 0.000 0.975 0.975 .wad12 0.530 0.117 4.543 0.000 0.986 0.986 .wsi12 1.365 0.221 6.168 0.000 0.953 0.953 .hyet5 0.000 0.000 0.000 .hyet7 0.000 0.000 0.000 .hyet10 0.000 0.000 0.000 .hyet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMt_hyp.lag.c.fit.summary)
RICLPMt_hyp.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMt_hyp.lag.c.fit.summary, ses = "Low")
RICLPMt_hyp.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMt_hyp.lag.c.fit.summary, ses = "Middle")
RICLPMt_hyp.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMt_hyp.lag.c.fit.summary, ses = "High") RICLPMt_hyp.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMt_hyp.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*hyet5 + 1*hyet7 + 1*hyet10 + 1*hyet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*hyet5
wad7 =~ 1*hyet7
wad10 =~ 1*hyet10
wad12 =~ 1*hyet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a,a,a)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b,b,b)*wsi5
wad10 ~ c(a,a,a)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b,b,b)*wsi7
wad12 ~ c(a,a,a)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b,b,b)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMt_hyp.ses.lag.c,
RICLPMt_hyp.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMt_hyp.lag.c.fit, RICLPMt_hyp.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is non significant (p=0.3033).
For non-robust statistics The chi-square difference test of these two nested models is significant (p=0.001871), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - Low SES has significant (p=0.008) ADHD -> social isolation cross-lag - Middle SES has significant (p=0.014) ADHD -> social isolation cross-lag. - No significant cross-lags in high SES.
Can conclude here that there are SES differences - low and middle SES association remains only.
<- '
RICLPMt_inat.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*inet5 + 1*inet7 + 1*inet10 + 1*inet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*inet5
wad7 =~ 1*inet7
wad10 =~ 1*inet10
wad12 =~ 1*inet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Constrained lagged effects between the within-person centered variables. c(group1/middle, group2/low, group3/high) - different values across groups, but the same values within groups and across lags (all lags constrained).
wad7 ~ c(a1,a2,a3)*wad5 + c(d1,d2,d3)*wsi5
wsi7 ~ c(c1,c2,c3)*wad5 + c(b1,b2,b3)*wsi5
wad10 ~ c(a1,a2,a3)*wad7 + c(d1,d2,d3)*wsi7
wsi10 ~ c(c1,c2,c3)*wad7 + c(b1,b2,b3)*wsi7
wad12 ~ c(a1,a2,a3)*wad10 + c(d1,d2,d3)*wsi10
wsi12 ~ c(c1,c2,c3)*wad10 + c(b1,b2,b3)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
To check for group differences in parameter estimates between different levels of SES, we specify that we are interested to group by SES.
<- lavaan(RICLPMt_inat.lag.c,
RICLPMt_inat.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
<- summary(RICLPMt_inat.lag.c.fit,
RICLPMt_inat.lag.c.fit.summary fit.measures = TRUE,
standardized = TRUE)
lavaan 0.6-10 ended normally after 91 iterations
Estimator ML Optimization method NLMINB Number of model parameters 105 Number of equality constraints 24
Number of observations per group: Used Total Middle 732 738 Low 742 742 High 750 752 Number of missing patterns per group:
Middle 19
Low 23
High 20
Model Test User Model: Standard Robust Test Statistic 166.217 71.891 Degrees of freedom 51 51 P-value (Chi-square) 0.000 0.029 Scaling correction factor 2.312 Yuan-Bentler correction (Mplus variant)
Test statistic for each group: Middle 43.465 18.799 Low 35.760 15.467 High 86.992 37.625
Model Test Baseline Model:
Test statistic 2293.173 970.890 Degrees of freedom 84 84 P-value 0.000 0.000 Scaling correction factor 2.362
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.948 0.976 Tucker-Lewis Index (TLI) 0.914 0.961
Robust Comparative Fit Index (CFI) 0.977 Robust Tucker-Lewis Index (TLI) 0.962
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -25570.458 -25570.458 Scaling correction factor 2.832 for the MLR correction
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 3.146 for the MLR correction
Akaike (AIC) 51302.915 51302.915 Bayesian (BIC) 51765.187 51765.187 Sample-size adjusted Bayesian (BIC) 51507.838 51507.838
Root Mean Square Error of Approximation:
RMSEA 0.055 0.024 90 Percent confidence interval - lower 0.046 0.014 90 Percent confidence interval - upper 0.065 0.031 P-value RMSEA <= 0.05 0.171 1.000
Robust RMSEA 0.036 90 Percent confidence interval - lower 0.012 90 Percent confidence interval - upper 0.054
Standardized Root Mean Square Residual:
SRMR 0.050 0.050
Parameter Estimates:
Standard errors Sandwich Information bread Observed Observed information based on Hessian
Group 1 [Middle]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inet5 1.000 0.576 0.442 inet7 1.000 0.576 0.394 inet10 1.000 0.576 0.461 inet12 1.000 0.576 0.488 RIsi =~
sisoet5 1.000 0.595 0.514 sisoet7 1.000 0.595 0.480 sisoet10 1.000 0.595 0.422 sisoet12 1.000 0.595 0.438 wad5 =~
inet5 1.000 1.168 0.897 wad7 =~
inet7 1.000 1.343 0.919 wad10 =~
inet10 1.000 1.109 0.888 wad12 =~
inet12 1.000 1.029 0.873 wsi5 =~
sisoet5 1.000 0.994 0.858 wsi7 =~
sisoet7 1.000 1.088 0.877 wsi10 =~
sisoet10 1.000 1.280 0.907 wsi12 =~
sisoet12 1.000 1.220 0.899
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a1) 0.059 0.052 1.139 0.255 0.051 0.051 wsi5 (d1) -0.060 0.045 -1.344 0.179 -0.044 -0.044 wsi7 ~
wad5 (c1) 0.045 0.038 1.206 0.228 0.049 0.049 wsi5 (b1) 0.033 0.055 0.610 0.542 0.030 0.030 wad10 ~
wad7 (a1) 0.059 0.052 1.139 0.255 0.072 0.072 wsi7 (d1) -0.060 0.045 -1.344 0.179 -0.059 -0.059 wsi10 ~
wad7 (c1) 0.045 0.038 1.206 0.228 0.048 0.048 wsi7 (b1) 0.033 0.055 0.610 0.542 0.028 0.028 wad12 ~
wad10 (a1) 0.059 0.052 1.139 0.255 0.064 0.064 wsi10 (d1) -0.060 0.045 -1.344 0.179 -0.074 -0.074 wsi12 ~
wad10 (c1) 0.045 0.038 1.206 0.228 0.041 0.041 wsi10 (b1) 0.033 0.055 0.610 0.542 0.035 0.035
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.192 0.083 2.319 0.020 0.165 0.165 .wad7 ~~
.wsi7 0.194 0.098 1.984 0.047 0.134 0.134 .wad10 ~~
.wsi10 0.435 0.146 2.973 0.003 0.308 0.308 .wad12 ~~
.wsi12 0.348 0.116 2.991 0.003 0.278 0.278 RIad ~~
RIsi 0.201 0.050 4.023 0.000 0.585 0.585
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inet5 0.414 0.051 8.181 0.000 0.414 0.318 .inet7 0.465 0.056 8.264 0.000 0.465 0.318 .inet10 0.346 0.050 6.969 0.000 0.346 0.277 .inet12 0.289 0.046 6.236 0.000 0.289 0.245 .sisoet5 0.560 0.044 12.732 0.000 0.560 0.484 .sisoet7 0.622 0.048 13.069 0.000 0.622 0.501 .sisoet10 0.598 0.056 10.730 0.000 0.598 0.424 .sisoet12 0.699 0.056 12.514 0.000 0.699 0.515 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.332 0.089 3.726 0.000 1.000 1.000 RIsi 0.355 0.075 4.716 0.000 1.000 1.000 wad5 1.365 0.255 5.348 0.000 1.000 1.000 wsi5 0.987 0.141 6.996 0.000 1.000 1.000 .wad7 1.797 0.283 6.339 0.000 0.996 0.996 .wsi7 1.179 0.151 7.799 0.000 0.996 0.996 .wad10 1.221 0.256 4.766 0.000 0.993 0.993 .wsi10 1.633 0.307 5.314 0.000 0.997 0.997 .wad12 1.051 0.223 4.724 0.000 0.993 0.993 .wsi12 1.484 0.189 7.832 0.000 0.996 0.996 .inet5 0.000 0.000 0.000 .inet7 0.000 0.000 0.000 .inet10 0.000 0.000 0.000 .inet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 2 [Low]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inet5 1.000 0.772 0.434 inet7 1.000 0.772 0.479 inet10 1.000 0.772 0.519 inet12 1.000 0.772 0.526 RIsi =~
sisoet5 1.000 0.577 0.415 sisoet7 1.000 0.577 0.386 sisoet10 1.000 0.577 0.386 sisoet12 1.000 0.577 0.352 wad5 =~
inet5 1.000 1.604 0.901 wad7 =~
inet7 1.000 1.414 0.878 wad10 =~
inet10 1.000 1.273 0.855 wad12 =~
inet12 1.000 1.249 0.851 wsi5 =~
sisoet5 1.000 1.267 0.910 wsi7 =~
sisoet7 1.000 1.378 0.922 wsi10 =~
sisoet10 1.000 1.380 0.922 wsi12 =~
sisoet12 1.000 1.537 0.936
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a2) 0.151 0.059 2.549 0.011 0.171 0.171 wsi5 (d2) -0.045 0.061 -0.725 0.468 -0.040 -0.040 wsi7 ~
wad5 (c2) 0.057 0.054 1.055 0.291 0.066 0.066 wsi5 (b2) 0.217 0.059 3.656 0.000 0.200 0.200 wad10 ~
wad7 (a2) 0.151 0.059 2.549 0.011 0.168 0.168 wsi7 (d2) -0.045 0.061 -0.725 0.468 -0.048 -0.048 wsi10 ~
wad7 (c2) 0.057 0.054 1.055 0.291 0.058 0.058 wsi7 (b2) 0.217 0.059 3.656 0.000 0.217 0.217 wad12 ~
wad10 (a2) 0.151 0.059 2.549 0.011 0.154 0.154 wsi10 (d2) -0.045 0.061 -0.725 0.468 -0.049 -0.049 wsi12 ~
wad10 (c2) 0.057 0.054 1.055 0.291 0.047 0.047 wsi10 (b2) 0.217 0.059 3.656 0.000 0.195 0.195
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.674 0.187 3.600 0.000 0.332 0.332 .wad7 ~~
.wsi7 0.371 0.134 2.762 0.006 0.198 0.198 .wad10 ~~
.wsi10 0.579 0.188 3.074 0.002 0.344 0.344 .wad12 ~~
.wsi12 0.448 0.162 2.771 0.006 0.242 0.242 RIad ~~
RIsi 0.387 0.110 3.511 0.000 0.868 0.868
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inet5 0.749 0.068 10.945 0.000 0.749 0.421 .inet7 0.619 0.062 10.045 0.000 0.619 0.384 .inet10 0.527 0.058 9.088 0.000 0.527 0.354 .inet12 0.476 0.060 7.986 0.000 0.476 0.324 .sisoet5 0.720 0.053 13.628 0.000 0.720 0.517 .sisoet7 0.759 0.056 13.511 0.000 0.759 0.508 .sisoet10 0.920 0.060 15.358 0.000 0.920 0.615 .sisoet12 1.013 0.069 14.662 0.000 1.013 0.617 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.596 0.139 4.289 0.000 1.000 1.000 RIsi 0.333 0.103 3.233 0.001 1.000 1.000 wad5 2.572 0.324 7.930 0.000 1.000 1.000 wsi5 1.604 0.266 6.037 0.000 1.000 1.000 .wad7 1.948 0.284 6.860 0.000 0.974 0.974 .wsi7 1.800 0.249 7.223 0.000 0.947 0.947 .wad10 1.576 0.249 6.325 0.000 0.973 0.973 .wsi10 1.798 0.240 7.482 0.000 0.944 0.944 .wad12 1.528 0.266 5.733 0.000 0.979 0.979 .wsi12 2.253 0.310 7.278 0.000 0.954 0.954 .inet5 0.000 0.000 0.000 .inet7 0.000 0.000 0.000 .inet10 0.000 0.000 0.000 .inet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
Group 3 [High]:
Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~
inet5 1.000 0.502 0.435 inet7 1.000 0.502 0.429 inet10 1.000 0.502 0.430 inet12 1.000 0.502 0.568 RIsi =~
sisoet5 1.000 0.570 0.473 sisoet7 1.000 0.570 0.469 sisoet10 1.000 0.570 0.396 sisoet12 1.000 0.570 0.431 wad5 =~
inet5 1.000 1.038 0.900 wad7 =~
inet7 1.000 1.056 0.903 wad10 =~
inet10 1.000 1.054 0.903 wad12 =~
inet12 1.000 0.727 0.823 wsi5 =~
sisoet5 1.000 1.063 0.881 wsi7 =~
sisoet7 1.000 1.073 0.883 wsi10 =~
sisoet10 1.000 1.321 0.918 wsi12 =~
sisoet12 1.000 1.195 0.902
Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~
wad5 (a3) 0.108 0.076 1.423 0.155 0.106 0.106 wsi5 (d3) -0.016 0.036 -0.443 0.658 -0.016 -0.016 wsi7 ~
wad5 (c3) 0.026 0.067 0.394 0.693 0.026 0.026 wsi5 (b3) 0.183 0.074 2.487 0.013 0.181 0.181 wad10 ~
wad7 (a3) 0.108 0.076 1.423 0.155 0.108 0.108 wsi7 (d3) -0.016 0.036 -0.443 0.658 -0.016 -0.016 wsi10 ~
wad7 (c3) 0.026 0.067 0.394 0.693 0.021 0.021 wsi7 (b3) 0.183 0.074 2.487 0.013 0.149 0.149 wad12 ~
wad10 (a3) 0.108 0.076 1.423 0.155 0.156 0.156 wsi10 (d3) -0.016 0.036 -0.443 0.658 -0.029 -0.029 wsi12 ~
wad10 (c3) 0.026 0.067 0.394 0.693 0.023 0.023 wsi10 (b3) 0.183 0.074 2.487 0.013 0.202 0.202
Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~
wsi5 0.297 0.093 3.181 0.001 0.269 0.269 .wad7 ~~
.wsi7 0.206 0.112 1.844 0.065 0.186 0.186 .wad10 ~~
.wsi10 0.258 0.144 1.784 0.074 0.188 0.188 .wad12 ~~
.wsi12 0.185 0.083 2.227 0.026 0.220 0.220 RIad ~~
RIsi 0.174 0.061 2.823 0.005 0.607 0.607
Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .inet5 0.353 0.044 8.035 0.000 0.353 0.307 .inet7 0.332 0.046 7.175 0.000 0.332 0.284 .inet10 0.316 0.046 6.787 0.000 0.316 0.270 .inet12 0.184 0.033 5.586 0.000 0.184 0.208 .sisoet5 0.585 0.045 13.048 0.000 0.585 0.485 .sisoet7 0.564 0.047 11.951 0.000 0.564 0.464 .sisoet10 0.678 0.057 11.860 0.000 0.678 0.471 .sisoet12 0.582 0.053 11.082 0.000 0.582 0.440 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000
Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 0.252 0.091 2.767 0.006 1.000 1.000 RIsi 0.325 0.095 3.424 0.001 1.000 1.000 wad5 1.077 0.231 4.655 0.000 1.000 1.000 wsi5 1.129 0.192 5.870 0.000 1.000 1.000 .wad7 1.103 0.242 4.564 0.000 0.989 0.989 .wsi7 1.109 0.190 5.842 0.000 0.964 0.964 .wad10 1.099 0.237 4.634 0.000 0.989 0.989 .wsi10 1.704 0.242 7.035 0.000 0.976 0.976 .wad12 0.516 0.152 3.387 0.001 0.976 0.976 .wsi12 1.367 0.219 6.238 0.000 0.957 0.957 .inet5 0.000 0.000 0.000 .inet7 0.000 0.000 0.000 .inet10 0.000 0.000 0.000 .inet12 0.000 0.000 0.000 .sisoet5 0.000 0.000 0.000 .sisoet7 0.000 0.000 0.000 .sisoet10 0.000 0.000 0.000 .sisoet12 0.000 0.000 0.000
#Table of model fit
<- table.model.fit(RICLPMt_inat.lag.c.fit.summary)
RICLPMt_inat.lag.c.fit.summary.fit #Table of regression coefficients and covariances for females and males separately
<- table.model.coef(model = RICLPMt_inat.lag.c.fit.summary, ses = "Low")
RICLPMt_inat.lag.c.fit.summary.reg.low <- table.model.coef(model = RICLPMt_inat.lag.c.fit.summary, ses = "Middle")
RICLPMt_inat.lag.c.fit.summary.reg.mid <- table.model.coef(model = RICLPMt_inat.lag.c.fit.summary, ses = "High") RICLPMt_inat.lag.c.fit.summary.reg.high
Now we want to apply constraints over time to test if lagged parameters are invariant across groups, if the chi square is significant then the lagged effects for boys and girls are different.
<- '
RICLPMt_inat.ses.lag.c # Create between components (random intercepts treated as factors here)
RIad =~ 1*inet5 + 1*inet7 + 1*inet10 + 1*inet12 #x
RIsi =~ 1*sisoet5 + 1*sisoet7 + 1*sisoet10 + 1*sisoet12 #y
# Create within-person centered variables
wad5 =~ 1*inet5
wad7 =~ 1*inet7
wad10 =~ 1*inet10
wad12 =~ 1*inet12
wsi5 =~ 1*sisoet5
wsi7 =~ 1*sisoet7
wsi10 =~ 1*sisoet10
wsi12 =~ 1*sisoet12
# Estimate the lagged effects between the within-person centered variables. Constrain the autoregressive effects across groups AND the lagged effects between the within-person centered variables.
wad7 ~ c(a,a,a)*wad5 + c(d,d,d)*wsi5
wsi7 ~ c(c,c,c)*wad5 + c(b,b,b)*wsi5
wad10 ~ c(a,a,a)*wad7 + c(d,d,d)*wsi7
wsi10 ~ c(c,c,c)*wad7 + c(b,b,b)*wsi7
wad12 ~ c(a,a,a)*wad10 + c(d,d,d)*wsi10
wsi12 ~ c(c,c,c)*wad10 + c(b,b,b)*wsi10
# Estimate the covariance between the within-person centered variables at the first wave
wad5 ~~ wsi5 # Covariance
# Estimate the covariances between the residuals of the within-person centered variables (the innovations)
wad7 ~~ wsi7
wad10 ~~ wsi10
wad12 ~~ wsi12
# Estimate the variance and covariance of the random intercepts
RIad ~~ RIad
RIsi ~~ RIsi
RIad ~~ RIsi
# Estimate the (residual) variance of the within-person centered variables.
wad5 ~~ wad5 # Variances
wsi5 ~~ wsi5
wad7 ~~ wad7 # Residual variances
wsi7 ~~ wsi7
wad10 ~~ wad10
wsi10 ~~ wsi10
wad12 ~~ wad12
wsi12 ~~ wsi12
'
<- lavaan(RICLPMt_inat.ses.lag.c,
RICLPMt_inat.ses.lag.c.fit data = dat,
missing = 'ML',
group = "SES",
meanstructure = TRUE,
int.ov.free = TRUE,
se = "robust",
estimator = "MLR" #maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic
)
Now we see if there is a significantly worse fit when the lagged-parameters are constrained to be equal across groups.
lavTestLRT(RICLPMt_inat.lag.c.fit, RICLPMt_inat.ses.lag.c.fit, method = "satorra.bentler.2010")
For robust statistics: The chi-square difference test of these two nested models is non significant (p=0.5639).
For non-robust statistics: The chi-square difference test of these two nested models is significant (p=0.02542), which implies that the lagged effects appear to be the different for different levels of SES
SES differences found: - No significant cross lag associations for different levels of SES. - Significant autoregressive cross-lags for low SES only.
Can conclude here that there are no SES differences in inattention cross-lags
All models using total combined ADHD symptoms and cross-lags are constrained to be equal across time.
Work by Katherine N Thompson
katherine.n.thompson@kcl.ac.uk