hfgolino/EGAnet

non-positive definite matrix in `UVA` for latent variable in {lavaan}

Closed this issue · 1 comments

The variance-covariance matrix of the estimated parameters (vcov)
does not appear to be positive definite! The smallest eigenvalue
(= 0.000000e+00) is smaller than zero. This may be a symptom that
the model is not identified.Error in lav_predict_eta_ebm_ml(lavobject = lavobject, lavmodel = lavmodel,  : 

lavaan ERROR: (residual) variance matrix THETA contains zero elements on the diagonal.
Error in lav_predict_eta_ebm_ml(lavobject = lavobject, lavmodel = lavmodel, :
lavaan ERROR: (residual) variance matrix THETA contains zero elements on the diagonal.
7.
stop("lavaan ERROR: (residual) variance matrix THETA contains zero elements on the diagonal.")
6.
lav_predict_eta_ebm_ml(lavobject = lavobject, lavmodel = lavmodel,
lavdata = lavdata, lavsamplestats = lavsamplestats, se = se,
acov = acov, level = level, data.obs = data.obs, eXo = eXo,
ML = FALSE, optim.method = optim.method)
5.
lav_predict_eta(lavobject = NULL, lavmodel = lavmodel, lavdata = lavdata,
lavsamplestats = lavsamplestats, lavimplied = lavimplied,
se = se, acov = acov, level = level, data.obs = data.obs,
eXo = eXo, method = method, fsm = fsm, optim.method = optim.method)
4.
lavaan::lavPredict(cfa_estimate)
3.
(function (data, wto_output, redundant_variables, lavaan_ARGS)
{
composite_variables <- create_composite_variable_matrix(data = data,
redundant_variables = redundant_variables) ...
2.
do.call(what = reduce_FUN, args = reduce_ARGS)
1.
UVA(data = dataset_EGA, sig = 0.25, auto = TR

Bug was due to items needed to be recoded when setting loadings to be equal

Fix for now: Items are recoded using strategy in net.loads

For the future? Use equality constraint in latent variable model:

model <- paste(
  "LF =~ a*var1 + b*var2",
  "b := -1*a", sep = "\n"
)