Smooth.lpp: Spatial Smoothing of Observations on a Network

View source: R/smooth.lpp.R

Smooth.lppR Documentation

Spatial Smoothing of Observations on a Network

Description

Performs spatial smoothing of numeric values observed at a set of locations on a network. Uses kernel smoothing.

Usage

## S3 method for class 'lpp'
Smooth(X, sigma,
                     ...,
                     at=c("pixels", "points"),
                     weights=rep(1, npoints(X)),
                     leaveoneout=TRUE) 

Arguments

X

A marked point pattern on a linear network (object of class "lpp").

sigma

Smoothing bandwidth. A single positive number. See density.lpp.

...

Further arguments passed to density.lpp to control the kernel smoothing and the pixel resolution of the result.

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").

weights

Optional numeric vector of weights attached to the observations.

leaveoneout

Logical value indicating whether to compute a leave-one-out estimator. Applicable only when at="points".

Details

The function Smooth.lpp performs spatial smoothing of numeric values observed at a set of irregular locations on a linear network.

Smooth.lpp is a method for the generic function Smooth for the class "lpp" of point patterns. Thus you can type simply Smooth(X).

Smoothing is performed by kernel weighting, using the Gaussian kernel by default. If the observed values are v_1,\ldots,v_n at locations x_1,\ldots,x_n respectively, then the smoothed value at a location u is

g(u) = \frac{\sum_i k(u, x_i) v_i}{\sum_i k(u, x_i)}

where k is the kernel. This is known as the Nadaraya-Watson smoother (Nadaraya, 1964, 1989; Watson, 1964). The type of kernel is determined by further arguments ... which are passed to density.lpp

The argument X must be a marked point pattern on a linear network (object of class "lpp"). 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.

The numerator and denominator are computed by density.lpp. The arguments ... control the smoothing kernel parameters.

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) = \frac{\sum_i k(u, x_i) v_i w_i}{\sum_i k(u, x_i) w_i}

Value

If X has a single column of marks:

  • If at="pixels" (the default), the result is a pixel image on the network (object of class "linim"). Pixel values are values of the interpolated function.

  • If at="points", the result is a numeric vector of length equal to the number of points in X. Entries are values of the interpolated function at the points of X.

If X has a data frame of marks:

  • If at="pixels" (the default), the result is a named list of pixel images on the network (objects of class "linim"). There is one image for each column of marks. This list also belongs to the class "solist", for which there is a plot method.

  • If at="points", the result is a data frame with one row for each point of X, and one column for each column of marks. Entries are values of the interpolated function at the points of X.

The return value has attribute "sigma" which reports the smoothing bandwidth that was used.

Very small bandwidth

If the chosen bandwidth sigma is very small, kernel smoothing is mathematically equivalent to nearest-neighbour interpolation.

Author(s)

\spatstatAuthors

.

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

Smooth, density.lpp.

Examples

  X <- spiders
  if(!interactive()) X <- X[owin(c(0,1100), c(0, 500))]
  marks(X) <- coords(X)$x
  plot(Smooth(X, 50))
  Smooth(X, 50, at="points")

spatstat.linnet documentation built on Sept. 20, 2024, 5:06 p.m.