Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bw.smoothppp

Cross Validated Bandwidth Selection for Spatial Smoothing


Description

Uses least-squares cross-validation to select a smoothing bandwidth for spatial smoothing of marks.

Usage

bw.smoothppp(X, nh = spatstat.options("n.bandwidth"),
   hmin=NULL, hmax=NULL, warn=TRUE, kernel="gaussian")

Arguments

X

A marked point pattern with numeric marks.

nh

Number of trial values of smoothing bandwith sigma to consider. The default is 32.

hmin, hmax

Optional. Numeric values. Range of trial values of smoothing bandwith sigma to consider. There is a sensible default.

warn

Logical. If TRUE, issue a warning if the minimum of the cross-validation criterion occurs at one of the ends of the search interval.

kernel

The smoothing kernel. A character string specifying the smoothing kernel (current options are "gaussian", "epanechnikov", "quartic" or "disc").

Details

This function selects an appropriate bandwidth for the nonparametric smoothing of mark values using Smooth.ppp.

The argument X must be a marked point pattern with a vector or data frame of marks. All mark values must be numeric.

The bandwidth is selected by least-squares cross-validation. Let y[i] be the mark value at the ith data point. For a particular choice of smoothing bandwidth, let y*[i] be the smoothed value at the ith data point. Then the bandwidth is chosen to minimise the squared error of the smoothed values sum (y[i] - y*[i])^2.

The result of bw.smoothppp is a numerical value giving the selected bandwidth sigma. The result also belongs to the class "bw.optim" allowing it to be printed and plotted. The plot shows the cross-validation criterion as a function of bandwidth.

The range of values for the smoothing bandwidth sigma is set by the arguments hmin, hmax. There is a sensible default, based on the nearest neighbour distances.

If the optimal bandwidth is achieved at an endpoint of the interval [hmin, hmax], the algorithm will issue a warning (unless warn=FALSE). If this occurs, then it is probably advisable to expand the interval by changing the arguments hmin, hmax.

Computation time depends on the number nh of trial values considered, and also on the range [hmin, hmax] of values considered, because larger values of sigma require calculations involving more pairs of data points.

Value

A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

data(longleaf)
  
  b <- bw.smoothppp(longleaf)
  b
  plot(b)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.