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

st: RE: logit and LOESS graphs

From   "Nick Cox" <>
To   <>
Subject   st: RE: logit and LOESS graphs
Date   Fri, 7 Mar 2008 19:54:41 -0000

In addition to Maarten's comments: 

1. What was first called lowess was later called loess (and is also
implemented in other languages 
as locfit). Stata has stuck to the name -lowess- for some time. 

No matter, in Stata 

. search loess

would have pointed Chris to helpful documentation. The name -loess- is
at least for some users most
unfortunate as it refers to a particular kind of deposit much studied by
sedimentologists and geomorphologists
(and not a smooth surface as Bill Cleveland claims somewhere).  

No matter!

2. A logit curve, depending quite what is meant by that, can be obtained
pure and simple by 

twoway function logit = logit(x)

twoway function inverse_logit = invlogit(x), ra(-5 5)

3. If you install -regplot- (-findit regplot- for locations), then
another way to get part of Maarten's 
example is 

logit foreign mpg 


Maarten buis

--- Chris wrote:
> 1. Does anyone know how to perform LOESS in Stata?  I know how to do 

> this in R but I'd prefer to avoid that, because R is memory
> inefficient.
> 2. Is there a way to display a logit curve?

Given the combination of question I am assuming you are looking for
something like the example below. However, there ares some weird jumps
in the lowess curve that I cannot explain. 

-- Maarten

*----------- begin example ------------------
sysuse auto, clear
logit foreign mpg
sort mpg
predict logit, xb
predict pr, pr

twoway lowess foreign mpg || ///
       line pr mpg, name(pr)

twoway lowess foreign mpg, logit || ///
       line logit mpg, name(logit)
*----------------- end example -----------------

*   For searches and help try:

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