Fits the simple mediation model using structural equation modeling.

fit.sem(data, minimal = FALSE, std = FALSE, fiml = FALSE)

Arguments

data

n by 3 matrix or data frame. data[, 1] correspond to values for x. data[, 2] correspond to values for m. data[, 3] correspond to values for y.

minimal

Logical. If TRUE, only returns the estimate of the indirect effect \(\left( \hat{\alpha} \hat{\beta} \right)\). If FALSE, returns more information.

std

Logical. If TRUE, estimate standardized simple mediation model using latent variables and nonlinear constraints.

fiml

Logical. If TRUE, use missing = "fiml" to handle missing values. Note that using missing = "fiml" sets fixed.x = FALSE.

See also

Other model fit functions: beta_fit.ols_simulation_summary(), beta_fit.ols_simulation(), beta_fit.ols_task_summary(), beta_fit.ols_task(), beta_fit.ols(), beta_fit.sem.mlr_simulation_summary(), beta_fit.sem.mlr_simulation(), beta_fit.sem.mlr_task_summary(), beta_fit.sem.mlr_task(), beta_fit.sem.mlr(), beta_std_fit.sem.mlr_simulation_summary(), beta_std_fit.sem.mlr_simulation(), beta_std_fit.sem.mlr_task_summary(), beta_std_fit.sem.mlr_task(), beta_std_fit.sem.mlr(), exp_fit.ols_simulation_summary(), exp_fit.ols_simulation(), exp_fit.ols_task_summary(), exp_fit.ols_task(), exp_fit.ols(), exp_fit.sem.mlr_simulation_summary(), exp_fit.sem.mlr_simulation(), exp_fit.sem.mlr_task_summary(), exp_fit.sem.mlr_task(), exp_fit.sem.mlr(), exp_std_fit.sem.mlr_simulation_summary(), exp_std_fit.sem.mlr_simulation(), exp_std_fit.sem.mlr_task_summary(), exp_std_fit.sem.mlr_task(), exp_std_fit.sem.mlr(), fit.cov(), fit.ols(), fit.sem.mlr(), mvn_fit.ols_simulation_summary(), mvn_fit.ols_simulation(), mvn_fit.ols_task_summary(), mvn_fit.ols_task(), mvn_fit.ols(), mvn_fit.sem_simulation_summary(), mvn_fit.sem_simulation(), mvn_fit.sem_task_summary(), mvn_fit.sem_task(), mvn_fit.sem(), mvn_mar_10_fit.sem_simulation_summary(), mvn_mar_10_fit.sem_simulation(), mvn_mar_10_fit.sem_task_summary(), mvn_mar_10_fit.sem_task(), mvn_mar_10_fit.sem(), mvn_mar_20_fit.sem_simulation_summary(), mvn_mar_20_fit.sem_simulation(), mvn_mar_20_fit.sem_task_summary(), mvn_mar_20_fit.sem_task(), mvn_mar_20_fit.sem(), mvn_mar_30_fit.sem_simulation_summary(), mvn_mar_30_fit.sem_simulation(), mvn_mar_30_fit.sem_task_summary(), mvn_mar_30_fit.sem_task(), mvn_mar_30_fit.sem(), mvn_mcar_10_fit.sem_simulation_summary(), mvn_mcar_10_fit.sem_simulation(), mvn_mcar_10_fit.sem_task_summary(), mvn_mcar_10_fit.sem_task(), mvn_mcar_10_fit.sem(), mvn_mcar_20_fit.sem_simulation_summary(), mvn_mcar_20_fit.sem_simulation(), mvn_mcar_20_fit.sem_task_summary(), mvn_mcar_20_fit.sem_task(), mvn_mcar_20_fit.sem(), mvn_mcar_30_fit.sem_simulation_summary(), mvn_mcar_30_fit.sem_simulation(), mvn_mcar_30_fit.sem_task_summary(), mvn_mcar_30_fit.sem_task(), mvn_mcar_30_fit.sem(), mvn_mnar_10_fit.sem_simulation_summary(), mvn_mnar_10_fit.sem_simulation(), mvn_mnar_10_fit.sem_task_summary(), mvn_mnar_10_fit.sem_task(), mvn_mnar_10_fit.sem(), mvn_mnar_20_fit.sem_simulation_summary(), mvn_mnar_20_fit.sem_simulation(), mvn_mnar_20_fit.sem_task_summary(), mvn_mnar_20_fit.sem_task(), mvn_mnar_20_fit.sem(), mvn_mnar_30_fit.sem_simulation_summary(), mvn_mnar_30_fit.sem_simulation(), mvn_mnar_30_fit.sem_task_summary(), mvn_mnar_30_fit.sem_task(), mvn_mnar_30_fit.sem(), mvn_std_fit.sem_simulation_summary(), mvn_std_fit.sem_simulation(), mvn_std_fit.sem_task_summary(), mvn_std_fit.sem_task(), mvn_std_fit.sem(), vm_mod_fit.ols_simulation_summary(), vm_mod_fit.ols_simulation(), vm_mod_fit.ols_task_summary(), vm_mod_fit.ols_task(), vm_mod_fit.ols(), vm_mod_fit.sem.mlr_simulation_summary(), vm_mod_fit.sem.mlr_simulation(), vm_mod_fit.sem.mlr_task_summary(), vm_mod_fit.sem.mlr_task(), vm_mod_fit.sem.mlr(), vm_mod_std_fit.sem.mlr_simulation_summary(), vm_mod_std_fit.sem.mlr_simulation(), vm_mod_std_fit.sem.mlr_task_summary(), vm_mod_std_fit.sem.mlr_task(), vm_mod_std_fit.sem.mlr(), vm_sev_fit.ols_simulation_summary(), vm_sev_fit.ols_simulation(), vm_sev_fit.ols_task_summary(), vm_sev_fit.ols_task(), vm_sev_fit.ols(), vm_sev_fit.sem.mlr_simulation_summary(), vm_sev_fit.sem.mlr_simulation(), vm_sev_fit.sem.mlr_task_summary(), vm_sev_fit.sem.mlr_task(), vm_sev_fit.sem.mlr(), vm_sev_std_fit.sem.mlr_simulation_summary(), vm_sev_std_fit.sem.mlr_simulation(), vm_sev_std_fit.sem.mlr_task_summary(), vm_sev_std_fit.sem.mlr_task(), vm_sev_std_fit.sem.mlr()

Author

Ivan Jacob Agaloos Pesigan

Examples

library(lavaan) summary(fit.sem(data = jeksterslabRdatarepo::thirst))
#> lavaan 0.6-7 ended normally after 12 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 5 #> #> Number of observations 50 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Expected #> Information saturated (h1) model Structured #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.208 0.131 1.591 0.112 #> m (btht) 0.451 0.143 3.155 0.002 #> m ~ #> x (alph) 0.339 0.121 2.796 0.005 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 0.931 0.188 4.950 0.000 #> . (sgm2htpslnm) 0.930 0.188 4.950 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.153 0.073 2.092 0.036 #>
summary(fit.sem(data = jeksterslabRdatarepo::thirst, std = TRUE))
#> lavaan 0.6-7 ended normally after 49 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 8 #> #> Number of observations 50 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Expected #> Information saturated (h1) model Structured #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 1.137 0.115 9.899 0.000 #> mlatent =~ #> m (lmbdm) 1.038 0.105 9.899 0.000 #> ylatent =~ #> y (lmbdy) 1.135 0.115 9.899 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.208 0.129 1.615 0.106 #> mlatent (btht) 0.413 0.121 3.401 0.001 #> mlatent ~ #> xlatent (alph) 0.371 0.123 3.010 0.003 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.723 0.109 6.647 0.000 #> . (sgm2htpslnm) 0.862 0.091 9.437 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.153 0.069 2.222 0.026 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
summary(fit.sem(data = jeksterslabRdatarepo::thirst, minimal = TRUE))
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 0.1527 0.1527 0.1527 0.1527 0.1527 0.1527
summary(fit.sem(data = jeksterslabRdatarepo::thirst, minimal = TRUE, std = TRUE))
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 0.153 0.153 0.153 0.153 0.153 0.153
taskid <- 1 data <- mvn_dat(taskid = taskid) # Unstandaradized ################################################## # Complete Data ---------------------------------------------------- summary(fit.sem(data = data))
#> lavaan 0.6-7 ended normally after 14 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 5 #> #> Number of observations 1000 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Expected #> Information saturated (h1) model Structured #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.162 0.026 6.299 0.000 #> m (btht) 0.707 0.026 27.453 0.000 #> m ~ #> x (alph) 0.732 0.021 34.187 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.791 3.212 22.349 0.000 #> . (sgm2htpslnm) 108.269 4.844 22.349 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.518 0.024 21.406 0.000 #>
# Missing completely at random ------------------------------------- ## 10% missing summary(fit.sem(data = mvn_mcar_10_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 29 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.163 0.027 5.980 0.000 #> m (btht) 0.701 0.027 25.727 0.000 #> m ~ #> x (alph) 0.729 0.022 33.576 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 13.861 1.988 6.971 0.000 #> .m (dltm) 27.525 2.214 12.434 0.000 #> x (mxht) 100.728 0.493 204.453 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 73.179 3.374 21.689 0.000 #> . (sgm2htpslnm) 108.325 4.982 21.745 0.000 #> (sgm2x) 238.184 10.797 22.061 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.511 0.025 20.421 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mcar_20_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 28 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.156 0.029 5.425 0.000 #> m (btht) 0.721 0.028 25.304 0.000 #> m ~ #> x (alph) 0.736 0.022 33.349 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 12.467 2.032 6.136 0.000 #> .m (dltm) 27.033 2.250 12.017 0.000 #> x (mxht) 100.635 0.493 204.196 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.350 3.394 21.023 0.000 #> . (sgm2htpslnm) 105.823 4.975 21.270 0.000 #> (sgm2x) 234.992 10.774 21.810 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.530 0.026 20.104 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mcar_30_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 30 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.161 0.029 5.499 0.000 #> m (btht) 0.702 0.028 25.057 0.000 #> m ~ #> x (alph) 0.736 0.024 31.170 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 13.817 2.124 6.505 0.000 #> .m (dltm) 26.843 2.408 11.150 0.000 #> x (mxht) 100.724 0.493 204.149 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.524 3.532 20.253 0.000 #> . (sgm2htpslnm) 113.449 5.565 20.385 0.000 #> (sgm2x) 230.099 10.713 21.479 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.517 0.026 19.509 0.000 #>
# Missing at random ------------------------------------------------ ## 10% missing summary(fit.sem(data = mvn_mar_10_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 30 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.169 0.027 6.343 0.000 #> m (btht) 0.707 0.026 26.790 0.000 #> m ~ #> x (alph) 0.730 0.022 33.236 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 12.483 1.969 6.339 0.000 #> .m (dltm) 27.560 2.233 12.341 0.000 #> x (mxht) 100.661 0.490 205.600 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.825 3.301 21.759 0.000 #> . (sgm2htpslnm) 109.051 5.018 21.730 0.000 #> (sgm2x) 235.240 10.692 22.001 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.516 0.025 20.843 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mar_20_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 31 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.159 0.028 5.720 0.000 #> m (btht) 0.706 0.027 25.843 0.000 #> m ~ #> x (alph) 0.726 0.023 32.052 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 13.621 2.038 6.682 0.000 #> .m (dltm) 27.896 2.296 12.151 0.000 #> x (mxht) 100.658 0.492 204.692 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 73.092 3.501 20.879 0.000 #> . (sgm2htpslnm) 110.333 5.281 20.892 0.000 #> (sgm2x) 233.721 10.782 21.676 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.512 0.025 20.121 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mar_30_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 27 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.164 0.028 5.769 0.000 #> m (btht) 0.710 0.028 25.064 0.000 #> m ~ #> x (alph) 0.713 0.023 31.294 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 12.770 2.093 6.103 0.000 #> .m (dltm) 29.201 2.311 12.636 0.000 #> x (mxht) 100.707 0.500 201.265 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 72.272 3.584 20.163 0.000 #> . (sgm2htpslnm) 111.254 5.458 20.385 0.000 #> (sgm2x) 237.354 11.082 21.418 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.506 0.026 19.545 0.000 #>
# Missing Not at random -------------------------------------------- ## 10% missing summary(fit.sem(data = mvn_mnar_10_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 28 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.162 0.027 6.040 0.000 #> m (btht) 0.708 0.027 26.624 0.000 #> m ~ #> x (alph) 0.731 0.022 33.163 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 13.275 1.977 6.715 0.000 #> .m (dltm) 27.546 2.231 12.345 0.000 #> x (mxht) 100.457 0.488 206.047 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.559 3.276 21.842 0.000 #> . (sgm2htpslnm) 107.354 4.934 21.759 0.000 #> (sgm2x) 233.316 10.567 22.080 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.517 0.025 20.767 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mnar_20_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 26 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.155 0.028 5.580 0.000 #> m (btht) 0.712 0.027 25.996 0.000 #> m ~ #> x (alph) 0.735 0.023 32.255 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 13.392 2.032 6.590 0.000 #> .m (dltm) 27.131 2.304 11.775 0.000 #> x (mxht) 100.389 0.488 205.636 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 71.747 3.406 21.067 0.000 #> . (sgm2htpslnm) 109.927 5.210 21.099 0.000 #> (sgm2x) 230.358 10.647 21.636 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.523 0.026 20.225 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mnar_30_dat(data = data, taskid = taskid), fiml = TRUE))
#> lavaan 0.6-7 ended normally after 27 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 9 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> y ~ #> x (tdth) 0.181 0.031 5.870 0.000 #> m (btht) 0.679 0.030 22.799 0.000 #> m ~ #> x (alph) 0.736 0.023 31.791 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (dlty) 14.208 2.123 6.693 0.000 #> .m (dltm) 27.061 2.335 11.588 0.000 #> x (mxht) 100.242 0.497 201.731 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . (sgm2htpslny) 70.954 3.522 20.143 0.000 #> . (sgm2htpslnm) 109.271 5.336 20.479 0.000 #> (sgm2x) 234.242 10.898 21.494 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphahatbetaht 0.500 0.027 18.416 0.000 #>
# Standaradized #################################################### # Complete Data ---------------------------------------------------- summary(fit.sem(data = data, std = TRUE))
#> lavaan 0.6-7 ended normally after 96 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 8 #> #> Number of observations 1000 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Expected #> Information saturated (h1) model Structured #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.379 0.344 44.699 0.000 #> mlatent =~ #> m (lmbdm) 15.328 0.343 44.699 0.000 #> ylatent =~ #> y (lmbdy) 15.333 0.343 44.699 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.162 0.026 6.308 0.000 #> mlatent (btht) 0.707 0.023 31.109 0.000 #> mlatent ~ #> xlatent (alph) 0.734 0.015 50.359 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.305 0.016 18.961 0.000 #> . (sgm2htpslnm) 0.461 0.021 21.523 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.519 0.020 25.802 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
# Missing completely at random ------------------------------------- ## 10% missing summary(fit.sem(data = mvn_mcar_10_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 149 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.347 0.350 43.851 0.000 #> mlatent =~ #> m (lmbdm) 15.305 0.347 44.143 0.000 #> ylatent =~ #> y (lmbdy) 15.292 0.345 44.325 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.155 0.027 5.727 0.000 #> mlatent (btht) 0.711 0.024 30.043 0.000 #> mlatent ~ #> xlatent (alph) 0.729 0.015 47.703 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.946 0.486 207.680 0.000 #> .m (mmht) 101.084 0.487 207.481 0.000 #> .x (mxht) 100.682 0.490 205.513 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.309 0.017 18.555 0.000 #> . (sgm2htpslnm) 0.468 0.022 21.011 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.519 0.021 24.770 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mcar_20_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 139 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.308 0.352 43.450 0.000 #> mlatent =~ #> m (lmbdm) 15.278 0.347 44.033 0.000 #> ylatent =~ #> y (lmbdy) 15.422 0.351 43.904 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.173 0.028 6.194 0.000 #> mlatent (btht) 0.700 0.025 28.427 0.000 #> mlatent ~ #> xlatent (alph) 0.732 0.015 47.626 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.965 0.494 204.378 0.000 #> .m (mmht) 101.108 0.488 207.229 0.000 #> .x (mxht) 100.668 0.494 203.875 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.303 0.017 18.119 0.000 #> . (sgm2htpslnm) 0.465 0.022 20.670 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.512 0.021 23.862 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mcar_30_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 129 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.492 0.359 43.145 0.000 #> mlatent =~ #> m (lmbdm) 15.331 0.351 43.688 0.000 #> ylatent =~ #> y (lmbdy) 15.342 0.354 43.324 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.150 0.029 5.119 0.000 #> mlatent (btht) 0.717 0.026 27.884 0.000 #> mlatent ~ #> xlatent (alph) 0.737 0.015 48.272 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 101.059 0.493 204.874 0.000 #> .m (mmht) 100.958 0.491 205.736 0.000 #> .x (mxht) 100.661 0.501 200.773 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.305 0.017 17.762 0.000 #> . (sgm2htpslnm) 0.457 0.023 20.303 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.528 0.022 23.499 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
# Missing at random ------------------------------------------------ ## 10% missing summary(fit.sem(data = mvn_mar_10_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 124 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.380 0.350 43.983 0.000 #> mlatent =~ #> m (lmbdm) 15.288 0.346 44.155 0.000 #> ylatent =~ #> y (lmbdy) 15.338 0.348 44.056 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.170 0.027 6.402 0.000 #> mlatent (btht) 0.705 0.023 30.008 0.000 #> mlatent ~ #> xlatent (alph) 0.735 0.015 49.188 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 101.045 0.489 206.701 0.000 #> .m (mmht) 101.001 0.486 207.979 0.000 #> .x (mxht) 100.656 0.491 205.074 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.298 0.016 18.393 0.000 #> . (sgm2htpslnm) 0.460 0.022 20.975 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.518 0.021 24.967 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mar_20_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 131 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.192 0.351 43.336 0.000 #> mlatent =~ #> m (lmbdm) 15.400 0.352 43.806 0.000 #> ylatent =~ #> y (lmbdy) 15.229 0.348 43.747 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.147 0.028 5.180 0.000 #> mlatent (btht) 0.715 0.025 28.908 0.000 #> mlatent ~ #> xlatent (alph) 0.730 0.016 47.015 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.832 0.487 207.015 0.000 #> .m (mmht) 101.057 0.492 205.230 0.000 #> .x (mxht) 100.706 0.490 205.685 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.315 0.017 18.243 0.000 #> . (sgm2htpslnm) 0.468 0.023 20.641 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.521 0.022 23.930 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mar_30_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 129 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.486 0.359 43.187 0.000 #> mlatent =~ #> m (lmbdm) 15.305 0.351 43.642 0.000 #> ylatent =~ #> y (lmbdy) 15.346 0.357 42.994 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.150 0.030 5.046 0.000 #> mlatent (btht) 0.714 0.026 27.650 0.000 #> mlatent ~ #> xlatent (alph) 0.735 0.016 47.132 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 101.011 0.496 203.768 0.000 #> .m (mmht) 101.036 0.491 205.739 0.000 #> .x (mxht) 100.772 0.500 201.461 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.309 0.018 17.569 0.000 #> . (sgm2htpslnm) 0.460 0.023 20.093 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.525 0.023 23.123 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
# Missing Not at random -------------------------------------------- ## 10% missing summary(fit.sem(data = mvn_mnar_10_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 141 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.321 0.350 43.721 0.000 #> mlatent =~ #> m (lmbdm) 15.298 0.345 44.318 0.000 #> ylatent =~ #> y (lmbdy) 15.335 0.346 44.279 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.150 0.027 5.641 0.000 #> mlatent (btht) 0.718 0.023 30.777 0.000 #> mlatent ~ #> xlatent (alph) 0.734 0.015 48.958 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.950 0.487 207.420 0.000 #> .m (mmht) 100.978 0.486 207.649 0.000 #> .x (mxht) 100.622 0.490 205.502 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.303 0.016 18.613 0.000 #> . (sgm2htpslnm) 0.461 0.022 20.962 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.527 0.021 25.432 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 20% missing summary(fit.sem(data = mvn_mnar_20_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 136 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.380 0.353 43.514 0.000 #> mlatent =~ #> m (lmbdm) 15.287 0.348 43.917 0.000 #> ylatent =~ #> y (lmbdy) 15.151 0.346 43.821 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.142 0.028 4.994 0.000 #> mlatent (btht) 0.718 0.025 28.983 0.000 #> mlatent ~ #> xlatent (alph) 0.730 0.015 47.207 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.717 0.485 207.648 0.000 #> .m (mmht) 100.861 0.489 206.378 0.000 #> .x (mxht) 100.401 0.496 202.568 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.315 0.017 18.258 0.000 #> . (sgm2htpslnm) 0.467 0.023 20.700 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.524 0.022 23.946 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>
## 30% missing summary(fit.sem(data = mvn_mnar_30_dat(data = data, taskid = taskid), std = TRUE, fiml = TRUE))
#> lavaan 0.6-7 ended normally after 134 iterations #> #> Estimator ML #> Optimization method NLMINB #> Number of free parameters 11 #> #> Number of observations 1000 #> Number of missing patterns 4 #> #> Model Test User Model: #> #> Test statistic 0.000 #> Degrees of freedom 0 #> #> Parameter Estimates: #> #> Standard errors Standard #> Information Observed #> Observed information based on Hessian #> #> Latent Variables: #> Estimate Std.Err z-value P(>|z|) #> xlatent =~ #> x (lmbdx) 15.224 0.356 42.804 0.000 #> mlatent =~ #> m (lmbdm) 15.292 0.350 43.698 0.000 #> ylatent =~ #> y (lmbdy) 15.347 0.355 43.201 0.000 #> #> Regressions: #> Estimate Std.Err z-value P(>|z|) #> ylatent ~ #> xlatent (tdth) 0.144 0.030 4.764 0.000 #> mlatent (btht) 0.726 0.026 27.663 0.000 #> mlatent ~ #> xlatent (alph) 0.738 0.015 48.075 0.000 #> #> Intercepts: #> Estimate Std.Err z-value P(>|z|) #> .y (myht) 100.786 0.495 203.729 0.000 #> .m (mmht) 100.823 0.490 205.787 0.000 #> .x (mxht) 100.172 0.495 202.528 0.000 #> xlatent 0.000 #> .mlatent 0.000 #> .ylatent 0.000 #> #> Variances: #> Estimate Std.Err z-value P(>|z|) #> . 0.000 #> . 0.000 #> . 0.000 #> 1.000 #> . (sgm2htpslny) 0.299 0.017 17.591 0.000 #> . (sgm2htpslnm) 0.455 0.023 20.042 0.000 #> #> Defined Parameters: #> Estimate Std.Err z-value P(>|z|) #> alphhtprmbthtp 0.536 0.023 23.423 0.000 #> #> Constraints: #> |Slack| #> sgm2-(1-tdthtprm^2-bthtprm^2-(2*tdtht**)) 0.000 #> sigma2hatepsilonmlatenthat-(1-lphhtprm^2) 0.000 #>