knitr::opts_knit$set(root.dir = "C:/Work Files/Dissertations/Gina Drury")
#setwd("C:/Work Files/Dissertations/Gina Drury")Gina Updated Models
library(mice)
Attaching package: 'mice'
The following object is masked from 'package:stats':
filter
The following objects are masked from 'package:base':
cbind, rbind
library(lavaan)This is lavaan 0.6-19
lavaan is FREE software! Please report any bugs.
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.2 ✔ tibble 3.3.0
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.0.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks mice::filter(), stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(knitr)
library(kableExtra)
Attaching package: 'kableExtra'
The following object is masked from 'package:dplyr':
group_rows
cleaned_data_final2 <- read.csv("cleaned_data_final2.csv")
cleaned_data_final2.1 <- cleaned_data_final2 %>% mutate(across(where(is.factor), ordered))
cleaned_data_final2.1$log_income <- log(cleaned_data_final2.1$hseincom)/10
cleaned_data_final2.1$log_FIQ <- log(cleaned_data_final2.1$MomOnlyFSIQ)/10
cleaned_data_final2.1_oboe_only <- cleaned_data_final2.1[cleaned_data_final2.1$oboe_group == "exposed", ]
cleaned_data_final2.1_no_oboe <- cleaned_data_final2.1[cleaned_data_final2.1$oboe_group == "control", ]
str(cleaned_data_final2.1$oboe_group) chr [1:291] "control" "control" "control" "control" "control" "control" ...
table(cleaned_data_final2.1_oboe_only$oboe_group)
exposed
194
names(cleaned_data_final2.1) [1] "X.1" "X" "oboe_group"
[4] "pcedlevel" "hseincom" "bzip"
[7] "maristat" "zip" "diabpprg"
[10] "gestdiab" "hyp" "pree"
[13] "hepc" "hiv" "hepb"
[16] "syph" "gon" "chlmyd"
[19] "acescore" "Dep_Score" "Anx_Score"
[22] "Anger_Score" "Supp_Score" "Meaning_Score"
[25] "gawks" "gaday" "imhbirthwt"
[28] "imh_birthhcr" "imh_birthlt" "apgar1m"
[31] "apgar5m" "sex" "n2attention"
[34] "n2regulation" "n2arousal" "n2tone"
[37] "n2tonehi" "n2tonelo" "n2tonemix"
[40] "n2nonoptref" "n2qmove" "n2stress"
[43] "ethnc" "MomOnlyFSIQ" "final_nnns_class"
[46] "MatAge" "prenatal_collapsed" "collapsed_mentheal"
[49] "mmins_combined" "mrace_combined" "othersub_y_n"
[52] "any_subuse_y_n" "log_income" "log_FIQ"
cat_vars <- names(cleaned_data_final2.1)[sapply(cleaned_data_final2.1, is.factor)]
head(cat_vars)character(0)
library(forcats)
# Collapse rare levels in all categorical variables
cleaned_data_final2.1[cat_vars] <- lapply(cleaned_data_final2.1[cat_vars], function(x) {
fct_lump_min(x, min = 5) # Change threshold based on your data
})M_model <- '
Mat_Health =~ diabpprg + gestdiab + hyp + prenatal_collapsed + hiv + syph + chlmyd
MatMen_health =~ collapsed_mentheal + acescore + Dep_Score + Anx_Score + Anger_Score + Supp_Score + Meaning_Score
Infant =~ imhbirthwt + imh_birthlt + imh_birthhcr + gawks + sex
SocioDem =~ MatAge + mmins_combined + mrace_combined + pcedlevel + MomOnlyFSIQ + any_subuse_y_n + hseincom
'
M_model_fit <- sem(M_model, estimator= "WLSMV", data=cleaned_data_final2.1, std.lv=TRUE,missing = "pairwise", mimic = "Mplus")Warning: lavaan->lav_options_est_dwls():
estimator "DWLS" is not recommended for continuous data. Did you forget to
set the ordered= argument?
Warning: lavaan->lav_data_full():
some observed variances are (at least) a factor 1000 times larger than
others; use varTable(fit) to investigate
Warning: lavaan->lav_samplestats_from_data():
number of observations (291) too small to compute Gamma
Warning: lavaan->lav_model_vcov():
The variance-covariance matrix of the estimated parameters (vcov) does not
appear to be positive definite! The smallest eigenvalue (= -4.108105e-06)
is smaller than zero. This may be a symptom that the model is not
identified.
summary(M_model_fit, fit.measures = TRUE, standardized=TRUE)lavaan 0.6-19 ended normally after 105 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 84
Number of observations 291
Number of missing patterns 27
Model Test User Model:
Standard Scaled
Test Statistic 460.447 418.076
Degrees of freedom 293 293
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.816
Shift parameter 164.463
simple second-order correction (WLSMV)
Model Test Baseline Model:
Test statistic 2046.658 1033.872
Degrees of freedom 325 325
P-value 0.000 0.000
Scaling correction factor 2.429
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.903 0.824
Tucker-Lewis Index (TLI) 0.892 0.804
Robust Comparative Fit Index (CFI) 0.903
Robust Tucker-Lewis Index (TLI) 0.892
Root Mean Square Error of Approximation:
RMSEA 0.044 0.038
90 Percent confidence interval - lower 0.036 0.030
90 Percent confidence interval - upper 0.052 0.046
P-value H_0: RMSEA <= 0.050 0.884 0.992
P-value H_0: RMSEA >= 0.080 0.000 0.000
Robust RMSEA 0.052
90 Percent confidence interval - lower 0.040
90 Percent confidence interval - upper 0.063
P-value H_0: Robust RMSEA <= 0.050 0.393
P-value H_0: Robust RMSEA >= 0.080 0.000
Standardized Root Mean Square Residual:
SRMR 0.063 0.063
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
Mat_Health =~
diabpprg 0.003 0.003 0.756 0.450 0.003 0.025
gestdiab 0.004 0.014 0.252 0.801 0.004 0.015
hyp 0.095 0.038 2.504 0.012 0.095 0.226
prenatl_cllpsd 0.078 0.034 2.268 0.023 0.078 0.209
hiv -0.027 0.021 -1.308 0.191 -0.027 -0.129
syph 0.024 0.020 1.184 0.236 0.024 0.101
chlmyd 0.064 0.038 1.695 0.090 0.064 0.161
MatMen_health =~
collapsd_mnthl 0.305 0.051 5.943 0.000 0.305 0.325
acescore -0.938 0.152 -6.160 0.000 -0.938 -0.339
Dep_Score -8.107 0.428 -18.925 0.000 -8.107 -0.905
Anx_Score -8.627 0.442 -19.517 0.000 -8.627 -0.808
Anger_Score -6.878 0.567 -12.124 0.000 -6.878 -0.705
Supp_Score 5.355 0.476 11.255 0.000 5.355 0.648
Meaning_Score 5.347 0.526 10.161 0.000 5.347 0.586
Infant =~
imhbirthwt 0.430 0.026 16.847 0.000 0.430 0.949
imh_birthlt 1.719 0.144 11.937 0.000 1.719 0.727
imh_birthhcr 0.987 0.082 12.066 0.000 0.987 0.693
gawks 0.362 0.065 5.557 0.000 0.362 0.361
sex 0.087 0.031 2.811 0.005 0.087 0.175
SocioDem =~
MatAge 1.005 0.378 2.659 0.008 1.005 0.197
mmins_combined -0.160 0.041 -3.938 0.000 -0.160 -0.326
mrace_combined 0.288 0.079 3.650 0.000 0.288 0.247
pcedlevel 0.879 0.114 7.679 0.000 0.879 0.568
MomOnlyFSIQ 8.008 1.109 7.219 0.000 8.008 0.573
any_subuse_y_n -0.179 0.036 -4.928 0.000 -0.179 -0.394
hseincom -6.287 5.131 -1.225 0.220 -6.287 -0.054
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
Mat_Health ~~
MatMen_health -0.725 0.252 -2.875 0.004 -0.725 -0.725
Infant 0.016 0.141 0.112 0.911 0.016 0.016
SocioDem 0.130 0.171 0.761 0.447 0.130 0.130
MatMen_health ~~
Infant 0.150 0.064 2.344 0.019 0.150 0.150
SocioDem 0.221 0.068 3.244 0.001 0.221 0.221
Infant ~~
SocioDem 0.407 0.072 5.640 0.000 0.407 0.407
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.diabpprg 1.011 0.006 170.092 0.000 1.011 9.884
.gestdiab 1.057 0.013 78.931 0.000 1.057 4.546
.hyp 1.230 0.024 50.396 0.000 1.230 2.918
.prenatl_cllpsd 1.165 0.021 54.550 0.000 1.165 3.131
.hiv 1.024 0.012 82.905 0.000 1.024 4.868
.syph 1.034 0.014 75.810 0.000 1.034 4.452
.chlmyd 1.100 0.023 46.963 0.000 1.100 2.758
.collapsd_mnthl 2.014 0.055 36.503 0.000 2.014 2.144
.acescore 2.758 0.160 17.267 0.000 2.758 0.996
.Dep_Score 47.667 0.491 97.043 0.000 47.667 5.323
.Anx_Score 52.164 0.586 88.958 0.000 52.164 4.889
.Anger_Score 51.645 0.536 96.264 0.000 51.645 5.290
.Supp_Score 56.181 0.455 123.360 0.000 56.181 6.793
.Meaning_Score 59.531 0.501 118.714 0.000 59.531 6.524
.imhbirthwt 3.261 0.027 122.529 0.000 3.261 7.195
.imh_birthlt 50.265 0.138 363.413 0.000 50.265 21.267
.imh_birthhcr 34.200 0.083 410.346 0.000 34.200 24.013
.gawks 38.729 0.059 657.764 0.000 38.729 38.625
.sex 1.564 0.029 53.597 0.000 1.564 3.147
.MatAge 29.753 0.299 99.470 0.000 29.753 5.841
.mmins_combined 3.835 0.029 132.851 0.000 3.835 7.801
.mrace_combined 3.423 0.069 49.815 0.000 3.423 2.925
.pcedlevel 4.054 0.089 45.476 0.000 4.054 2.619
.MomOnlyFSIQ 94.385 0.778 121.311 0.000 94.385 6.758
.any_subuse_y_n 1.711 0.027 64.203 0.000 1.711 3.770
.hseincom 20.643 6.465 3.193 0.001 20.643 0.177
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.diabpprg 0.010 0.006 1.798 0.072 0.010 0.999
.gestdiab 0.054 0.012 4.558 0.000 0.054 1.000
.hyp 0.168 0.014 12.100 0.000 0.168 0.949
.prenatl_cllpsd 0.133 0.014 9.395 0.000 0.133 0.956
.hiv 0.044 0.023 1.934 0.053 0.044 0.983
.syph 0.053 0.024 2.256 0.024 0.053 0.990
.chlmyd 0.155 0.038 4.033 0.000 0.155 0.974
.collapsd_mnthl 0.790 0.035 22.883 0.000 0.790 0.895
.acescore 6.782 0.546 12.433 0.000 6.782 0.885
.Dep_Score 14.478 2.970 4.874 0.000 14.478 0.181
.Anx_Score 39.430 4.573 8.623 0.000 39.430 0.346
.Anger_Score 47.989 6.237 7.694 0.000 47.989 0.504
.Supp_Score 39.724 4.298 9.242 0.000 39.724 0.581
.Meaning_Score 54.675 5.472 9.993 0.000 54.675 0.657
.imhbirthwt 0.020 0.013 1.550 0.121 0.020 0.100
.imh_birthlt 2.631 0.416 6.324 0.000 2.631 0.471
.imh_birthhcr 1.055 0.127 8.320 0.000 1.055 0.520
.gawks 0.875 0.075 11.677 0.000 0.875 0.870
.sex 0.239 0.006 38.184 0.000 0.239 0.969
.MatAge 24.935 1.957 12.741 0.000 24.935 0.961
.mmins_combined 0.216 0.059 3.635 0.000 0.216 0.894
.mrace_combined 1.286 0.120 10.754 0.000 1.286 0.939
.pcedlevel 1.622 0.187 8.673 0.000 1.622 0.677
.MomOnlyFSIQ 130.921 15.759 8.307 0.000 130.921 0.671
.any_subuse_y_n 0.174 0.016 11.159 0.000 0.174 0.845
.hseincom 13636.875 4747.165 2.873 0.004 13636.875 0.997
Mat_Health 1.000 1.000 1.000
MatMen_health 1.000 1.000 1.000
Infant 1.000 1.000 1.000
SocioDem 1.000 1.000 1.000
parameterEstimates(M_model_fit, standardized=TRUE) %>%
filter(op == "=~") %>%
select('LV1'=lhs, 'LV2'=rhs, B=est, SE=se, Z=z, 'p-value'=pvalue, Beta=std.all,CI_Lower=ci.lower, CI_Upper=ci.upper) %>%
knitr::kable(digits = 3, format="html", booktabs=TRUE, caption="Factor Loadings for Measurement Model Exposure Group")%>%
kable_classic(full_width = F, html_font = "Cambria")| LV1 | LV2 | B | SE | Z | p-value | Beta | CI_Lower | CI_Upper |
|---|---|---|---|---|---|---|---|---|
| Mat_Health | diabpprg | 0.003 | 0.003 | 0.756 | 0.450 | 0.025 | -0.004 | 0.009 |
| Mat_Health | gestdiab | 0.004 | 0.014 | 0.252 | 0.801 | 0.015 | -0.024 | 0.031 |
| Mat_Health | hyp | 0.095 | 0.038 | 2.504 | 0.012 | 0.226 | 0.021 | 0.170 |
| Mat_Health | prenatal_collapsed | 0.078 | 0.034 | 2.268 | 0.023 | 0.209 | 0.011 | 0.145 |
| Mat_Health | hiv | -0.027 | 0.021 | -1.308 | 0.191 | -0.129 | -0.068 | 0.014 |
| Mat_Health | syph | 0.024 | 0.020 | 1.184 | 0.236 | 0.101 | -0.015 | 0.063 |
| Mat_Health | chlmyd | 0.064 | 0.038 | 1.695 | 0.090 | 0.161 | -0.010 | 0.139 |
| MatMen_health | collapsed_mentheal | 0.305 | 0.051 | 5.943 | 0.000 | 0.325 | 0.204 | 0.405 |
| MatMen_health | acescore | -0.938 | 0.152 | -6.160 | 0.000 | -0.339 | -1.237 | -0.640 |
| MatMen_health | Dep_Score | -8.107 | 0.428 | -18.925 | 0.000 | -0.905 | -8.947 | -7.267 |
| MatMen_health | Anx_Score | -8.627 | 0.442 | -19.517 | 0.000 | -0.808 | -9.493 | -7.760 |
| MatMen_health | Anger_Score | -6.878 | 0.567 | -12.124 | 0.000 | -0.705 | -7.990 | -5.766 |
| MatMen_health | Supp_Score | 5.355 | 0.476 | 11.255 | 0.000 | 0.648 | 4.423 | 6.288 |
| MatMen_health | Meaning_Score | 5.347 | 0.526 | 10.161 | 0.000 | 0.586 | 4.315 | 6.378 |
| Infant | imhbirthwt | 0.430 | 0.026 | 16.847 | 0.000 | 0.949 | 0.380 | 0.480 |
| Infant | imh_birthlt | 1.719 | 0.144 | 11.937 | 0.000 | 0.727 | 1.437 | 2.001 |
| Infant | imh_birthhcr | 0.987 | 0.082 | 12.066 | 0.000 | 0.693 | 0.827 | 1.147 |
| Infant | gawks | 0.362 | 0.065 | 5.557 | 0.000 | 0.361 | 0.234 | 0.489 |
| Infant | sex | 0.087 | 0.031 | 2.811 | 0.005 | 0.175 | 0.026 | 0.147 |
| SocioDem | MatAge | 1.005 | 0.378 | 2.659 | 0.008 | 0.197 | 0.264 | 1.746 |
| SocioDem | mmins_combined | -0.160 | 0.041 | -3.938 | 0.000 | -0.326 | -0.240 | -0.080 |
| SocioDem | mrace_combined | 0.288 | 0.079 | 3.650 | 0.000 | 0.247 | 0.134 | 0.443 |
| SocioDem | pcedlevel | 0.879 | 0.114 | 7.679 | 0.000 | 0.568 | 0.655 | 1.104 |
| SocioDem | MomOnlyFSIQ | 8.008 | 1.109 | 7.219 | 0.000 | 0.573 | 5.834 | 10.183 |
| SocioDem | any_subuse_y_n | -0.179 | 0.036 | -4.928 | 0.000 | -0.394 | -0.250 | -0.108 |
| SocioDem | hseincom | -6.287 | 5.131 | -1.225 | 0.220 | -0.054 | -16.345 | 3.770 |
SEM_model_2 <- '
Mat_Health =~ diabpprg + gestdiab + hyp + prenatal_collapsed + hiv + syph + chlmyd
MatMen_health =~ collapsed_mentheal + acescore + Dep_Score + Anx_Score + Anger_Score + Supp_Score + Meaning_Score
Infant =~ imhbirthwt + imh_birthlt + imh_birthhcr + gawks + sex
SocioDem =~ MatAge + mmins_combined + mrace_combined + pcedlevel + MomOnlyFSIQ + any_subuse_y_n + hseincom
any_subuse_y_n ~~ mrace_combined
Mat_Health~~MatMen_health
Mat_Health ~ a*SocioDem
MatMen_health ~ b*SocioDem
Infant ~ c*Mat_Health + d*MatMen_health + e*SocioDem
n2attention ~ f*Infant
n2regulation ~ g*Infant
n2arousal ~ h*Infant
n2tone ~ i*Infant
n2nonoptref ~ j*Infant
n2qmove ~ k*Infant
n2stress ~ l*Infant
'
SEM_model_fit_2 <- sem(SEM_model_2, estimator= "WLSMV", data=cleaned_data_final2.1, std.lv=TRUE,missing = "pairwise", mimic = "Mplus")Warning: lavaan->lav_options_est_dwls():
estimator "DWLS" is not recommended for continuous data. Did you forget to
set the ordered= argument?
Warning: lavaan->lav_data_full():
some observed variances are (at least) a factor 1000 times larger than
others; use varTable(fit) to investigate
Warning: lavaan->lav_samplestats_from_data():
number of observations (291) too small to compute Gamma
Warning: lavaan->lav_model_vcov():
The variance-covariance matrix of the estimated parameters (vcov) does not
appear to be positive definite! The smallest eigenvalue (= -5.003690e-06)
is smaller than zero. This may be a symptom that the model is not
identified.
summary(SEM_model_fit_2, fit.measures = TRUE, standardized=TRUE)lavaan 0.6-19 ended normally after 122 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 127
Number of observations 291
Number of missing patterns 37
Model Test User Model:
Standard Scaled
Test Statistic 795.177 654.339
Degrees of freedom 467 467
P-value (Chi-square) 0.000 0.000
Scaling correction factor 2.142
Shift parameter 283.111
simple second-order correction (WLSMV)
Model Test Baseline Model:
Test statistic 2686.722 1337.787
Degrees of freedom 528 528
P-value 0.000 0.000
Scaling correction factor 2.666
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.848 0.769
Tucker-Lewis Index (TLI) 0.828 0.738
Robust Comparative Fit Index (CFI) 0.848
Robust Tucker-Lewis Index (TLI) 0.828
Root Mean Square Error of Approximation:
RMSEA 0.049 0.037
90 Percent confidence interval - lower 0.043 0.030
90 Percent confidence interval - upper 0.055 0.044
P-value H_0: RMSEA <= 0.050 0.579 1.000
P-value H_0: RMSEA >= 0.080 0.000 0.000
Robust RMSEA 0.054
90 Percent confidence interval - lower 0.044
90 Percent confidence interval - upper 0.064
P-value H_0: Robust RMSEA <= 0.050 0.227
P-value H_0: Robust RMSEA >= 0.080 0.000
Standardized Root Mean Square Residual:
SRMR 0.065 0.065
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
Mat_Health =~
diabpprg 0.003 0.003 0.758 0.449 0.003 0.025
gestdiab 0.003 0.014 0.241 0.810 0.003 0.015
hyp 0.094 0.038 2.468 0.014 0.095 0.225
prenatl_cllpsd 0.077 0.034 2.246 0.025 0.078 0.210
hiv -0.027 0.020 -1.314 0.189 -0.027 -0.129
syph 0.023 0.020 1.181 0.238 0.024 0.101
chlmyd 0.064 0.038 1.698 0.090 0.065 0.162
MatMen_health =~
collapsd_mnthl 0.297 0.051 5.832 0.000 0.306 0.325
acescore -0.905 0.149 -6.087 0.000 -0.930 -0.336
Dep_Score -7.884 0.425 -18.542 0.000 -8.107 -0.905
Anx_Score -8.351 0.459 -18.186 0.000 -8.588 -0.805
Anger_Score -6.716 0.557 -12.067 0.000 -6.906 -0.707
Supp_Score 5.255 0.471 11.148 0.000 5.404 0.653
Meaning_Score 5.176 0.534 9.687 0.000 5.323 0.583
Infant =~
imhbirthwt 0.371 0.028 13.470 0.000 0.416 0.918
imh_birthlt 1.522 0.143 10.674 0.000 1.709 0.723
imh_birthhcr 0.844 0.082 10.337 0.000 0.948 0.666
gawks 0.298 0.058 5.094 0.000 0.334 0.333
sex 0.076 0.028 2.690 0.007 0.086 0.172
SocioDem =~
MatAge 0.870 0.378 2.300 0.021 0.870 0.171
mmins_combined -0.150 0.040 -3.783 0.000 -0.150 -0.305
mrace_combined 0.403 0.086 4.708 0.000 0.403 0.345
pcedlevel 0.788 0.111 7.100 0.000 0.788 0.509
MomOnlyFSIQ 7.757 1.061 7.312 0.000 7.757 0.555
any_subuse_y_n -0.213 0.037 -5.714 0.000 -0.213 -0.470
hseincom -6.700 5.511 -1.216 0.224 -6.700 -0.057
Regressions:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
Mat_Health ~
SocioDem (a) 0.124 0.176 0.704 0.482 0.123 0.123
MatMen_health ~
SocioDem (b) 0.240 0.072 3.318 0.001 0.233 0.233
Infant ~
Mat_Health (c) 0.099 0.422 0.236 0.814 0.089 0.089
MatMn_hlth (d) 0.181 0.354 0.511 0.609 0.166 0.166
SocioDem (e) 0.441 0.167 2.636 0.008 0.393 0.393
n2attention ~
Infant (f) -0.010 0.069 -0.140 0.888 -0.011 -0.009
n2regulation ~
Infant (g) 0.003 0.061 0.042 0.966 0.003 0.003
n2arousal ~
Infant (h) 0.089 0.098 0.909 0.363 0.100 0.063
n2tone ~
Infant (i) -0.060 0.031 -1.943 0.052 -0.067 -0.121
n2nonoptref ~
Infant (j) -0.223 0.063 -3.516 0.000 -0.250 -0.221
n2qmove ~
Infant (k) 0.111 0.070 1.587 0.112 0.125 0.105
n2stress ~
Infant (l) -0.046 0.035 -1.316 0.188 -0.051 -0.073
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.mrace_combined ~~
.any_subuse_y_n 0.202 0.035 5.702 0.000 0.202 0.458
.Mat_Health ~~
.MatMen_health -0.781 0.271 -2.883 0.004 -0.781 -0.781
.n2attention ~~
.n2regulation 0.297 0.084 3.525 0.000 0.297 0.215
.n2arousal -0.518 0.109 -4.734 0.000 -0.518 -0.255
.n2tone 0.009 0.040 0.238 0.811 0.009 0.013
.n2nonoptref 0.122 0.076 1.600 0.110 0.122 0.087
.n2qmove 0.186 0.077 2.414 0.016 0.186 0.123
.n2stress 0.057 0.044 1.302 0.193 0.057 0.064
.n2regulation ~~
.n2arousal -0.478 0.095 -5.034 0.000 -0.478 -0.279
.n2tone -0.019 0.034 -0.561 0.575 -0.019 -0.032
.n2nonoptref -0.039 0.080 -0.489 0.625 -0.039 -0.033
.n2qmove 0.136 0.075 1.813 0.070 0.136 0.106
.n2stress -0.077 0.047 -1.657 0.097 -0.077 -0.103
.n2arousal ~~
.n2tone 0.323 0.063 5.122 0.000 0.323 0.369
.n2nonoptref 0.031 0.104 0.293 0.769 0.031 0.017
.n2qmove -0.378 0.131 -2.879 0.004 -0.378 -0.200
.n2stress 0.429 0.074 5.789 0.000 0.429 0.386
.n2tone ~~
.n2nonoptref -0.044 0.048 -0.911 0.362 -0.044 -0.073
.n2qmove -0.088 0.055 -1.583 0.113 -0.088 -0.134
.n2stress 0.155 0.037 4.230 0.000 0.155 0.403
.n2nonoptref ~~
.n2qmove -0.282 0.085 -3.332 0.001 -0.282 -0.215
.n2stress 0.178 0.047 3.747 0.000 0.178 0.231
.n2qmove ~~
.n2stress -0.383 0.062 -6.134 0.000 -0.383 -0.461
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.diabpprg 1.011 0.006 170.092 0.000 1.011 9.884
.gestdiab 1.057 0.013 78.931 0.000 1.057 4.546
.hyp 1.230 0.024 50.396 0.000 1.230 2.918
.prenatl_cllpsd 1.165 0.021 54.550 0.000 1.165 3.131
.hiv 1.024 0.012 82.905 0.000 1.024 4.868
.syph 1.034 0.014 75.810 0.000 1.034 4.452
.chlmyd 1.100 0.023 46.963 0.000 1.100 2.758
.collapsd_mnthl 2.014 0.055 36.503 0.000 2.014 2.144
.acescore 2.758 0.160 17.267 0.000 2.758 0.996
.Dep_Score 47.667 0.491 97.043 0.000 47.667 5.323
.Anx_Score 52.164 0.586 88.958 0.000 52.164 4.889
.Anger_Score 51.645 0.536 96.264 0.000 51.645 5.290
.Supp_Score 56.181 0.455 123.360 0.000 56.181 6.793
.Meaning_Score 59.531 0.501 118.714 0.000 59.531 6.524
.imhbirthwt 3.261 0.027 122.529 0.000 3.261 7.195
.imh_birthlt 50.265 0.138 363.413 0.000 50.265 21.267
.imh_birthhcr 34.200 0.083 410.346 0.000 34.200 24.013
.gawks 38.729 0.059 657.764 0.000 38.729 38.625
.sex 1.564 0.029 53.597 0.000 1.564 3.147
.MatAge 29.753 0.299 99.470 0.000 29.753 5.841
.mmins_combined 3.835 0.029 132.851 0.000 3.835 7.801
.mrace_combined 3.423 0.069 49.815 0.000 3.423 2.925
.pcedlevel 4.054 0.089 45.476 0.000 4.054 2.619
.MomOnlyFSIQ 94.385 0.778 121.311 0.000 94.385 6.758
.any_subuse_y_n 1.711 0.027 64.203 0.000 1.711 3.770
.hseincom 20.643 6.465 3.193 0.001 20.643 0.177
.n2attention 4.627 0.071 65.274 0.000 4.627 3.622
.n2regulation 4.201 0.063 66.678 0.000 4.201 3.895
.n2arousal 4.640 0.093 49.658 0.000 4.640 2.911
.n2tone 4.940 0.033 152.002 0.000 4.940 8.926
.n2nonoptref 3.122 0.066 47.107 0.000 3.122 2.761
.n2qmove 6.697 0.070 95.993 0.000 6.697 5.608
.n2stress 1.637 0.041 39.871 0.000 1.637 2.337
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.diabpprg 0.010 0.006 1.798 0.072 0.010 0.999
.gestdiab 0.054 0.012 4.558 0.000 0.054 1.000
.hyp 0.169 0.014 12.112 0.000 0.169 0.949
.prenatl_cllpsd 0.133 0.014 9.395 0.000 0.133 0.956
.hiv 0.044 0.023 1.934 0.053 0.044 0.983
.syph 0.053 0.024 2.256 0.024 0.053 0.990
.chlmyd 0.155 0.038 4.032 0.000 0.155 0.974
.collapsd_mnthl 0.789 0.035 22.759 0.000 0.789 0.894
.acescore 6.797 0.547 12.428 0.000 6.797 0.887
.Dep_Score 14.472 3.033 4.771 0.000 14.472 0.180
.Anx_Score 40.095 4.707 8.517 0.000 40.095 0.352
.Anger_Score 47.607 6.244 7.624 0.000 47.607 0.500
.Supp_Score 39.203 4.305 9.106 0.000 39.203 0.573
.Meaning_Score 54.928 5.518 9.955 0.000 54.928 0.660
.imhbirthwt 0.032 0.014 2.383 0.017 0.032 0.157
.imh_birthlt 2.665 0.432 6.174 0.000 2.665 0.477
.imh_birthhcr 1.130 0.133 8.493 0.000 1.130 0.557
.gawks 0.894 0.077 11.669 0.000 0.894 0.889
.sex 0.239 0.006 37.875 0.000 0.239 0.970
.MatAge 25.188 1.960 12.853 0.000 25.188 0.971
.mmins_combined 0.219 0.059 3.727 0.000 0.219 0.907
.mrace_combined 1.206 0.117 10.348 0.000 1.206 0.881
.pcedlevel 1.774 0.168 10.559 0.000 1.774 0.741
.MomOnlyFSIQ 134.895 14.541 9.277 0.000 134.895 0.692
.any_subuse_y_n 0.161 0.018 9.136 0.000 0.161 0.779
.hseincom 13631.554 4744.188 2.873 0.004 13631.554 0.997
.n2attention 1.632 0.133 12.292 0.000 1.632 1.000
.n2regulation 1.163 0.098 11.870 0.000 1.163 1.000
.n2arousal 2.530 0.165 15.336 0.000 2.530 0.996
.n2tone 0.302 0.042 7.135 0.000 0.302 0.985
.n2nonoptref 1.216 0.128 9.476 0.000 1.216 0.951
.n2qmove 1.410 0.127 11.094 0.000 1.410 0.989
.n2stress 0.488 0.056 8.752 0.000 0.488 0.995
.Mat_Health 1.000 0.985 0.985
.MatMen_health 1.000 0.946 0.946
.Infant 1.000 0.793 0.793
SocioDem 1.000 1.000 1.000
##Regression Table
parameterEstimates(SEM_model_fit_2, standardized=TRUE) %>%
filter(op == "~") %>%
select('LV1'=lhs, 'LV2'=rhs, B=est, SE=se, Z=z, 'p-value'=pvalue, Beta=std.all,CI_Lower=ci.lower, CI_Upper=ci.upper) %>%
knitr::kable(digits = 3, format="html", booktabs=TRUE, caption="Total Sample Regressions")%>%
kable_classic(full_width = F, html_font = "Cambria")| LV1 | LV2 | B | SE | Z | p-value | Beta | CI_Lower | CI_Upper |
|---|---|---|---|---|---|---|---|---|
| Mat_Health | SocioDem | 0.124 | 0.176 | 0.704 | 0.482 | 0.123 | -0.221 | 0.468 |
| MatMen_health | SocioDem | 0.240 | 0.072 | 3.318 | 0.001 | 0.233 | 0.098 | 0.381 |
| Infant | Mat_Health | 0.099 | 0.422 | 0.236 | 0.814 | 0.089 | -0.727 | 0.926 |
| Infant | MatMen_health | 0.181 | 0.354 | 0.511 | 0.609 | 0.166 | -0.513 | 0.876 |
| Infant | SocioDem | 0.441 | 0.167 | 2.636 | 0.008 | 0.393 | 0.113 | 0.769 |
| n2attention | Infant | -0.010 | 0.069 | -0.140 | 0.888 | -0.009 | -0.146 | 0.126 |
| n2regulation | Infant | 0.003 | 0.061 | 0.042 | 0.966 | 0.003 | -0.116 | 0.121 |
| n2arousal | Infant | 0.089 | 0.098 | 0.909 | 0.363 | 0.063 | -0.103 | 0.282 |
| n2tone | Infant | -0.060 | 0.031 | -1.943 | 0.052 | -0.121 | -0.120 | 0.001 |
| n2nonoptref | Infant | -0.223 | 0.063 | -3.516 | 0.000 | -0.221 | -0.347 | -0.099 |
| n2qmove | Infant | 0.111 | 0.070 | 1.587 | 0.112 | 0.105 | -0.026 | 0.249 |
| n2stress | Infant | -0.046 | 0.035 | -1.316 | 0.188 | -0.073 | -0.114 | 0.022 |
SEM_model_3 <- '
MatMen_health =~ collapsed_mentheal + acescore + Dep_Score + Anx_Score + Anger_Score + Supp_Score + Meaning_Score
Infant =~ imhbirthwt + imh_birthlt + imh_birthhcr + gawks + sex
SocioDem =~ MatAge + mmins_combined + mrace_combined + pcedlevel + MomOnlyFSIQ + any_subuse_y_n + hseincom
#Regressions
diabpprg ~ SocioDem
gestdiab ~ SocioDem
hyp ~ SocioDem
prenatal_collapsed ~ SocioDem
hiv ~ SocioDem
syph ~ SocioDem
chlmyd ~ SocioDem
MatMen_health ~ SocioDem
Infant ~ diabpprg + gestdiab + hyp + prenatal_collapsed + hiv + syph + chlmyd + any_subuse_y_n + MatMen_health + SocioDem
final_nnns_class ~ Infant
'
SEM_model_fit_3 <- sem(SEM_model_3, estimator= "WLSMV", data=cleaned_data_final2.1, std.lv=TRUE, missing = "pairwise", mimic = "Mplus")Warning: lavaan->lav_options_est_dwls():
estimator "DWLS" is not recommended for continuous data. Did you forget to
set the ordered= argument?
Warning: lavaan->lav_data_full():
some observed variances are (at least) a factor 1000 times larger than
others; use varTable(fit) to investigate
Warning: lavaan->lav_samplestats_from_data():
number of observations (291) too small to compute Gamma
Warning: lavaan->lav_model_vcov():
The variance-covariance matrix of the estimated parameters (vcov) does not
appear to be positive definite! The smallest eigenvalue (= -4.272624e-06)
is smaller than zero. This may be a symptom that the model is not
identified.
summary(SEM_model_fit_3, fit.measures = TRUE, standardized=TRUE)lavaan 0.6-19 ended normally after 141 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 92
Number of observations 291
Number of missing patterns 27
Model Test User Model:
Standard Scaled
Test Statistic 517.691 448.038
Degrees of freedom 313 313
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.926
Shift parameter 179.182
simple second-order correction (WLSMV)
Model Test Baseline Model:
Test statistic 2073.048 1058.213
Degrees of freedom 351 351
P-value 0.000 0.000
Scaling correction factor 2.435
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.881 0.809
Tucker-Lewis Index (TLI) 0.867 0.786
Robust Comparative Fit Index (CFI) 0.881
Robust Tucker-Lewis Index (TLI) 0.867
Root Mean Square Error of Approximation:
RMSEA 0.047 0.039
90 Percent confidence interval - lower 0.040 0.030
90 Percent confidence interval - upper 0.055 0.046
P-value H_0: RMSEA <= 0.050 0.710 0.993
P-value H_0: RMSEA >= 0.080 0.000 0.000
Robust RMSEA 0.054
90 Percent confidence interval - lower 0.042
90 Percent confidence interval - upper 0.064
P-value H_0: Robust RMSEA <= 0.050 0.296
P-value H_0: Robust RMSEA >= 0.080 0.000
Standardized Root Mean Square Residual:
SRMR 0.064 0.064
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
MatMen_health =~
collapsd_mnthl 0.290 0.051 5.727 0.000 0.301 0.320
acescore -0.899 0.147 -6.102 0.000 -0.933 -0.337
Dep_Score -7.908 0.431 -18.366 0.000 -8.207 -0.916
Anx_Score -8.279 0.463 -17.889 0.000 -8.592 -0.805
Anger_Score -6.583 0.572 -11.517 0.000 -6.832 -0.700
Supp_Score 5.233 0.479 10.929 0.000 5.430 0.657
Meaning_Score 5.085 0.533 9.546 0.000 5.277 0.578
Infant =~
imhbirthwt 0.383 0.029 13.249 0.000 0.431 0.951
imh_birthlt 1.493 0.141 10.593 0.000 1.681 0.711
imh_birthhcr 0.882 0.079 11.183 0.000 0.993 0.697
gawks 0.336 0.058 5.805 0.000 0.378 0.377
sex 0.075 0.027 2.744 0.006 0.084 0.169
SocioDem =~
MatAge 0.926 0.384 2.412 0.016 0.926 0.182
mmins_combined -0.179 0.042 -4.247 0.000 -0.179 -0.364
mrace_combined 0.290 0.080 3.630 0.000 0.290 0.248
pcedlevel 0.839 0.113 7.434 0.000 0.839 0.542
MomOnlyFSIQ 7.268 1.105 6.574 0.000 7.268 0.520
any_subuse_y_n -0.171 0.038 -4.471 0.000 -0.171 -0.377
hseincom -4.040 4.443 -0.909 0.363 -4.040 -0.035
Regressions:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
diabpprg ~
SocioDem -0.001 0.002 -0.578 0.564 -0.001 -0.010
gestdiab ~
SocioDem 0.028 0.024 1.131 0.258 0.028 0.119
hyp ~
SocioDem -0.018 0.037 -0.481 0.631 -0.018 -0.042
prenatal_collapsed ~
SocioDem -0.072 0.024 -2.942 0.003 -0.072 -0.193
hiv ~
SocioDem -0.010 0.007 -1.581 0.114 -0.010 -0.049
syph ~
SocioDem 0.000 0.013 0.026 0.979 0.000 0.001
chlmyd ~
SocioDem -0.043 0.020 -2.161 0.031 -0.043 -0.109
MatMen_health ~
SocioDem 0.277 0.073 3.811 0.000 0.267 0.267
Infant ~
diabpprg -1.033 0.297 -3.481 0.000 -0.918 -0.094
gestdiab -0.133 0.287 -0.462 0.644 -0.118 -0.027
hyp -0.311 0.175 -1.779 0.075 -0.276 -0.116
prenatl_cllpsd 0.286 0.217 1.320 0.187 0.254 0.095
hiv -0.142 0.150 -0.945 0.345 -0.126 -0.027
syph 0.040 0.241 0.166 0.869 0.035 0.008
chlmyd 0.293 0.131 2.234 0.025 0.260 0.104
any_subuse_y_n -0.150 0.180 -0.832 0.406 -0.133 -0.060
MatMen_health 0.049 0.070 0.701 0.483 0.045 0.045
SocioDem 0.444 0.129 3.431 0.001 0.395 0.395
final_nnns_class ~
Infant -0.015 0.056 -0.265 0.791 -0.017 -0.016
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.collapsd_mnthl 2.014 0.055 36.503 0.000 2.014 2.144
.acescore 2.758 0.160 17.267 0.000 2.758 0.996
.Dep_Score 47.667 0.491 97.043 0.000 47.667 5.323
.Anx_Score 52.164 0.586 88.958 0.000 52.164 4.889
.Anger_Score 51.645 0.536 96.264 0.000 51.645 5.290
.Supp_Score 56.181 0.455 123.360 0.000 56.181 6.793
.Meaning_Score 59.531 0.501 118.714 0.000 59.531 6.524
.imhbirthwt 3.748 0.305 12.287 0.000 3.748 8.269
.imh_birthlt 52.164 1.204 43.326 0.000 52.164 22.070
.imh_birthhcr 35.321 0.703 50.228 0.000 35.321 24.800
.gawks 39.155 0.275 142.405 0.000 39.155 39.051
.sex 1.659 0.076 21.886 0.000 1.659 3.339
.MatAge 29.753 0.299 99.470 0.000 29.753 5.841
.mmins_combined 3.835 0.029 132.851 0.000 3.835 7.801
.mrace_combined 3.423 0.069 49.815 0.000 3.423 2.925
.pcedlevel 4.054 0.089 45.476 0.000 4.054 2.619
.MomOnlyFSIQ 94.385 0.778 121.311 0.000 94.385 6.758
.any_subuse_y_n 1.711 0.027 64.203 0.000 1.711 3.770
.hseincom 20.643 6.465 3.193 0.001 20.643 0.177
.diabpprg 1.011 0.006 170.092 0.000 1.011 9.884
.gestdiab 1.057 0.013 78.931 0.000 1.057 4.546
.hyp 1.230 0.024 50.396 0.000 1.230 2.918
.prenatl_cllpsd 1.165 0.021 54.550 0.000 1.165 3.131
.hiv 1.024 0.012 82.905 0.000 1.024 4.868
.syph 1.034 0.014 75.810 0.000 1.034 4.452
.chlmyd 1.100 0.023 46.963 0.000 1.100 2.758
.finl_nnns_clss 2.119 0.096 22.040 0.000 2.119 2.068
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.collapsd_mnthl 0.792 0.034 23.015 0.000 0.792 0.897
.acescore 6.793 0.548 12.405 0.000 6.793 0.886
.Dep_Score 12.846 2.997 4.286 0.000 12.846 0.160
.Anx_Score 40.027 4.671 8.569 0.000 40.027 0.352
.Anger_Score 48.628 6.386 7.615 0.000 48.628 0.510
.Supp_Score 38.914 4.203 9.258 0.000 38.914 0.569
.Meaning_Score 55.411 5.425 10.214 0.000 55.411 0.666
.imhbirthwt 0.020 0.013 1.557 0.119 0.020 0.095
.imh_birthlt 2.760 0.422 6.541 0.000 2.760 0.494
.imh_birthhcr 1.043 0.126 8.259 0.000 1.043 0.514
.gawks 0.862 0.075 11.495 0.000 0.862 0.858
.sex 0.240 0.006 39.070 0.000 0.240 0.971
.MatAge 25.089 1.958 12.812 0.000 25.089 0.967
.mmins_combined 0.210 0.059 3.527 0.000 0.210 0.868
.mrace_combined 1.285 0.120 10.701 0.000 1.285 0.939
.pcedlevel 1.691 0.181 9.341 0.000 1.691 0.706
.MomOnlyFSIQ 142.239 15.042 9.456 0.000 142.239 0.729
.any_subuse_y_n 0.177 0.016 11.012 0.000 0.177 0.858
.hseincom 13660.090 4763.506 2.868 0.004 13660.090 0.999
.diabpprg 0.010 0.006 1.797 0.072 0.010 1.000
.gestdiab 0.053 0.012 4.597 0.000 0.053 0.986
.hyp 0.177 0.013 13.415 0.000 0.177 0.998
.prenatl_cllpsd 0.133 0.014 9.835 0.000 0.133 0.963
.hiv 0.044 0.023 1.892 0.058 0.044 0.998
.syph 0.054 0.024 2.274 0.023 0.054 1.000
.chlmyd 0.157 0.039 4.067 0.000 0.157 0.988
.finl_nnns_clss 1.050 0.060 17.395 0.000 1.050 1.000
.MatMen_health 1.000 0.929 0.929
.Infant 1.000 0.789 0.789
SocioDem 1.000 1.000 1.000
##Regression Table
parameterEstimates(SEM_model_fit_3, standardized=TRUE) %>%
filter(op == "~") %>%
select('LV1'=lhs, 'LV2'=rhs, B=est, SE=se, Z=z, 'p-value'=pvalue, Beta=std.all,CI_Lower=ci.lower, CI_Upper=ci.upper) %>%
knitr::kable(digits = 3, format="html", booktabs=TRUE, caption="Total Sample Regressions")%>%
kable_classic(full_width = F, html_font = "Cambria")| LV1 | LV2 | B | SE | Z | p-value | Beta | CI_Lower | CI_Upper |
|---|---|---|---|---|---|---|---|---|
| diabpprg | SocioDem | -0.001 | 0.002 | -0.578 | 0.564 | -0.010 | -0.005 | 0.003 |
| gestdiab | SocioDem | 0.028 | 0.024 | 1.131 | 0.258 | 0.119 | -0.020 | 0.076 |
| hyp | SocioDem | -0.018 | 0.037 | -0.481 | 0.631 | -0.042 | -0.090 | 0.054 |
| prenatal_collapsed | SocioDem | -0.072 | 0.024 | -2.942 | 0.003 | -0.193 | -0.120 | -0.024 |
| hiv | SocioDem | -0.010 | 0.007 | -1.581 | 0.114 | -0.049 | -0.023 | 0.002 |
| syph | SocioDem | 0.000 | 0.013 | 0.026 | 0.979 | 0.001 | -0.024 | 0.025 |
| chlmyd | SocioDem | -0.043 | 0.020 | -2.161 | 0.031 | -0.109 | -0.083 | -0.004 |
| MatMen_health | SocioDem | 0.277 | 0.073 | 3.811 | 0.000 | 0.267 | 0.135 | 0.420 |
| Infant | diabpprg | -1.033 | 0.297 | -3.481 | 0.000 | -0.094 | -1.615 | -0.452 |
| Infant | gestdiab | -0.133 | 0.287 | -0.462 | 0.644 | -0.027 | -0.695 | 0.430 |
| Infant | hyp | -0.311 | 0.175 | -1.779 | 0.075 | -0.116 | -0.654 | 0.032 |
| Infant | prenatal_collapsed | 0.286 | 0.217 | 1.320 | 0.187 | 0.095 | -0.139 | 0.711 |
| Infant | hiv | -0.142 | 0.150 | -0.945 | 0.345 | -0.027 | -0.436 | 0.153 |
| Infant | syph | 0.040 | 0.241 | 0.166 | 0.869 | 0.008 | -0.433 | 0.512 |
| Infant | chlmyd | 0.293 | 0.131 | 2.234 | 0.025 | 0.104 | 0.036 | 0.550 |
| Infant | any_subuse_y_n | -0.150 | 0.180 | -0.832 | 0.406 | -0.060 | -0.503 | 0.203 |
| Infant | MatMen_health | 0.049 | 0.070 | 0.701 | 0.483 | 0.045 | -0.089 | 0.187 |
| Infant | SocioDem | 0.444 | 0.129 | 3.431 | 0.001 | 0.395 | 0.191 | 0.698 |
| final_nnns_class | Infant | -0.015 | 0.056 | -0.265 | 0.791 | -0.016 | -0.124 | 0.094 |
SEM_model_v2 <- '
Mat_Health =~ diabpprg + gestdiab + prenatal_collapsed + hiv + hyp + syph + chlmyd
MatMen_health =~ collapsed_mentheal + acescore + Dep_Score + Anx_Score + Anger_Score + Supp_Score + Meaning_Score
Infant =~ imhbirthwt + imh_birthlt + imh_birthhcr + gawks + sex
SocioDem =~ MatAge + mmins_combined + mrace_combined + pcedlevel + MomOnlyFSIQ + any_subuse_y_n + hseincom
hepc ~~ any_subuse_y_n
Mat_Health~~MatMen_health
SocioDem~~MatMen_health
SocioDem~~Mat_Health
Infant ~ Mat_Health + MatMen_health + SocioDem
final_nnns_class ~ Infant
'
SEM_model_fit_v2 <- sem(SEM_model_v2,estimator= "WLSMV", data=cleaned_data_final2.1, std.lv=TRUE,missing = "pairwise", mimic = "Mplus")Warning: lavaan->lav_options_est_dwls():
estimator "DWLS" is not recommended for continuous data. Did you forget to
set the ordered= argument?
Warning: lavaan->lav_data_full():
some observed variances are (at least) a factor 1000 times larger than
others; use varTable(fit) to investigate
Warning: lavaan->lav_samplestats_from_data():
number of observations (291) too small to compute Gamma
Warning: lavaan->lav_model_vcov():
The variance-covariance matrix of the estimated parameters (vcov) does not
appear to be positive definite! The smallest eigenvalue (= -5.995598e-06)
is smaller than zero. This may be a symptom that the model is not
identified.
SEM_model_2.1 <- '
MatMen_health =~ collapsed_mentheal + acescore + Dep_Score + Anx_Score + Anger_Score + Supp_Score + Meaning_Score
Infant =~ imhbirthwt + imh_birthlt + imh_birthhcr + gawks + sex
SocioDem =~ MatAge + mmins_combined + mrace_combined + pcedlevel + MomOnlyFSIQ + any_subuse_y_n + hseincom
any_subuse_y_n ~~ mrace_combined
#Regressions
diabpprg ~ SocioDem
gestdiab ~ SocioDem
hyp ~ SocioDem
prenatal_collapsed ~ SocioDem
hiv ~ SocioDem
syph ~ SocioDem
chlmyd ~ SocioDem
MatMen_health ~ SocioDem
Infant ~ MatMen_health + SocioDem
Infant ~ diabpprg
Infant ~ gestdiab
Infant ~ hyp
Infant ~ prenatal_collapsed
Infant ~ hiv
Infant ~ syph
Infant ~ chlmyd
n2attention ~ Infant
n2regulation ~ Infant
n2arousal ~ Infant
n2tone ~ Infant
n2nonoptref ~ Infant
n2qmove ~ Infant
n2stress ~ Infant
'
SEM_model_fit_2.1 <- sem(SEM_model_2.1, estimator= "WLSMV", data=cleaned_data_final2.1, std.lv=TRUE,missing = "pairwise", mimic = "Mplus")Warning: lavaan->lav_options_est_dwls():
estimator "DWLS" is not recommended for continuous data. Did you forget to
set the ordered= argument?
Warning: lavaan->lav_data_full():
some observed variances are (at least) a factor 1000 times larger than
others; use varTable(fit) to investigate
Warning: lavaan->lav_samplestats_from_data():
number of observations (291) too small to compute Gamma
Warning: lavaan->lav_model_vcov():
The variance-covariance matrix of the estimated parameters (vcov) does not
appear to be positive definite! The smallest eigenvalue (= -5.105985e-06)
is smaller than zero. This may be a symptom that the model is not
identified.
summary(SEM_model_fit_2.1, fit.measures = TRUE, standardized=TRUE)lavaan 0.6-19 ended normally after 161 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 131
Number of observations 291
Number of missing patterns 37
Model Test User Model:
Standard Scaled
Test Statistic 825.060 658.661
Degrees of freedom 463 463
P-value (Chi-square) 0.000 0.000
Scaling correction factor 2.196
Shift parameter 283.026
simple second-order correction (WLSMV)
Model Test Baseline Model:
Test statistic 2686.722 1337.787
Degrees of freedom 528 528
P-value 0.000 0.000
Scaling correction factor 2.666
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.832 0.758
Tucker-Lewis Index (TLI) 0.809 0.724
Robust Comparative Fit Index (CFI) 0.832
Robust Tucker-Lewis Index (TLI) 0.809
Root Mean Square Error of Approximation:
RMSEA 0.052 0.038
90 Percent confidence interval - lower 0.046 0.031
90 Percent confidence interval - upper 0.058 0.045
P-value H_0: RMSEA <= 0.050 0.286 0.999
P-value H_0: RMSEA >= 0.080 0.000 0.000
Robust RMSEA 0.057
90 Percent confidence interval - lower 0.046
90 Percent confidence interval - upper 0.066
P-value H_0: Robust RMSEA <= 0.050 0.138
P-value H_0: Robust RMSEA >= 0.080 0.000
Standardized Root Mean Square Residual:
SRMR 0.067 0.067
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
MatMen_health =~
collapsd_mnthl 0.289 0.051 5.720 0.000 0.302 0.322
acescore -0.886 0.147 -6.009 0.000 -0.925 -0.334
Dep_Score -7.853 0.430 -18.262 0.000 -8.197 -0.915
Anx_Score -8.195 0.467 -17.529 0.000 -8.554 -0.802
Anger_Score -6.575 0.567 -11.597 0.000 -6.864 -0.703
Supp_Score 5.248 0.478 10.968 0.000 5.478 0.662
Meaning_Score 5.034 0.534 9.423 0.000 5.255 0.576
Infant =~
imhbirthwt 0.357 0.028 12.642 0.000 0.416 0.918
imh_birthlt 1.434 0.145 9.889 0.000 1.673 0.708
imh_birthhcr 0.819 0.082 10.002 0.000 0.955 0.670
gawks 0.300 0.056 5.335 0.000 0.350 0.349
sex 0.071 0.027 2.607 0.009 0.083 0.166
SocioDem =~
MatAge 0.757 0.382 1.985 0.047 0.757 0.149
mmins_combined -0.162 0.040 -4.042 0.000 -0.162 -0.330
mrace_combined 0.394 0.086 4.599 0.000 0.394 0.337
pcedlevel 0.736 0.109 6.767 0.000 0.736 0.476
MomOnlyFSIQ 6.871 1.042 6.594 0.000 6.871 0.492
any_subuse_y_n -0.214 0.037 -5.753 0.000 -0.214 -0.471
hseincom -3.583 4.826 -0.742 0.458 -3.583 -0.031
Regressions:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
diabpprg ~
SocioDem -0.001 0.002 -0.503 0.615 -0.001 -0.011
gestdiab ~
SocioDem 0.023 0.024 0.984 0.325 0.023 0.100
hyp ~
SocioDem -0.024 0.037 -0.663 0.508 -0.024 -0.058
prenatal_collapsed ~
SocioDem -0.074 0.025 -2.950 0.003 -0.074 -0.199
hiv ~
SocioDem -0.010 0.007 -1.605 0.109 -0.010 -0.050
syph ~
SocioDem -0.002 0.013 -0.125 0.900 -0.002 -0.007
chlmyd ~
SocioDem -0.047 0.021 -2.250 0.024 -0.047 -0.117
MatMen_health ~
SocioDem 0.300 0.072 4.179 0.000 0.287 0.287
Infant ~
MatMen_health 0.073 0.074 0.992 0.321 0.065 0.065
SocioDem 0.551 0.125 4.405 0.000 0.472 0.472
diabpprg -1.175 0.281 -4.185 0.000 -1.008 -0.103
gestdiab -0.073 0.298 -0.244 0.808 -0.062 -0.014
hyp -0.287 0.182 -1.576 0.115 -0.246 -0.104
prenatl_cllpsd 0.301 0.229 1.311 0.190 0.258 0.096
hiv -0.115 0.171 -0.674 0.500 -0.099 -0.021
syph 0.114 0.267 0.428 0.669 0.098 0.023
chlmyd 0.348 0.137 2.535 0.011 0.298 0.119
n2attention ~
Infant -0.004 0.067 -0.065 0.949 -0.005 -0.004
n2regulation ~
Infant 0.010 0.058 0.178 0.859 0.012 0.011
n2arousal ~
Infant 0.092 0.094 0.980 0.327 0.107 0.067
n2tone ~
Infant -0.056 0.030 -1.880 0.060 -0.065 -0.118
n2nonoptref ~
Infant -0.218 0.060 -3.607 0.000 -0.254 -0.225
n2qmove ~
Infant 0.107 0.068 1.587 0.112 0.125 0.105
n2stress ~
Infant -0.047 0.034 -1.406 0.160 -0.055 -0.079
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.mrace_combined ~~
.any_subuse_y_n 0.200 0.036 5.615 0.000 0.200 0.453
.n2attention ~~
.n2regulation 0.297 0.084 3.520 0.000 0.297 0.215
.n2arousal -0.519 0.109 -4.746 0.000 -0.519 -0.255
.n2tone 0.010 0.040 0.248 0.804 0.010 0.014
.n2nonoptref 0.124 0.077 1.618 0.106 0.124 0.088
.n2qmove 0.185 0.077 2.403 0.016 0.185 0.122
.n2stress 0.058 0.044 1.305 0.192 0.058 0.065
.n2regulation ~~
.n2arousal -0.479 0.095 -5.049 0.000 -0.479 -0.280
.n2tone -0.019 0.034 -0.543 0.587 -0.019 -0.031
.n2nonoptref -0.037 0.080 -0.459 0.646 -0.037 -0.031
.n2qmove 0.135 0.075 1.795 0.073 0.135 0.106
.n2stress -0.077 0.047 -1.647 0.100 -0.077 -0.102
.n2arousal ~~
.n2tone 0.323 0.063 5.130 0.000 0.323 0.369
.n2nonoptref 0.033 0.105 0.314 0.754 0.033 0.019
.n2qmove -0.379 0.131 -2.884 0.004 -0.379 -0.201
.n2stress 0.430 0.074 5.793 0.000 0.430 0.387
.n2tone ~~
.n2nonoptref -0.044 0.049 -0.904 0.366 -0.044 -0.072
.n2qmove -0.088 0.055 -1.587 0.112 -0.088 -0.134
.n2stress 0.155 0.037 4.225 0.000 0.155 0.403
.n2nonoptref ~~
.n2qmove -0.281 0.085 -3.321 0.001 -0.281 -0.215
.n2stress 0.177 0.048 3.720 0.000 0.177 0.230
.n2qmove ~~
.n2stress -0.382 0.062 -6.129 0.000 -0.382 -0.461
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.collapsd_mnthl 2.014 0.055 36.503 0.000 2.014 2.144
.acescore 2.758 0.160 17.267 0.000 2.758 0.996
.Dep_Score 47.667 0.491 97.043 0.000 47.667 5.323
.Anx_Score 52.164 0.586 88.958 0.000 52.164 4.889
.Anger_Score 51.645 0.536 96.264 0.000 51.645 5.290
.Supp_Score 56.181 0.455 123.360 0.000 56.181 6.793
.Meaning_Score 59.531 0.501 118.714 0.000 59.531 6.524
.imhbirthwt 3.577 0.277 12.893 0.000 3.577 7.891
.imh_birthlt 51.533 1.121 45.984 0.000 51.533 21.803
.imh_birthhcr 34.923 0.642 54.389 0.000 34.923 24.521
.gawks 38.994 0.240 162.160 0.000 38.994 38.890
.sex 1.626 0.068 23.748 0.000 1.626 3.273
.MatAge 29.753 0.299 99.470 0.000 29.753 5.841
.mmins_combined 3.835 0.029 132.851 0.000 3.835 7.801
.mrace_combined 3.423 0.069 49.815 0.000 3.423 2.925
.pcedlevel 4.054 0.089 45.476 0.000 4.054 2.619
.MomOnlyFSIQ 94.385 0.778 121.311 0.000 94.385 6.758
.any_subuse_y_n 1.711 0.027 64.203 0.000 1.711 3.770
.hseincom 20.643 6.465 3.193 0.001 20.643 0.177
.diabpprg 1.011 0.006 170.092 0.000 1.011 9.884
.gestdiab 1.057 0.013 78.931 0.000 1.057 4.546
.hyp 1.230 0.024 50.396 0.000 1.230 2.918
.prenatl_cllpsd 1.165 0.021 54.550 0.000 1.165 3.131
.hiv 1.024 0.012 82.905 0.000 1.024 4.868
.syph 1.034 0.014 75.810 0.000 1.034 4.452
.chlmyd 1.100 0.023 46.963 0.000 1.100 2.758
.n2attention 4.623 0.091 50.787 0.000 4.623 3.619
.n2regulation 4.210 0.078 53.803 0.000 4.210 3.904
.n2arousal 4.721 0.148 31.872 0.000 4.721 2.962
.n2tone 4.891 0.060 82.037 0.000 4.891 8.837
.n2nonoptref 2.930 0.197 14.904 0.000 2.930 2.591
.n2qmove 6.792 0.126 53.884 0.000 6.792 5.687
.n2stress 1.596 0.061 25.950 0.000 1.596 2.278
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.collapsd_mnthl 0.791 0.035 22.846 0.000 0.791 0.897
.acescore 6.808 0.549 12.399 0.000 6.808 0.888
.Dep_Score 13.006 3.080 4.223 0.000 13.006 0.162
.Anx_Score 40.672 4.801 8.471 0.000 40.672 0.357
.Anger_Score 48.190 6.396 7.535 0.000 48.190 0.506
.Supp_Score 38.395 4.238 9.059 0.000 38.395 0.561
.Meaning_Score 55.647 5.473 10.168 0.000 55.647 0.668
.imhbirthwt 0.032 0.013 2.505 0.012 0.032 0.158
.imh_birthlt 2.789 0.432 6.451 0.000 2.789 0.499
.imh_birthhcr 1.117 0.133 8.397 0.000 1.117 0.550
.gawks 0.883 0.077 11.498 0.000 0.883 0.878
.sex 0.240 0.006 38.905 0.000 0.240 0.972
.MatAge 25.372 1.959 12.952 0.000 25.372 0.978
.mmins_combined 0.215 0.059 3.664 0.000 0.215 0.891
.mrace_combined 1.214 0.118 10.289 0.000 1.214 0.887
.pcedlevel 1.853 0.160 11.549 0.000 1.853 0.774
.MomOnlyFSIQ 147.845 13.833 10.688 0.000 147.845 0.758
.any_subuse_y_n 0.160 0.018 9.122 0.000 0.160 0.778
.hseincom 13663.598 4765.918 2.867 0.004 13663.598 0.999
.diabpprg 0.010 0.006 1.797 0.072 0.010 1.000
.gestdiab 0.054 0.012 4.589 0.000 0.054 0.990
.hyp 0.177 0.013 13.362 0.000 0.177 0.997
.prenatl_cllpsd 0.133 0.014 9.815 0.000 0.133 0.960
.hiv 0.044 0.023 1.892 0.058 0.044 0.998
.syph 0.054 0.024 2.273 0.023 0.054 1.000
.chlmyd 0.157 0.039 4.068 0.000 0.157 0.986
.n2attention 1.632 0.133 12.292 0.000 1.632 1.000
.n2regulation 1.163 0.098 11.875 0.000 1.163 1.000
.n2arousal 2.529 0.165 15.328 0.000 2.529 0.995
.n2tone 0.302 0.042 7.148 0.000 0.302 0.986
.n2nonoptref 1.214 0.128 9.461 0.000 1.214 0.950
.n2qmove 1.411 0.127 11.071 0.000 1.411 0.989
.n2stress 0.488 0.056 8.761 0.000 0.488 0.994
.MatMen_health 1.000 0.918 0.918
.Infant 1.000 0.735 0.735
SocioDem 1.000 1.000 1.000
##Regression Table
parameterEstimates(SEM_model_fit_2.1, standardized=TRUE) %>%
filter(op == "~") %>%
select('LV1'=lhs, 'LV2'=rhs, B=est, SE=se, Z=z, 'p-value'=pvalue, Beta=std.all,CI_Lower=ci.lower, CI_Upper=ci.upper) %>%
knitr::kable(digits = 3, format="html", booktabs=TRUE, caption="Total Sample Regressions")%>%
kable_classic(full_width = F, html_font = "Cambria")| LV1 | LV2 | B | SE | Z | p-value | Beta | CI_Lower | CI_Upper |
|---|---|---|---|---|---|---|---|---|
| diabpprg | SocioDem | -0.001 | 0.002 | -0.503 | 0.615 | -0.011 | -0.006 | 0.003 |
| gestdiab | SocioDem | 0.023 | 0.024 | 0.984 | 0.325 | 0.100 | -0.023 | 0.070 |
| hyp | SocioDem | -0.024 | 0.037 | -0.663 | 0.508 | -0.058 | -0.096 | 0.048 |
| prenatal_collapsed | SocioDem | -0.074 | 0.025 | -2.950 | 0.003 | -0.199 | -0.123 | -0.025 |
| hiv | SocioDem | -0.010 | 0.007 | -1.605 | 0.109 | -0.050 | -0.023 | 0.002 |
| syph | SocioDem | -0.002 | 0.013 | -0.125 | 0.900 | -0.007 | -0.027 | 0.024 |
| chlmyd | SocioDem | -0.047 | 0.021 | -2.250 | 0.024 | -0.117 | -0.088 | -0.006 |
| MatMen_health | SocioDem | 0.300 | 0.072 | 4.179 | 0.000 | 0.287 | 0.159 | 0.440 |
| Infant | MatMen_health | 0.073 | 0.074 | 0.992 | 0.321 | 0.065 | -0.071 | 0.217 |
| Infant | SocioDem | 0.551 | 0.125 | 4.405 | 0.000 | 0.472 | 0.306 | 0.796 |
| Infant | diabpprg | -1.175 | 0.281 | -4.185 | 0.000 | -0.103 | -1.726 | -0.625 |
| Infant | gestdiab | -0.073 | 0.298 | -0.244 | 0.808 | -0.014 | -0.657 | 0.511 |
| Infant | hyp | -0.287 | 0.182 | -1.576 | 0.115 | -0.104 | -0.643 | 0.070 |
| Infant | prenatal_collapsed | 0.301 | 0.229 | 1.311 | 0.190 | 0.096 | -0.149 | 0.750 |
| Infant | hiv | -0.115 | 0.171 | -0.674 | 0.500 | -0.021 | -0.450 | 0.220 |
| Infant | syph | 0.114 | 0.267 | 0.428 | 0.669 | 0.023 | -0.409 | 0.637 |
| Infant | chlmyd | 0.348 | 0.137 | 2.535 | 0.011 | 0.119 | 0.079 | 0.617 |
| n2attention | Infant | -0.004 | 0.067 | -0.065 | 0.949 | -0.004 | -0.136 | 0.128 |
| n2regulation | Infant | 0.010 | 0.058 | 0.178 | 0.859 | 0.011 | -0.104 | 0.125 |
| n2arousal | Infant | 0.092 | 0.094 | 0.980 | 0.327 | 0.067 | -0.092 | 0.276 |
| n2tone | Infant | -0.056 | 0.030 | -1.880 | 0.060 | -0.118 | -0.114 | 0.002 |
| n2nonoptref | Infant | -0.218 | 0.060 | -3.607 | 0.000 | -0.225 | -0.336 | -0.099 |
| n2qmove | Infant | 0.107 | 0.068 | 1.587 | 0.112 | 0.105 | -0.025 | 0.240 |
| n2stress | Infant | -0.047 | 0.034 | -1.406 | 0.160 | -0.079 | -0.113 | 0.019 |