Announcement

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

  • Defining latent variables to run a regression

    Hi Everyone!

    I want to conduct a regression with latent variables. These are the latent variables I want to create in bold.

    Outcome: math achievement (observed variables number and geometry)
    Independent variables:
    number (composed of 3 continuous observed variables)
    geometry (composed of 3 continuous observed variables)
    executive function (composed of 3 continuous observed variables).
    I also want to control for age.

    I want to run two separate regressions for two groups I am comparing (Indigenous vs. non-Indigenous students)

    I can't figure out how to define the latent variables in order to run the regression. This is what I've tried and none of it defines the latent variables. Any help would be very greatly appreciated!!

    sem (Spatial -> t1visspat, ) (Spatial -> t1mr2d, ) (Spatial -> t1ravens, ) (Number -> t1symadj, ) (Number -> t1dotadj, ) (Number -> t1ordadj, ) (EF ->
    > t2htks, ) (EF -> t2pathfct, ) (EF -> t2pathrct, ) (Achieve -> t2numraw, ) (Achieve -> t1georaw, ) if indstatus2group == 1, covstruct(_lexogenous, diago
    > nal) group() latent(Spatial Number EF Achieve ) cov( Spatial*Number Spatial*EF Spatial*Achieve Number*EF Number*Achieve EF*Achieve) nocapslatent

    sem (SPATIAL -> t1visspat t1mr2d t1ravens)
    sem (EF -> t1htks t1pathfor t1pathrev)
    sem (NUMBER -> t1symadj t1dotadj t1ordadj)
    sem (ACHIEVE -> t1numraw t1georaw)

  • #2
    What do you mean by "define" the latent variables? It is in the nature of latent variables that they are unobservable and not part of the data. Remember also that this kind of confirmatory factor analysis model is inherently unidentified, and becomes identifiable only by the imposition of some constraint, so any "definition" of the latent variables is entirely dependent on the particular identifying constraint used. The default constraint in Stata is to constrain the coefficient of the first variable to 1 (effectively scaling the latent variable on first variable.) If you want Stata to give you estimates of the value of the latent variables, then after running -sem- you can use -predict- with the latent option to get those. Just remember that there is nothing "real" about those values. They are simply one out of an infinite number of ways of representing the latent constructs.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      What do you mean by "define" the latent variables? It is in the nature of latent variables that they are unobservable and not part of the data. Remember also that this kind of confirmatory factor analysis model is inherently unidentified, and becomes identifiable only by the imposition of some constraint, so any "definition" of the latent variables is entirely dependent on the particular identifying constraint used. The default constraint in Stata is to constrain the coefficient of the first variable to 1 (effectively scaling the latent variable on first variable.) If you want Stata to give you estimates of the value of the latent variables, then after running -sem- you can use -predict- with the latent option to get those. Just remember that there is nothing "real" about those values. They are simply one out of an infinite number of ways of representing the latent constructs.
      Larisa, in addition to what Clyde said, it is extremely helpful to report your exact syntax and the exact error message. Feel free to shorten the iteration log, but if your question isn't clear, then the only way to infer what's going wrong is to see the error message.

      Side note: it looks like you specified a diagonal covariance structure for your latent exogenous variables (i.e. each variance estimated freely, but assume all covariances between each latent variable are zero (i.e. zero correlation)), and then you went and also told Stata to estimate the covariances between each latent variable. A more parsimonious code is probably:

      Code:
      sem (Spatial -> t1visspat t1mr2d t1ravens) ///
      (Ef -> t1htks t1pathfor t1pathrev) ///
      (Number -> t1symadj t1dotadj t1ordadj) ///
      (Achieve -> t1numraw t1georaw), ///
      f indstatus2group == 1, covstruct(_Lexogenous, unstructured)
      (More parsimonious code, assuming you know what it is doing, tends to be less prone to typos since you are typing less.)

      I am no expert on identification, but I wonder if the latent variable for achievement is identified with only two indicators.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Thank you so much for the help and advice! This is what I ended up doing... I hope it makes sense.

        Code:
        sem (Spatial -> t1visspat t1mr2d t1ravens)
        predict Spatial, latent
        
        sem (Number -> t1symadj t1dotadj t1ordadj)
        predict Number, latent
        
        sem (EF -> t1htks t1pathfor t1pathrev)
        predict EF, latent
        
        sem (Achieve -> t1georaw t1numraw)
        predict Achieve, latent
        
        regress Achieve agemonthpre Spatial Number EF if indstatus2group == 0
        regress Achieve agemonthpre Spatial Number EF if indstatus2group == 1
        Weiwen Ng I know you told me to post exact syntax and I tried using the instructions. Hopefully it worked. I'm new to statalist!

        Comment


        • #5
          Originally posted by Larisa Lam View Post
          ...

          Code:
          sem (Spatial -> t1visspat t1mr2d t1ravens)
          predict Spatial, latent
          
          sem (Number -> t1symadj t1dotadj t1ordadj)
          predict Number, latent
          
          sem (EF -> t1htks t1pathfor t1pathrev)
          predict EF, latent
          
          sem (Achieve -> t1georaw t1numraw)
          predict Achieve, latent
          
          regress Achieve agemonthpre Spatial Number EF if indstatus2group == 0
          regress Achieve agemonthpre Spatial Number EF if indstatus2group == 1
          ...
          Larisa, is there a specific question you now have?
          Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

          When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

          Comment

          Working...
          X