Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Michael N. Mitchell" <Michael.Norman.Mitchell@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: adjust vs. margins revisited |

Date |
Fri, 30 Jul 2010 11:32:35 -0700 |

Dear All

************ * MEM METHOD ************ sysuse auto.dta logistic foreign price mpg weight adjust price mpg weight, pr ci margins, atmeans . sysuse auto.dta (1978 Automobile Data) . logistic foreign price mpg weight <output omitted> . adjust price mpg weight, pr ci ------------------------------------------------------------------------------------------------ Dependent variable: foreign Equation: foreign Command: logistic Covariates set to mean: price = 6165.2568, mpg = 21.297297, weight = 3019.4595 ------------------------------------------------------------------------------------------------ ---------------------------------------------- All | pr lb ub ----------+----------------------------------- | .041982 [.005215 .268087] ---------------------------------------------- Key: pr = Probability [lb , ub] = [95% Confidence Interval] . margins, atmeans Adjusted predictions Number of obs = 74 Model VCE : OIM Expression : Pr(foreign), predict() at : price = 6165.257 (mean) mpg = 21.2973 (mean) weight = 3019.459 (mean) ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .0419821 .0435708 0.96 0.335 -.0434151 .1273794 ------------------------------------------------------------------------------

************ * AME METHOD ************ Let's try the AME approach using -margins- (which is not available in -adjust-). . margins Predictive margins Number of obs = 74 Model VCE : OIM Expression : Pr(foreign), predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .2972973 .0316226 9.40 0.000 .2353182 .3592764 ------------------------------------------------------------------------------

. margins, at(price=4000) Predictive margins Number of obs = 74 Model VCE : OIM Expression : Pr(foreign), predict() at : price = 4000 ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .1879927 .0361467 5.20 0.000 .1171464 .258839 ------------------------------------------------------------------------------

Best regards, Michael N. Mitchell Data Management Using Stata - http://www.stata.com/bookstore/dmus.html A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html Stata tidbit of the week - http://www.MichaelNormanMitchell.com On 2010-07-30 10.45 AM, Steve Samuels wrote:

I agree with Richard. There is also another lesson here- for users of -adjust- and -margins-: **************************CODE BEGINS************************** sysuse auto.dta,clear logistic foreign price mpg weight adjust price weight mpg, pr ci tab foreign **************************CODE BEGINS************************** Although the crude proportion (mean) of foreign is 0.297, he estimated probability of "foreign" with the covariates held to their means is 0.042! Estimation at mean values does not always give "typical" predictions, and, as here, can be completely miselading. On the other hand, -margins- can recover with a bit of tweaking: **************************CODE BEGINS************************** sysuse auto,clear logistic foreign price mpg weight, robust predict xb, xb margins, expression(exp(xb)/(1+exp(xb))) at((means) _all) vce(unconditional) ***************************CODE ENDS*************************** gives a predicted value equal to 0.297. Steve

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: adjust vs. margins revisited***From:*Tim Wade <wadetj@gmail.com>

**Re: st: adjust vs. margins revisited***From:*Steve Samuels <sjsamuels@gmail.com>

- Prev by Date:
**Re: st: AW: adjust vs. margins revisited** - Next by Date:
**st: open table from csv file** - Previous by thread:
**Re: st: adjust vs. margins revisited** - Next by thread:
**Re: st: adjust vs. margins revisited** - Index(es):