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@esr.cri.nz gcam032@gmail.com [[alternative HTML version deleted]]
On Tue, 5 Aug 2008, Gareth Campbell wrote:> 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??You can have pointwise confidence intervals or a simultaneous confidence band, so which did you mean? I don't know of any theory for the latter, whereas for the former lowess is a locally linear fit and hence there will be asymptotic results not very relevant for local fits. Looks like a case for simulation-based inference, e.g. via a bootstrap.> > > 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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}}