[R-sig-Geo] Moving Average/Surface

adrian at maths.uwa.edu.au adrian at maths.uwa.edu.au
Thu Aug 2 05:27:46 CEST 2007


> From: "sibonile sibanda" <sibonile at gmail.com>
> Subject: [R-sig-Geo] Moving Average/Surface
>
> Is there a way to do moving average interpolation or moving surface in R
> from point data?


In the `spatstat' package the function density.ppp has an argument
`weights'. This can be used to perform spatial interpolation of values
recorded at arbitrary point locations, using kernel smoothing. Suppose X
is the point pattern of locations (an object of class "ppp") and Y is the
corresponding vector of values to be interpolated. Then
            num <- density(X, weights=Y)
            den <- density(X)
            Z <- eval.im(num/den)
calculates the standard kernel-weighted average. The argument `sigma' of
density.ppp can be used to control the smoothing bandwidth. The result Z
is a pixel image (object of class "im") that can be plotted using plot.im,
contour.im, image.im, persp.im etc.

For other kinds of smoothing, look at package `akima'

Adrian Baddeley




More information about the R-sig-Geo mailing list