[R] xyplot, loess and se

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat May 8 14:17:24 CEST 2004


My suggestion is that you look at the code for panel.loess, and then ask 
yourself what made you think this could possibly work.

-  what happens to arguments in ... ?
-  does panel.loess call loess?
-  does loess accept a se=TRUE argument?  Does loess.smooth?

You need to write your own panel and prepanel functions, calling loess and
then predict -- see ?predict.loess.

On Sat, 8 May 2004, Luca De Benedictis wrote:

> Dear R-friends,
> in plotting x and y, conditioning on z, I am trying to find a way to 
> make the standard errors appearing together with the loess in the 
> trellis plot.
> I have tried the following code without success.
> 
> x <- x
> y <- y
> z.two.groups <- equal.count(z, number=2, overlap=.1)
>  > xyplot(x~y | z.two.groups,
> + prepanel = function(x, y)
> + prepanel.loess(x, y, span = .75, se = TRUE),
> + panel = function(x, y){
> + panel.grid(h = 2, v = 2, lwd = 2)
> + panel.xyplot(x, y, cex = 0.6)
> + panel.loess(x, y, span = .75, se = TRUE)
> + },
> + par.strip = list(cex = .75),aspect = 2,
> + xlab = list("x",cex = 1),
> + ylab = list("y",cex = 1),
> + main=list("", cex=2)
> + )
> 
> Any help would be appreciated

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




More information about the R-help mailing list