Re: [R] local variance estimation using gam or locfit

From: Takatsugu Kobayashi <>
Date: Tue, 12 Feb 2008 01:34:41 -0500


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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 12 Feb 2008 - 06:45:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 12 Feb 2008 - 08:30:13 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive