Announcement

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

  • variance covariance matrix (and the significance) of error terms in latent class gsem

    Hi everyone,

    I have a question about how to output the variance-covariance matrix or correlation matrix of the error terms in gsem with latent class model.

    For instance, if I have an equation system as below and I want to display the variance-covariance matrix/correlation matrix among all the errors with the significance level shown and output it into excel, I wonder if anyone knows how to add this option in the code below?
    . gsem (y1 <- y2 x1 x2) (y2 <- y3 x1 x3) (y3 <- x2 x3 x4), lclass(C 2)
    In addition, previously I output regression results using code below:


    esttab using *.csv, scalar("r2_w Overall R2") label keep(x1 x2 x3 x4 y2 y3) replace
    now I have results for two classes, I wonder if this code would still work, that is, the exported excel file would have coefficients for two classes separately?

    It would be helpful if anyone has clue about these two questions.

    Thanks

  • #2
    Originally posted by Melody Brown View Post
    Hi everyone,

    I have a question about how to output the variance-covariance matrix or correlation matrix of the error terms in gsem with latent class model.

    For instance, if I have an equation system as below and I want to display the variance-covariance matrix/correlation matrix among all the errors with the significance level shown and output it into excel, I wonder if anyone knows how to add this option in the code below?


    In addition, previously I output regression results using code below:



    now I have results for two classes, I wonder if this code would still work, that is, the exported excel file would have coefficients for two classes separately?

    It would be helpful if anyone has clue about these two questions.

    Thanks
    Splitting hairs, but I think people would normally call this a finite mixture model. A latent class model is a model where you have a vector of indicators, and you say that there are k latent classes whose vector of means differs. An FMM is a model where you have one (or more) regression relationships, i.e. you say that y = XB + e, and there is one set of Bs for each latent class. I guess an LCA model is a subset of FMMs.

    The betas have a variance-covariance matrix. The error terms in each regression relationship do not have a variance-covariance matrix, so I assume you meant the betas. In general, I don't know that people are specifically interested in the variance-covariance matrix of the betas itself; we just want to see p-values. Stata already calculated those from the diagonal of that variance-covariance matrix! (i.e. the diagonal of that matrix is the variance of each beta, from whence standard errors and p-values are derived. Some R programs won't spit out p-values for philosophical reasons, but you can actually calculate the SEs yourself.)

    I can verify that if you run estout or esttab (from Ben Jann's package estout, avail. on SSC), it will appropriately label the coefficients from each latent class. The coefficients are interleaved. For example, in the code below (can't output results as this is from a private server):

    Code:
    sysuse auto
    gsem (mpg <- i.rep78 length), lclass(C 2)
    estout
    I get, under the header (i.e. equation) mpg:
    Code:
    1.rep78#1.C     0
    1.rep78#2.C     0
    2.rep78#1.C     (some number)
    2.rep78#2.C     (some other number)
    ...
    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