smooth.ppp {spatstat}R Documentation

Spatial smoothing of observations at irregular points

Description

Performs spatial smoothing of numeric values observed at a set of irregular locations. Uses Gaussian kernel smoothing and least-squares cross-validated bandwidth selection.

Usage

smooth.ppp(X, ..., weights = rep(1, npoints(X)), at="pixels")
markmean(X, ...)
markvar(X, ...)

Arguments

X

A marked point pattern (object of class "ppp").

...

Arguments passed to bw.smoothppp and density.ppp to control the kernel smoothing and the pixel resolution of the result.

weights

Optional weights attached to the observations.

at

String specifying whether to compute the smoothed values at a grid of pixel locations (at="pixels") or only at the points of X (at="points").

Details

The function smooth.ppp performs spatial smoothing of numeric values observed at a set of irregular locations. The functions markmean and markvar are wrappers for smooth.ppp which compute the spatially-varying mean and variance of the marks of a point pattern.

Smoothing is performed by Gaussian kernel weighting. If the observed values are v[1],...,v[n] at locations x[1],...,x[n] respectively, then the smoothed value at a location u is (ignoring edge corrections)

g(u) = (sum of k(u-x[i]) v[i])/(sum of k(u-x[i]))

where k is a Gaussian kernel. This is known as the Nadaraya-Watson smoother (Nadaraya, 1964, 1989; Watson, 1964). By default, the smoothing kernel bandwidth is chosen by least squares cross-validation (see below).

The argument X must be a marked point pattern (object of class "ppp", see ppp.object). The points of the pattern are taken to be the observation locations x[i], and the marks of the pattern are taken to be the numeric values v[i] observed at these locations.

The marks are allowed to be a data frame (in smooth.ppp and markmean). Then the smoothing procedure is applied to each column of marks.

The numerator and denominator are computed by density.ppp. The arguments ... control the smoothing kernel parameters and determine whether edge correction is applied. The smoothing kernel bandwidth can be specified by either of the arguments sigma or varcov which are passed to density.ppp. If neither of these arguments is present, then by default the bandwidth is selected by least squares cross-validation, using bw.smoothppp.

The optional argument weights allows numerical weights to be applied to the data. If a weight w[i] is associated with location x[i], then the smoothed function is (ignoring edge corrections)

g(u) = (sum of k(u-x[i]) v[i] w[i])/(sum of k(u-x[i]) w[i])

An alternative to kernel smoothing is inverse-distance weighting, which is performed by idw.

Value

If X has a single column of marks:

If X has a data frame of marks:

The return value has attributes "sigma" and "varcov" which report the smoothing bandwidth that was used.

Author(s)

Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz

References

Nadaraya, E.A. (1964) On estimating regression. Theory of Probability and its Applications 9, 141–142.

Nadaraya, E.A. (1989) Nonparametric estimation of probability densities and regression curves. Kluwer, Dordrecht.

Watson, G.S. (1964) Smooth regression analysis. Sankhya A 26, 359–372.

See Also

density.ppp, bw.smoothppp, ppp.object, im.object.

See idw for inverse-distance weighted smoothing.

To perform interpolation, see also the akima package.

Examples

   # Longleaf data - tree locations, marked by tree diameter
   data(longleaf)
   # Local smoothing of tree diameter (automatic bandwidth selection)
   Z <- smooth.ppp(longleaf)
   # Kernel bandwidth sigma=5
   plot(smooth.ppp(longleaf, 5))
   # mark variance
   plot(markvar(longleaf, sigma=5))
   # data frame of marks: trees marked by diameter and height
   data(finpines)
   plot(smooth.ppp(finpines, sigma=2))

[Package spatstat version 1.25-3 Index]