Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: logistic regr followed by lowess


From   "stata_user stata_user" <stata_dofile@hotmail.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: logistic regr followed by lowess
Date   Sat, 02 Sep 2006 17:14:08 +0100

Thanks a lot to Nick and Joseph for their useful comments

I would like to have your opinions about the following syntax

sysuse auto, clear
logit foreign mpg
predict p
sort mpg
line p  mpg || lowess  foreign mpg

What the lowess does here, nonparametric regression of the p and mpg?

Thanks a lot

S.

From: Joseph Coveney <jcoveney@bigplanet.com>
Reply-To: statalist@hsphsun2.harvard.edu
To: Statalist <statalist@hsphsun2.harvard.edu>
Subject: Re: st: logistic regr followed by lowess
Date: Sat, 02 Sep 2006 11:31:10 +0900

Sami wrote:

I have an outcome y dichotomous (0/1) and a continuous predictor X1

I use
logit y X1
I predict
p
and then I use the lowess smooth curve

I have a confusion about the lowess.

I am not sure if the lowess fits smooth successive non paramteric regression
(Y X1) for successive small intervals of X1 (starting with the smallest
values of X1), and then produces a smooth option of the predicted
probabilities

Or if it fits successive logistic regression models followed by a smooth
graph of these probabilities of these models

Please can you advise on this question?

--------------------------------------------------------------------------------

Are you asking about the -logit- option to -lowess-? It just affects the
display scale of the y-axis and omits the scatterplot of the observed
values. -lowess- does LOWESS (LOESS) smoothing and doesn't perform
logistic regression to my knowledge.

If you're looking to create a logistic regression calibration plot as
advocated in Frank E. Harrell Jr, _Regression Modeling Strategies_ (N.Y.:
Springer, 2001), then you can overlay a -twoway function- (for the logistic
regression fit) and -lowess-. That's shown below; it follows the lead of
Nick's post in this thread. Professor Harrell plots these on the
probability scale. If you want to show the calibration plot on the logit
scale, then follow the second syntax below. Note that you'll lose the
scatterplot of the observed values when plotting on the logit scale. The
latter highlights discrepancies at the extremes, which are not always greatest of interest.

Joseph Coveney

sysuse auto, clear
logit foreign mpg
predict probability
graph twoway ///
( function y = invlogit(_b[_cons] + _b[mpg] * x) , ///
range(mpg) lcolor(black) ) ///
( lowess foreign mpg, ///
lcolor(black) lpattern(dash) ) ///
( scatter foreign mpg, ///
msymbol(circle) mcolor(black) ///
ytitle(Probability That Car Manufacturer is Foreign) ///
ylabel( , format(%02.1f) angle(horizontal) nogrid) ///
xtitle(Miles per Gallon) legend(off) name(Probability) )
predict logits, xb
lowess foreign mpg, logit lineopts(lcolor(black) lpattern(dash)) ///
addplot(line logits mpg, lcolor(black) ///
legend(off) ///
ytitle(Log Odds That Manufacturer is Foreign) ///
ylabel( , angle(horizontal) nogrid) title("") ///
subtitle("") note("") name(Logit) )
exit

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
Download the new Windows Live Toolbar, including Desktop search! http://toolbar.live.com/?mkt=en-gb

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index