Statalist The Stata Listserver

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

RE: st: Loess confidence bands

From   "Nick Cox" <>
To   <>
Subject   RE: st: Loess confidence bands
Date   Thu, 8 Mar 2007 12:07:42 -0000

Under that heading also come, already canned, 
stuff like -running-, -mrunning- and -mvrs-. 

Use -search- for locations. The last two
support multiple predictors. 


Stas Kolenikov
> If you are not terribly committed to -lowess- per se, but want to get
> a non-parametric smooth curve with nice confidence bands, you could
> look into spline regression. The idea is that you create splines that
> look like local bumps, pretty much like a kernel, and you run a
> -regress-ion on those bumps. As is always the case with -regress-, you
> can then -predict- the point esimates and standard errors, and plot
> them however you like.
> This is quick and dirty, and it uses my version of B-splines routine
> -- there is a more official one by Roger Newson; mine is available off
> my webpage.
> sysuse auto
> bspl weight, knots(7) out prefix(_B)
> regress price weight _B*
> predict yfit , xb
> predict sefit, stdp
> gen y_hi = yfit + 1.96*sefit
> gen y_lo = yfit - 1.96*sefit
> twoway rarea y_lo y_hi weight, sort || line yfit weight, sort ||
> scatter price weight
> No need to bootstap, fast and handy :)). You can improve the look
> somewhat by taking a grid of points rather than available points.
> On 3/7/07, Paswel Phiri Marenya <> wrote:
> > Dear all:
> > How do I get confidence bands around my loess graphs? i.e
> >
> > loess y x (what else do I need to do to show confidence 
> band on the plot?)

*   For searches and help try:

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