idw: Inverse-distance weighted smoothing of observations at...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/idw.R

Description

Performs spatial smoothing of numeric values observed at a set of irregular locations using inverse-distance weighting.

Usage

1
idw(X, power=2, at=c("pixels", "points"), ..., se=FALSE)

Arguments

X

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

power

Numeric. Power of distance used in the weighting.

at

Character string specifying whether to compute the intensity values at a grid of pixel locations (at="pixels") or only at the points of X (at="points"). String is partially matched.

...

Arguments passed to as.mask to control the pixel resolution of the result.

se

Logical value specifying whether to calculate a standard error.

Details

This function performs spatial smoothing of numeric values observed at a set of irregular locations.

Smoothing is performed by inverse distance 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

g(u) = (sum of w[i] * v[i])/(sum of w[i])

where the weights are the inverse p-th powers of distance,

w[i] = 1/d(u,x[i])^p

where d(u,x[i]) is the Euclidean distance from u to x[i].

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. Then the smoothing procedure is applied to each column of marks.

If at="pixels" (the default), the smoothed mark value is calculated at a grid of pixels, and the result is a pixel image. The arguments ... control the pixel resolution. See as.mask.

If at="points", the smoothed mark values are calculated at the data points only, using a leave-one-out rule (the mark value at a data point is excluded when calculating the smoothed value for that point).

An estimate of standard error is also calculated, if se=TRUE. The calculation assumes that the data point locations are fixed, that is, the standard error only takes into account the variability in the mark values, and not the variability due to randomness of the data point locations.

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

Value

If X has a single column of marks:

If X has a data frame of marks:

If se=TRUE, then the result is a list with two entries named estimate and SE, which each have the format described above.

Author(s)

\spatstatAuthors

. Variance calculation by Andrew P Wheeler with modifications by Adrian Baddeley.

References

Shepard, D. (1968) A two-dimensional interpolation function for irregularly-spaced data. Proceedings of the 1968 ACM National Conference, 1968, pages 517–524. DOI: 10.1145/800186.810616

See Also

density.ppp, ppp.object, im.object.

See Smooth.ppp for kernel smoothing and nnmark for nearest-neighbour interpolation.

To perform other kinds of interpolation, see also the akima package.

Examples

1
2
3
4
5
   # data frame of marks: trees marked by diameter and height
   plot(idw(finpines))
   idw(finpines, at="points")[1:5,]
   plot(idw(finpines, se=TRUE)$SE)
   idw(finpines, at="points", se=TRUE)$SE[1:5, ]

spatstat documentation built on Jan. 10, 2019, 5:04 p.m.