Specifying an estimator when invoking Lavaan with a covariance matrix

418 views
Skip to first unread message

k stol

unread,
May 18, 2020, 1:58:58 PM5/18/20
to lavaan
Hello,

I read in the Lavaan tutorial that it is possible to run a model with the covariance matrix. This seems ideal for situations where one cannot share the dataset, but still want to facilitate replication. I am using the MLM estimator as I have complete data that isn't normally distributed. When running this normally, Lavaan reports an additional "Robust" column, with the Satorra-Bentler scaled Test statistic, RMSEA, and other values. I would like to be able to replicate those exact scaled values when running the model with the covariance matrix.

# get the covariance matrix based on my model (model2) and data (r_data), and specifying the estimator - I read that passing here would pass it on to sem().
results.cov <- inspectSampleCov(model=model2, data=r_data, estimator="MLM")

# run Lavaan using the model, covariance matrix. Again, specifying the estimator.
fit.cov <- sem(model=model2, sample.cov = results.cov, sample.nobs=155, estimator="MLM")

However, when running the above, I get an error:
lavaan ERROR: estimator MLM requires full data or user-provided NACOV

If I don't specify the estimator in the call to sem() it works fine, but I don't get the "Robust" column. How can I get the Robust (scaled) values when running sem() with the covariance matrix as input?

thanks

Edward Rigdon

unread,
May 18, 2020, 2:57:42 PM5/18/20
to lav...@googlegroups.com
This cannot be done. ML estimation works with a covariance matrix (or covariance matrix and mean vector) alone because the conditional multi-normality assumption underlying ML means that higher order moments of the data are uninformative--they are exact functions of the lower order moments, so the lower order moments suffice. Robust methods reject the conditional multi-normality assumption and so they require either the data itself or estimates of higher order moments. The lavaan() function includes the WLS.V and NACOV options where you can supply an asymptotic weight matrix providing this higher order information, so you could in principle provide that along with the covariance matrix and someone could use WLS or DWLS estimation and reproduce your results. But that weight matrix is generally very large (and requires large n for stable estimation), and I have not seen a case myself where it was provided.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/dc93d780-7b00-4bca-b1fc-7a0eca6ce581%40googlegroups.com.

k stol

unread,
May 18, 2020, 3:18:13 PM5/18/20
to lavaan
Dear Edward,

Thanks for your clarifying response.
To be sure: while it could be done for DWLS and WLS using the options you mentioned (WLS.V and NACOV), I understand that the NACOV option would not be possible for MLM. (DWLS isn't an option given I get no solution on my model/data set with N=155 - I read that DWLS is only useful for very large data sets).

thanks again.
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.

Yves Rosseel

unread,
May 19, 2020, 2:30:46 AM5/19/20
to lav...@googlegroups.com
On 5/18/20 9:18 PM, k stol wrote:
> To be sure: while it could be done for DWLS and WLS using the options
> you mentioned (WLS.V and NACOV), I understand that the NACOV option
> would not be possible for MLM.

It is possible, if you have access to an estimate of the NACOV matrix.
This is (N times) the asymptotic variance matrix of the sample
statistics. If you don't have it, you can't use it. To compute an
estimate of it, you need the full dataset.

This is an example:

library(lavaan)

HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data = HolzingerSwineford1939, estimator = "MLM")
fit

# using sample statistics only
S <- cov(lavInspect(fit, "data"))
NACOV <- lavInspect(fit, "Gamma")

fit2 <- cfa(HS.model, sample.cov = S, sample.nobs = 301, NACOV = NACOV,
estimator = "MLM")

Yves.


k stol

unread,
May 19, 2020, 10:16:46 AM5/19/20
to lavaan
Dear Yves,

that works beautifully. thanks for getting back on this!

klaas
Reply all
Reply to author
Forward
0 new messages