Announcement

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

  • Obtaining the predicted residuals from a regression after SEM.

    "Hello everyone, can someone help me obtain the predicted residuals of each individual after my SEM regression? I need to use these residuals to construct internal instruments following Lewbel's approach (2012).
    The command "predict resid_MI, residuals" is not working.
    Here is my syntax. sem (MI <- $covlist) (MI -> $indicators), nocapslatent latent(MI) method(ml) log
    estat residuals, normalized (displays the residuals matrix)

    Thanks

  • #2
    I'm a little confused; can't you get the predicted values and then just subtract them from the observed? see
    Code:
    help sem_predict

    Comment


    • #3
      Yes, that's exactly it. The predict command doesn't work after sem. I'm using another command (estat residuals, normalized ) to obtain the normalized error matrix, but I'm having trouble creating a variable to store the errors for each individual.

      Comment


      • #4
        The predict command doesn't work after sem
        This is not accurate. Look at

        Code:
        help sem_postestimation
        Per Rich's advice in #2, you need something like

        Code:
        sysuse auto, clear
        sem (mpg <- weight turn foreign)
        predict mpghat, xb
        gen res= mpg-mpghat

        Comment


        • #5
          Originally posted by Vinbamba Boris Laurence View Post
          I'm using another command (estat residuals, normalized ) to obtain the normalized error matrix, but I'm having trouble creating a variable to store the errors for each individual.
          Aren't those residuals of the fitted (implied) covariance matrix?.It doesn't seem that "errors for each individual" would be meaningful in that context.

          And I'm not sure what kind of residuals "Lewbel's approach (2012)" requires, but if you want to store the matrix returned by the postestimation command in your dataset, then you can
          Code:
          matrix define Residuals = vech(r(nres_cov))'
          svmat double Residuals

          Comment


          • #6
            Thank you Joseph . I have find solution . Thanks

            Comment


            • #7
              Hello, I have over 20 covariates in a regression with the continuous variable Y representing mental health. I want to use the Lasso linear regression to select the most relevant covariates. Which is the best model to use (CV, adaptive, plugin, BIC)?

              Comment

              Working...
              X