Hi lavaan group,
I have been trying different model specification for my sem model but always ended up with a Heywood case (probably induced by the small sample size and partially by the model misspecification).
> fit <- cfa(model, data=x_dat, estimator="MLM", std.lv=TRUE, test = "bootstrap", likelihood = "wishart") #WLSMV
Warning message:
In lav_object_post_check(object) :
lavaan WARNING: some estimated ov variances are negative
I have read the forum looking for similar cases and try to improve the model, but it did not help. I based my model on a previous PCA and EFA results.
model <- '
# measurement model
factor_1 =~ Organic_N + Organic_P2O5 + Organic_K2O + Animal + Human
factor_2 =~ Inorganic_N + Inorganic_P2O5 + Inorganic_K2O + Machinery + CED + HT + FAET + MAET + Fungicide + Insecticide
factor_3 =~ GWP + AP + EP
# regressions/structural
factor_1 ~ factor_3
factor_2 ~ factor_3
# residual correlations
HT ~~ FAET
HT ~~ MAET
FAET ~~ MAET
CED ~~ Machinery
Inorganic_P2O5 ~~ MAET
AP ~~ EP
'
I tried to set the first loading of factor_1 equal to 1 (1*Organic_N) but it did not work.
> inspect(fit,what="std")$lambda #loadings
fctr_1 fctr_2 fctr_3
Organic_N 1.019 0.000 0.000
Organic_P2O5 0.877 0.000 0.000
Organic_K2O 0.833 0.000 0.000
Animal 0.509 0.000 0.000
Human 0.684 0.000 0.000
Inorganic_N 0.000 0.881 0.000
Inorganic_P2O5 0.000 0.863 0.000
Inorganic_K2O 0.000 0.904 0.000
Machinery 0.000 0.465 0.000
CED 0.000 0.892 0.000
HT 0.000 0.828 0.000
FAET 0.000 0.755 0.000
MAET 0.000 0.623 0.000
Fungicide 0.000 0.502 0.000
Insecticide 0.000 0.298 0.000
GWP 0.000 0.000 0.982
AP 0.000 0.000 0.856
EP 0.000 0.000 0.710
This is the fit of my model:
> summary(fit, standardized=TRUE, fit.measures=TRUE, rsquare=TRUE, ci=TRUE)
lavaan 0.6-2 ended normally after 76 iterations Optimization method NLMINB Number of free parameters 44 Number of observations 58 Estimator ML Robust Model Fit Test Statistic 436.301 293.327 Degrees of freedom 127 127 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.487 for the Satorra-Bentler correction Model test baseline model: Minimum Function Test Statistic 1591.910 820.132 Degrees of freedom 153 153 P-value 0.000 0.000 User model versus baseline model: Comparative Fit Index (CFI) 0.785 0.751 Tucker-Lewis Index (TLI) 0.741 0.700 Robust Comparative Fit Index (CFI) 0.809 Robust Tucker-Lewis Index (TLI) 0.770 Loglikelihood and Information Criteria: Loglikelihood user model (H0) -893.430 -893.430 Loglikelihood unrestricted model (H1) -671.453 -671.453 Number of free parameters 44 44 Akaike (AIC) 1874.861 1874.861 Bayesian (BIC) 1965.520 1965.520 Sample-size adjusted Bayesian (BIC) 1827.177 1827.177 Root Mean Square Error of Approximation: RMSEA 0.207 0.152 90 Percent Confidence Interval 0.186 0.228 0.133 0.170 P-value RMSEA <= 0.05 0.000 0.000 Robust RMSEA 0.185 90 Percent Confidence Interval 0.157 0.213 Standardized Root Mean Square Residual: SRMR 0.186 0.186 Parameter Estimates: Information Expected Information saturated (h1) model Structured Standard Errors Robust.sem Latent Variables: Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all factor_1 =~ Organic_N 1.000 1.000 1.000 1.173 1.019 Organic_P2O5 0.837 0.099 8.455 0.000 0.643 1.031 0.982 0.877 Organic_K2O 0.786 0.100 7.825 0.000 0.589 0.983 0.922 0.833 Animal 0.449 0.179 2.513 0.012 0.099 0.799 0.527 0.509 Human 0.623 0.093 6.684 0.000 0.440 0.805 0.730 0.684 factor_2 =~ Inorganic_N 0.833 0.106 7.870 0.000 0.625 1.040 0.966 0.881 Inorganic_P2O5 0.812 0.079 10.251 0.000 0.657 0.968 0.942 0.863 Inorganic_K2O 0.859 0.089 9.661 0.000 0.685 1.034 0.996 0.904 Machinery 0.410 0.132 3.098 0.002 0.151 0.670 0.476 0.465 CED 0.846 0.093 9.071 0.000 0.663 1.028 0.981 0.892 HT 0.773 0.075 10.304 0.000 0.626 0.920 0.897 0.828 FAET 0.695 0.094 7.403 0.000 0.511 0.879 0.806 0.755 MAET 0.560 0.112 4.983 0.000 0.340 0.780 0.649 0.623 Fungicide 0.445 0.167 2.669 0.008 0.118 0.772 0.516 0.502 Insecticide 0.259 0.115 2.252 0.024 0.034 0.485 0.301 0.298 factor_3 =~ GWP 0.982 0.083 11.822 0.000 0.819 1.144 0.982 0.982 AP 0.856 0.106 8.106 0.000 0.649 1.063 0.856 0.856 EP 0.710 0.134 5.314 0.000 0.448 0.972 0.710 0.710 Regressions: Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all factor_1 ~ factor_3 0.613 0.188 3.260 0.001 0.244 0.981 0.523 0.523 factor_2 ~ factor_3 0.587 0.184 3.189 0.001 0.226 0.948 0.506 0.506 Covariances: Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all .HT ~~ .FAET 0.413 0.097 4.240 0.000 0.222 0.604 0.413 0.970 .MAET 0.460 0.105 4.370 0.000 0.254 0.667 0.460 0.928 .FAET ~~ .MAET 0.544 0.129 4.222 0.000 0.292 0.797 0.544 0.953 .Machinery ~~ .CED 0.323 0.169 1.904 0.057 -0.009 0.655 0.323 0.717 .Inorganic_P2O5 ~~ .MAET 0.142 0.046 3.125 0.002 0.053 0.232 0.142 0.317 .AP ~~ .EP 0.208 0.079 2.638 0.008 0.053 0.362 0.208 0.570 .factor_1 ~~ .factor_2 -0.897 0.043 -20.869 0.000 -0.981 -0.813 -0.897 -0.897 Variances: Estimate Std.Err z-value P(>|z|) ci.lower ci.upper Std.lv Std.all .Organic_N -0.052 0.032 -1.595 0.111 -0.115 0.012 -0.052 -0.039 .Organic_P2O5 0.289 0.074 3.910 0.000 0.144 0.434 0.289 0.230 .Organic_K2O 0.374 0.118 3.167 0.002 0.142 0.605 0.374 0.305 .Animal 0.795 0.280 2.840 0.005 0.246 1.344 0.795 0.741 .Human 0.607 0.160 3.795 0.000 0.293 0.920 0.607 0.532 .Inorganic_N 0.269 0.111 2.430 0.015 0.052 0.486 0.269 0.224 .Inorganic_P2O5 0.305 0.089 3.408 0.001 0.129 0.480 0.305 0.256 .Inorganic_K2O 0.222 0.070 3.155 0.002 0.084 0.359 0.222 0.183 .Machinery 0.822 0.417 1.973 0.048 0.006 1.639 0.822 0.784 .CED 0.246 0.078 3.149 0.002 0.093 0.399 0.246 0.204 .HT 0.370 0.085 4.331 0.000 0.203 0.537 0.370 0.315 .FAET 0.491 0.120 4.091 0.000 0.256 0.726 0.491 0.430 .MAET 0.664 0.143 4.646 0.000 0.384 0.945 0.664 0.612 .Fungicide 0.791 0.279 2.836 0.005 0.244 1.338 0.791 0.748 .Insecticide 0.929 0.697 1.334 0.182 -0.436 2.294 0.929 0.911 .GWP 0.037 0.028 1.306 0.192 -0.018 0.091 0.037 0.037 .AP 0.268 0.069 3.887 0.000 0.133 0.402 0.268 0.268 .EP 0.496 0.142 3.500 0.000 0.218 0.773 0.496 0.496 .factor_1 1.000 1.000 1.000 0.727 0.727 .factor_2 1.000 1.000 1.000 0.744 0.744 factor_3 1.000 1.000 1.000 1.000 1.000 R-Square: Estimate Organic_N NA Organic_P2O5 0.770 Organic_K2O 0.695 Animal 0.259 Human 0.468 Inorganic_N 0.776 Inorganic_P2O5 0.744 Inorganic_K2O 0.817 Machinery 0.216 CED 0.796 HT 0.685 FAET 0.570 MAET 0.388 Fungicide 0.252 Insecticide 0.089 GWP 0.963 AP 0.732 EP 0.504 factor_1 0.273 factor_2 0.256
Do you have any plausible solution or advice to deal with this error?
Thanks in advance,
Diego
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
q13.i4 ~~ steve*q13.i4
steve == 0Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
(...)
.q13.i4 (stev) -0.132 -0.132 -0.132
(...)
q13.i4 ~~ steve*q13.i4
steve > 0Error in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
OPTIMIZER %in% c("NLMINB0", "NLMINB1", "NLMINB2", "NLMINB", "BFGS", .... is not TRUEHS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
visual ~~ steve*speed '
# returns 0 for this correlation
summary(cfa(HS.model, data=HolzingerSwineford1939, constraints = 'steve == 0'))
# cannot find a solution with a negative covariance
summary(cfa(HS.model, data=HolzingerSwineford1939, constraints = 'steve < 0'))If I try to constrain steve to be > 0, the model does not converge. What could be causing this?
summary(fit, ci = TRUE)
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.
I have an issue related to this post.