Skip to content

Moving Average/Surface

1 message · Adrian Baddeley

#
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