[R] local variance estimation using gam or locfit

Takatsugu Kobayashi tkobayas at indiana.edu
Tue Feb 12 07:34:41 CET 2008


Hi,

I appreciate if any one could give me clues about the following problem.

I have a map data, x, y, z, and d, where (x,y) is the coordinate of a 
point and d is a distance from the urban center (0,0), and z is 
population density.  Then I would like to calculate local standard 
deviations of these points.  Let me say hypothetically,

x <- rnorm(100)
y <- rnorm(100)
z <- runif(100)
d <- sqrt(x^2+y^2)*runif(100,1,1.5)

mod <- gam(z~s(x,y,by=d))

std.res.loc <- residuals/loc.std

So, I would like to calculate loc.std.  Is there any function available 
for this? Or should I manually compute it?

I am reading "Generalized Additive Model: Introduction to R" by Dr. Wood.

Thank you very much.

Tk



More information about the R-help mailing list