Announcement

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

  • Margins with subpop option vs Regression with if option

    A.
    Code:
    logistic y x covariates [pweight=perwtf], vce(cl f00011)
    margins, subpop(b) dydx(x covariates)
    B.
    Code:
    logistic y x covariates if b==1 [pweight=perwtf], vce(cl f00011)
    margins, dydx(x covariates)
    Does anyone know the reason why I get different results from code A and B above? I would imagine the results should be the same. An explanation for the difference would be appreciated. Thanks

  • #2
    You have different samples for the regressions. The margins are based on the output of the regressions which differ because you have different samples.

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      You have different samples for the regressions. The margins are based on the output of the regressions which differ because you have different samples.
      Andrew Musau Thanks. Is there anyway I could re-write the margins command in Code A to get the same result as Code B? I am trying to understand better how margins works.

      Comment


      • #4
        Not if the underlying regressions are different. Richard Williams has some well written notes on how to calculate and interpret margins in logistic regression. You can read these and replicate some of the results by hand.

        https://www3.nd.edu/~rwilliam/stats3/Margins02.pdf

        Comment

        Working...
        X