CFA error

174 views
Skip to first unread message

Rev Uy

unread,
May 23, 2022, 12:32:18 AM5/23/22
to lavaan
Can someone help me in fixing this error? Thanks

Debug

Error in validObject(.Object): invalid class "Fit" object: invalid object for slot "fx.group" in class "Fit": got class "NULL", should be or extend class "numeric"

private$.run()
private$.compute(data)
suppressWarnings({
    fit <- lavaan::cfa(model = model, data = data, std.lv = std.lv, missing = missing, meanstructure = TRUE)
    estimates <- lavaan::parameterestimates(fit, standardized = TRUE, level = self$options$ciWidth/100)
    fitMeasures <- lavaan::fitMeasures(fit)
    residuals <- lavaan::residuals(fit, type = "cor")[[2]]
    modIndices <- lavaan::modificationIndices(fit, sort. = FALSE, minimum.value = 0)
})
withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning"))
lavaan::modificationIndices(fit, sort. = FALSE, minimum.value = 0)
lav_object_extended(object, add = FULL, all.free = TRUE)
lavaan(LIST, slotOptions = lavoptions, slotSampleStats = object@SampleStats, slotData = object@Data, slotCache = object@Cache, sloth1 = lavh1)
lav_model_fit(lavpartable = lavpartable, lavmodel = lavmodel, x = x, VCOV = VCOV, TEST = TEST)
new("Fit", npar = max(lavpartable$free), x = x.copy, partrace = PARTRACE, start = lavpartable$start, est = est, se = se, fx = fx, fx.group = fx.group, logl = logl, logl.group = logl.group, iterations = iterations, converged = converged, control = control, Sigma.hat = if (lavmodel@conditional.x) implied$res.cov else implied$cov, Mu.hat = if (lavmodel@conditional.x) implied$res.int else implied$mean, TH = if (lavmodel@conditional.x) implied$res.th else implied$th, test = test)
initialize(value, ...)
initialize(value, ...)
validObject(.Object)
stop(msg, ": ", errors, domain = NA)


Brett

unread,
May 23, 2022, 4:02:45 PM5/23/22
to lavaan
There are lots of places where this can go wrong that are likely to be difficult to figure out without a reprex. Recommend removing all of the warning suppression and tests first. My hunch is that something didn't converge and was given a NULL or NA value that creates a type conflict. See here https://groups.google.com/g/lavaan/c/DCqxYiHq9OM

Yves Rosseel

unread,
Jun 13, 2022, 7:35:21 AM6/13/22
to lav...@googlegroups.com
Hm. Not sure. Would you be able to send me a reprex? I will then
investigate. Please send it to Yves dot Rosseel at UGent dot be

Yves.
> --
> 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
> <mailto:lavaan+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/lavaan/3a0a794c-a564-4848-9a42-642b212ba948n%40googlegroups.com
> <https://groups.google.com/d/msgid/lavaan/3a0a794c-a564-4848-9a42-642b212ba948n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Yves Rosseel
Department of Data Analysis, Ghent University
Reply all
Reply to author
Forward
0 new messages