SEM for prediction

Posted on
No user picture. LearnSEM8 Joined: 08/14/2012
Hello -

I wanted to check with the community if anyone has experience in using SEM for predictive modeling. If yes, how does one approach it. Thanks in advance for your help!

Replied on Wed, 10/14/2015 - 22:17
No user picture. libowen Joined: 10/12/2015

We use STATA gsem for prediction.

In R package lavaan, there is also a prediction function. But it is not well documented. There are two types of prediction mode, 'lv' and 'ov' for latent variables and observed variables.

I did not find any resources about doing predictive modeling in OpenMx.

Replied on Wed, 10/21/2015 - 12:54
Picture of user. mhunter Joined: 07/31/2009

In reply to by rabil

To my knowledge OpenMx does not have anything like this yet. Because it's come up on the forums a couple times now, I've been thinking about it. I'm not sure how latent variable predictions would differ from factor scores. These should be possible through RAM models with the mxFactorScores() function.

Similarly, there should be a way to obtain observed variable predictions as conditional means estimates depending on the latent variable predictions.

The thing I'm struggling with is just what are these predictions? Does anyone have a reference?

Replied on Wed, 10/21/2015 - 16:53
Picture of user. Ryne Joined: 07/31/2009

In reply to by rabil

This isn't an implemented feature, but to the extent your data are complete, you can do this with mxEval, definition variables, or repeated model evaluations like the Estabrook & Neale factor scoring method. The predicted value of y should be the mean of y for any given row of data. If you have a vector/matrix of regression weights, predicted value of y should just be X %*% B. For more complex models, you'd have to cycle through the data a row at the time, replacing x with the vector of responses for a given individual.

There was a recent discussion among the developers about implementing this feature (more specifically, about getting residuals), but we either stopped or agreed to disagree regarding how OpenMx would decide what variables are exogenous and which are endogenous. For that general question and your specific one, can you tell us more about what you're looking to get out?

Replied on Thu, 10/29/2015 - 11:33
Picture of user. rabil Joined: 01/14/2010

In reply to by libowen

The prediction function lavPredict in lavaan does not work correctly for observed variables. For example, if you implemented a simple regression models and tried to predict the response, it would give you the observed response instead of the predicted response. This is noted in the help information (but is easy to miss).