Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Preliminary analysis using latent variables

    Hello,

    I am running a mediation model where I plan to use two latent variables as mediators. For preliminary analysis I want to show how these latent variables are related to my predictor/outcome (both continuous) (e.g. through a simple regression), but I am unsure how to do this.

    The code for one of the latent variables is

    sem (ypb8002 ypb8003 ypb8006 ypb8007 ypb8000 ypb8001 ypb8004 ypb8005 ypb8052 ypb8053 ypb8056 ypb8057 ypb8050 ypb8051 ypb8054 ypb8055<-Self), latent(Self) method(mlmv) stand cov(e.ypb8000*e.ypb8001 e.ypb8000*e.ypb8002 e.ypb8000*e.ypb8003 e.ypb8000*e.ypb8050 e.ypb8000*e.ypb8051 e.ypb8001*e.ypb8002 e.ypb8001*e.ypb8004 e.ypb8001*e.ypb8005 e.ypb8001*e.ypb8051 e.ypb8001*e.ypb8052 e.ypb8001*e.ypb8054 e.ypb8002*e.ypb8003 e.ypb8002*e.ypb8004 e.ypb8002*e.ypb8005 e.ypb8002*e.ypb8006 e.ypb8002*e.ypb8007 e.ypb8002*e.ypb8051 e.ypb8002*e.ypb8052 e.ypb8002*e.ypb8053 e.ypb8002*e.ypb8054 e.ypb8002*e.ypb8055 e.ypb8002*e.ypb8056 e.ypb8003*e.ypb8053 e.ypb8004*e.ypb8005 e.ypb8004*e.ypb8006 e.ypb8004*e.ypb8007 e.ypb8004*e.ypb8051 e.ypb8004*e.ypb8052 e.ypb8004*e.ypb8054 e.ypb8004*e.ypb8055 e.ypb8004*e.ypb8056 e.ypb8004*e.ypb8057 e.ypb8005*e.ypb8006 e.ypb8005*e.ypb8007 e.ypb8005*e.ypb8052 e.ypb8005*e.ypb8054 e.ypb8005*e.ypb8055 e.ypb8005*e.ypb8056 e.ypb8005*e.ypb8057 e.ypb8006*e.ypb8007 e.ypb8006*e.ypb8052 e.ypb8006*e.ypb8054 e.ypb8006*e.ypb8055 e.ypb8006*e.ypb8056 e.ypb8006*e.ypb8057 e.ypb8007*e.ypb8052 e.ypb8007*e.ypb8053 e.ypb8007*e.ypb8054 e.ypb8007*e.ypb8055 e.ypb8007*e.ypb8056 e.ypb8007*e.ypb8057 e.ypb8050*e.ypb8051 e.ypb8051*e.ypb8052 e.ypb8051*e.ypb8054 e.ypb8051*e.ypb8055 e.ypb8052*e.ypb8053 e.ypb8052*e.ypb8054 e.ypb8052*e.ypb8055 e.ypb8052*e.ypb8056 e.ypb8052*e.ypb8057 e.ypb8053*e.ypb8054 e.ypb8053*e.ypb8055 e.ypb8053*e.ypb8056 e.ypb8053*e.ypb8057 e.ypb8054*e.ypb8055 e.ypb8054*e.ypb8056 e.ypb8054*e.ypb8057 e.ypb8055*e.ypb8056 e.ypb8055*e.ypb8057 e.ypb8056*e.ypb8057)
    I tried to generate a factor score for a latent variable to use in a regression, by using 'predict latent' but I get the following output:

    . predict latent

    output:
    (xb(ypb8002 ypb8003 ypb8006 ypb8007 ypb8000 ypb8001 ypb8004 ypb8005 ypb8052 ypb8053 ypb8056 ypb8057 ypb8050 ypb8051
    ypb8054 ypb8055) assumed)
    too few variables specified
    Is there a different way to do this or something I am missing?

    Thanks

  • #2
    Anna,

    A first thought is that instead of manually specifying all the error covariances, you could use the covariance structure option to say that all your error covariances have an unstructured covariance, e.g.

    Code:
    sem (ypb8002 ypb8003 ypb8006 ypb8007 ypb8000 ypb8001 ypb8004 ypb8005 ypb8052 ypb8053 ypb8056 ypb8057 ypb8050 ypb8051 ypb8054 ypb8055<-Self), latent(Self) method(mlmv) stand covstructure(e._OEn, unstructured)
    Normally, I think the error covariance structure would be diagonal, i.e. the variance of each error is estimated freely, but their covariances are constrained at zero. Unstructured means every covariance is freely estimated.

    Speaking of that, is that a sensible assumption? Normally, we would assume that the latent variable is the only notable source of the covariances among the observed indicators. By my understanding, modeling a separate error covariance is done when you think there may be "excess" correlation among some indicators. Modeling excess correlation among all the indicators would seem to be excessive.

    Finally, to your question, your syntax should have been:

    Code:
    predict self_predicted, latent
    Without specifying latent as an option, -sem- thought you meant to generate a variable called "latent", and it assumed that this variable was the linear predictor.
    Please use the code delimiters to show code and results - use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Please use the command -dataex- to show a representative sample of data; it is installed already if you have Stata 14.2 or 15.1, else you can install it by typing

    Code:
    ssc install dataex

    Comment

    Working...
    X