Announcement

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

  • Retrieving variables from gsem estimation

    Hi Statalist,

    consider example 31g from the gsem help files:
    Code:
    use https://www.stata-press.com/data/r16/gsem_cfa, clear
    
    gsem (MathAb -> q1-q8, logit) (MathAtt -> att1-att5, ologit)
    Is there any way to get the data used to calculate var(MathAb), var(MathAtt) and cov(MathAb,MathAtt) so that I could reproduce these figures outside the estimation process?

    I was thinking about something similar to getting the xb/residuals after a regression, but I couldn't find a postestimation option to do such operation after gsem.

    Thanks in advance.

  • #2
    Vinicius, I’m not clear what you mean. The data used to calculate the variances and covariance of the two latent variables are the dataset provided. I’m not clear how you can hand-calculate the estimates yourself, unless you mean to do MLE by hand?

    Im also not clear how the above would relate to residuals. I can say this: latent variables are, by definition, unobserved. Their level is inferred from the other variables. A residual is observed - expected. So, there’s no residual for the latent variable. There are residuals as to the indicator variables, e.g. q1-q8, which are the ones you used to infer the latent variables. For ordered categorical questions, I’m not sure exactly how a residual is calculated, because you have the probability of responding in each response category (e.g. P(q1=0), P(q1=1), etc)
    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