Statalist The Stata Listserver


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

st: RE: logistic regr followed by lowess


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: logistic regr followed by lowess
Date   Fri, 1 Sep 2006 20:18:41 +0100

I don't know what you are doing with -lowess- as you 
show us no code. 

But if I were to go 

sysuse auto, clear 
logit foreign mpg 
predict p
lowess p mpg 

that works quite well, but it is far from the best 
way to get a plot of the predicted values. The 
logit model with just one continuous predictor 
gives a prediction which is by defintion a (smooth) 
curve in 2-space exactly defined by an equation, so there is 
nothing to smooth. 

Better ways to do it include 

. twoway function prediction = invlogit(_b[_cons] + _b[mpg] * x) , ra(mpg)

. twoway mspline p mpg, bands(200)

. regplot

where -regplot- locations can be found by -search regplot-. 

To answer what I think your question is in another way, if you 
follow -logit- with -lowess-, -lowess- has no idea that what 
it is plotting is anything to with -logit-. 

Nick 
n.j.cox@durham.ac.uk 

stata_user stata_user (split personality?) 

> 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
> 

*
*   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