Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72784

Margins, atmeans after logit

$
0
0
Dear all,

I am running Stata 14 on Windows 8, using logit.

The code are:

. use http://www.stata-press.com/data/r14/margex
. logit outcome i.sex i.group

(output omitted)

Now, as expected, the predictive margins for sex and the agiusted predictions for sex are different.

. margins sex

Predictive margins Number of obs = 3,000
Model VCE : OIM

Expression : Pr(outcome), predict()

------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
sex |
male | .1286796 .0111424 11.55 0.000 .106841 .1505182
female | .1905087 .0089719 21.23 0.000 .1729241 .2080933
------------------------------------------------------------------------------


. margins sex, atmeans

Adjusted predictions Number of obs = 3,000
Model VCE : OIM

Expression : Pr(outcome), predict()
at : 0.sex = .4993333 (mean)
1.sex = .5006667 (mean)
1.group = .3996667 (mean)
2.group = .3726667 (mean)
3.group = .2276667 (mean)

------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
sex |
male | .0966105 .0089561 10.79 0.000 .0790569 .1141641
female | .1508362 .0118064 12.78 0.000 .127696 .1739764
------------------------------------------------------------------------------


However, when I use "predict (xb)" the results are the same for:

margins sex, predict(xb)
or
margins sex, atmeans predict(xb)

In fact:

. margins sex, predict (xb)

Predictive margins Number of obs = 3,000
Model VCE : OIM

Expression : Linear prediction (log odds), predict(xb)

------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
sex |
male | -2.235467 .1026169 -21.78 0.000 -2.436592 -2.034342
female | -1.728058 .0921769 -18.75 0.000 -1.908721 -1.547394
------------------------------------------------------------------------------

. margins sex, atmeans predict(xb)

Adjusted predictions Number of obs = 3,000
Model VCE : OIM

Expression : Linear prediction (log odds), predict(xb)
at : 0.sex = .4993333 (mean)
1.sex = .5006667 (mean)
1.group = .3996667 (mean)
2.group = .3726667 (mean)
3.group = .2276667 (mean)

------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
sex |
male | -2.235467 .1026169 -21.78 0.000 -2.436592 -2.034341
female | -1.728058 .0921769 -18.75 0.000 -1.908721 -1.547394
------------------------------------------------------------------------------

As after logistic regression the probability is 1/(1+exp(-xb)) it is unclear how Stata calculate different margins of probability with and without atmeans option while xb values are the same with or without at means option.

It seems to me that "predict (xb)" predict always xb atmeans, with or without this option in the code.

Thanks for your attention.

Viewing all articles
Browse latest Browse all 72784

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>