Announcement

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

  • Error when using gsem

    I'm doing a mediation test with generalized structural equation modeling (gsem). My code looks like this:

    Code:
    local cov "age46 female i.region urbanicity"
        xi: svy: gsem (foreign_born hhinc_continuous `cov' -> DSM_every12, logit) ///
                     (foreign_born `cov' -> hhinc_continuous) ///
                     (2: Black_CaribbeanOrigin -> hhinc_continuous) ///
                     (2: Black_CaribbeanOrigin -> DSM_every12, logit), ///
                      nocaps group(nethrace) ginvariant(none) ///
                      var(e.DSM_every12@v1) var(e.hhinc_continuous@v2)
    I get the following error:
    invalid covariance specification;
    e.DSM_every12 does not identify an error for an uncensored gaussian response with the identity link
    an error occurred when svy executed gsem
    What am I doing wrong?

    UPDATE: I see something in the Stata documentation:
    (In gsem, you may not use the cov() option with observed exogenous variables. You also may not use cov() with error terms associated with family (Gaussian, link log.)
    Does that mean I simply can't do what I'm trying to do in Stata?
    Last edited by Max Coleman; 11 Apr 2023, 14:54.

  • #2
    Well, you cannot do what you are trying to do, but for a slightly different reason than what you cited in your post.

    The problem is that with var(e.DSM_every12@v1) you are trying to constrain the variance of the error term for DSM_every12. But as the outcome variable of a logistic regression, the error variance is automatically (pi^2)/3. You cannot modify that; it's baked in to the use of logistic regression: the "residual" variance is always (pi^2)/3.

    Comment


    • #3
      Ah, thank you for your help! That's reassuring. Given that the error variance is consistent, it sounds like the solution is to simply delete the term var(e.DSM_every12@v1).

      Comment

      Working...
      X