4
$\begingroup$

How can an SEM model be fitted when the dataset includes both continuous and categorical variables?

$\endgroup$
0

1 Answer 1

8
$\begingroup$

That will depend on the model. When you are fitting a model with an exogenous binary categorical variable (e.g. males and females) or an exogenous ordinal variable with a clear ordering, then you can fit the variable as dummy-coded. With categorical endogenous variables, you would have to fit the model using something like diagonally weighted least squares (in lavaan this would involve the WLSMV estimator).

If you are not interested in latent variables, and are open to not using covariance matrix-based SEM, then you can easily use whatever categorical variables you want in piecewise SEMs, which only requires fitting the linear model of your choosing into each path like you typically would.

$\endgroup$
5
  • $\begingroup$ Thank you for your response. I am interested in the Covariance-Based SEM method, which is indeed based on the covariance matrix. However, I am wondering how the empirical covariance matrix is computed when the type of observed variable is categorical (binary, ordinal, nominal). $\endgroup$ Commented Mar 21 at 16:08
  • 2
    $\begingroup$ For exogenous variables that are dummy-coded there is no difference. For WLSMV estimators, lavaan will calculate the polychoric correlations and then calculate a weight matrix from the asymptotic covariance matrix. The path estimates become the change in the response on a standardized z scale for each unit change in the predictor. See more about that here. $\endgroup$ Commented Mar 23 at 0:30
  • $\begingroup$ Yes, I tried using the WLSMV estimator, but unfortunately, I encountered an error: "unordered factor(s) detected." This happens with a model that has nominal latent variable indicators. $\endgroup$ Commented Mar 25 at 3:53
  • 2
    $\begingroup$ This is more a coding question than a statistics question, but perhaps you can ask a new or edited question with your model syntax explicitly written out so others can see what you did to get this error. $\endgroup$ Commented Mar 25 at 4:30
  • 2
    $\begingroup$ For nominal data see Revuelta, J., Maydeu-Olivares, A., & Ximénez, C. (2020). Factor analysis for nominal (first choice) data. Structural Equation Modeling: A Multidisciplinary Journal, 27(5), 781-797. $\endgroup$ Commented Mar 25 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.