[R] 95% CI bands on a Lowess smoother

S Ellison S.Ellison at lgc.co.uk
Tue Aug 5 13:39:35 CEST 2008


If you use loess instead of lowess, you can get standard errors and
hence approximate confidence bands by using predict.

Example:

plot(cars)
plx<-predict(loess(dist~speed, data=cars), se=T)

lines(cars$speed,plx$fit)
lines(cars$speed,plx$fit+2*plx$s, lty=2) #rough & ready CI
lines(cars$speed,plx$fit-2*plx$s, lty=2)

Mind you, there's absolutely no reason why adjacent values of y should
have anything to do with one another unless the x-axis is meaningful. I
assume your RI's were all collected in some meaningful equi-spaced
sequence or your x has both x- and y- components, 'cos there wouldn't be
much meaning to plot(lowess(RI)) otherwise. 

Steve E

>>> "Gareth Campbell" <gcam032 at gmail.com> 05/08/2008 05:37 >>>
Hi there,

I'm plotting some glass RI values just by plotting

plot(x)

then I put on my lowess smoother

lines(lowess(x))

now I want to put on some 95% Confidence Interval bands of the lowess
smoother, but don't know how??


Thanks

-- 
Gareth Campbell
PhD Candidate
The University of Auckland

P +649 815 3670
M +6421 256 3511
E gareth.campbell at esr.cri.nz 
gcam032 at gmail.com 

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code.

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list