Announcement

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

  • over option in margins, why does the result not differ with the addition of continuous independent variables?

    If I run two regressions using logistic regressions which differ only in that the first includes age and the second does not
    margins, over(sex) where sex is a factor variable gives the same answer for both regressions.
    Why is this? Is there some way to use margins with the option over( ) to account for age in the regression
    See output below.
    Bryce
    use http://www.stata-press.com/data/r13/margex
    (Artificial data for margins)

    . logistic outcome i.sex i.group sex#group age

    Logistic regression Number of obs = 3000
    LR chi2(6) = 629.27
    Prob > chi2 = 0.0000
    Log likelihood = -1051.4383 Pseudo R2 = 0.2303

    ------------------------------------------------------------------------------
    outcome | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    sex |
    female | .8618894 .146532 -0.87 0.382 .6176417 1.202725
    |
    group |
    2 | .190021 .0451515 -6.99 0.000 .1192737 .302732
    3 | .151552 .0485633 -5.89 0.000 .0808729 .2840013
    |
    sex#group |
    female#2 | 4.890637 1.371176 5.66 0.000 2.823034 8.472561
    female#3 | 1.965945 1.571546 0.85 0.398 .4103305 9.419088
    |
    age | 1.095824 .0072039 13.92 0.000 1.081796 1.110035
    _cons | .0062258 .0022208 -14.24 0.000 .0030943 .0125266
    ------------------------------------------------------------------------------

    . margins, over(sex)

    Predictive margins Number of obs = 3000
    Model VCE : OIM

    Expression : Pr(outcome), predict()
    over : sex

    ------------------------------------------------------------------------------
    | Delta-method
    | Margin Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    sex |
    male | .0794393 .0062147 12.78 0.000 .0672586 .0916199
    female | .2596538 .0104756 24.79 0.000 .2391219 .2801857
    ------------------------------------------------------------------------------

    . logistic outcome i.sex i.group sex#group

    Logistic regression Number of obs = 3000
    LR chi2(5) = 392.69
    Prob > chi2 = 0.0000
    Log likelihood = -1169.7292 Pseudo R2 = 0.1437

    ------------------------------------------------------------------------------
    outcome | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    sex |
    female | .9197162 .1476234 -0.52 0.602 .6714717 1.259737
    |
    group |
    2 | .1091104 .0248865 -9.71 0.000 .0697781 .1706132
    3 | .0470885 .014446 -9.96 0.000 .0258096 .0859111
    |
    sex#group |
    female#2 | 4.412609 1.182369 5.54 0.000 2.60984 7.460655
    female#3 | 1.463475 1.147196 0.49 0.627 .3148774 6.801886
    |
    _cons | .4930556 .0714998 -4.88 0.000 .3710736 .6551363
    ------------------------------------------------------------------------------

    . margins, over(sex)

    Predictive margins Number of obs = 3000
    Model VCE : OIM

    Expression : Pr(outcome), predict()
    over : sex

    ------------------------------------------------------------------------------
    | Delta-method
    | Margin Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    sex |
    male | .0794393 .006455 12.31 0.000 .0667877 .0920908
    female | .2596538 .0111335 23.32 0.000 .2378325 .281475
    ------------------------------------------------------------------------------
Working...
X