Hi All,

I am trying to use loess to smooth a 2D image, and also obtain the standard error for every pixel. I see that the standard error does not make sense. For example, running the following:

library(stats)
x <- array(c(1:100), dim=c(100,100))
y <- t(x)
v <- exp(-((x-50)^2+(y-50)^2)/30^2)
s <- v*0.02
g_noise <- rnorm(10000, mean = 0, sd = s)
f <- v + g_noise
f.loess <- loess(f ~ x + y, span=0.1, data.frame(x=c(x),y=c(y),f=c(f)))
f.predict <- predict(f.loess, data = data.frame(x = c(x), y = c(y), f = c(f)), span = 0.1,se=TRUE)
image(1:100,1:100,matrix(f.predict$se,nrow=100))

I get an image of the standard error that has peaks at regular grid nodes. Shouldn't I expect to see roughly the same error that I put in (in this case g_noise)? I notice that the noise peaks move apart for higher span values.

Thanks for your help!
Saurav

______________________________________________
R-help@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.

Reply via email to