Closed beamgau closed 10 years ago
regarding point 2: estimation method doesn't really affect whether models are nested, right? there probably should be no difference whether my input are ML- or WLSMV-models?
Thanks for letting us know about this situation, Felix -- I hadn't considered variable-order when I designed the function. Testing "fit@Data@X" wouldn't work because the order in which variables are mentioned in the syntax also affects the order of columns in the data copied by lavaan. But I worked with the sort() and rank() functions and found a solution that works for your example, and should work in general.
Regarding point 2, I agree that the concept of nesting/equivalence should be the same regardless of estimation method. However, the particular method of testing nesting/equivalence (as described in Bentler & Satorra, 2010) employed by net() is based on a limited-information estimation (analyzing model-implied covariance matrices, not raw data). In the case of robust methods like MLR, the raw data is only utilized for the robust adjustment to SE and chi-sq, and I only check the unadjusted chi-sq for the purposes of testing nesting/equivalence. But as your error message says, the WLS estimator is only available with full data, or if you specify the WLS.V weight matrix. I tried passing the WLS.V from the fitted model along with the model-implied moments, but I still receive an error message. I'll work out a simpler example and post a message to Yves on the lavaan boards -- hopefully he can help me find a way to make net() work for WLS.
Terry
great, thanks a lot!
Yves hasn't replied with a solution to the WLS-estimation problem, but the more I think about it, the less appropriate it seems. The net() function is based on mean-and-covariance structure analysis (find the citation in the help page: ?net), and it works by being able to fit a model to raw data. The WLS estimation methods for categorical data need to estimate thresholds from raw data, not from summary information. If you have a model with thresholds constrained to equality across groups, you could not feed that as data (along with polychoric correlation matrix and weight matrix) to lavaan to see whether it is nested within a less constrained model in which thresholds can differ between groups -- the thresholds could not be estimated from the prespecified thresholds of the more constrained model.
However, you should be able to check whether the covariance structure parts of the models are nested by using ML estimation (although you would not want to trust the point or SE estimates, that is not the point using the net() function). You would simply have to use logic to check whether the models are nested in terms of the threshold parameters, as well.
Terry
Hi,
thanks for providing the net() function! However, i run into two problems:
first: net() seems to be too picky about what it considers to be the same dataset in a fitted lavaan object:
the problem seems to be that the comparison of fit3@Data with fit@Data fails because the order of fit3@Data@ov.names is somewhat different. i would suggest to test whether @Data@X is identical?
the second thing is that i get the following error when comparing to objects fitted with the WLSMV estimator. comparing the same models with the ML estimator works fine!
Error in lav_samplestats_from_moments(sample.cov = sample.cov, sample.mean = sample.mean, : lavaan ERROR: the (D)WLS estimator is only available with full data or with a user-provided WLS.V
Would be great if you could look into this, best wishes, Felix