Learn R Programming

spatstat.linnet (version 3.2-2)

bw.relrisk.lpp: Cross Validated Bandwidth Selection for Relative Risk Estimation on a Network

Description

Uses cross-validation to select a smoothing bandwidth for the estimation of relative risk on a linear network.

Usage

# S3 method for lpp
bw.relrisk(X, ...,
    method = c("likelihood", "leastsquares", "KelsallDiggle", "McSwiggan"),
    distance=c("path", "euclidean"),
    hmin = NULL, hmax = NULL, nh = NULL,
    fast = TRUE, fastmethod = "onestep",
    floored = TRUE, reference = c("thumb", "uniform", "sigma"),
    allow.infinite = TRUE, epsilon = 1e-20, fudge = 0,
    verbose = FALSE, warn = TRUE)

Value

A single numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim"

(see bw.optim.object) which can be plotted to show the bandwidth selection criterion as a function of sigma.

Arguments

X

A multitype point pattern on a linear network (object of class "lpp" which has factor-valued marks).

...

Arguments passed to density.lpp to control the resolution of the algorithm.

method

Character string (partially matched) determining the cross-validation method. See Details.

distance

Character string (partially matched) specifying the type of smoothing kernel. See density.lpp.

hmin,hmax

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

nh

Number of trial values of smoothing bandwidth sigma to consider.

fast

Logical value specifying whether the leave-one-out density estimates should be computed using a fast approximation (fast=TRUE, the default) or exactly (fast=FALSE).

fastmethod, floored

Developer use only.

reference

Character string (partially matched) specifying the bandwidth for calculating the reference intensities used in the McSwiggan method (modified Kelsall-Diggle method). reference="sigma" means the maximum bandwidth considered, which is given by the argument sigma. reference="thumb" means the bandwidths selected by Scott's rule of thumb bw.scott.iso. reference="uniform" means infinite bandwidth corresponding to uniform intensity.

allow.infinite

Logical value indicating whether an infinite bandwidth (corresponding to a constant relative risk) should be permitted as a possible choice of bandwidth.

epsilon

A small constant value added to the reference density in some of the cross-validation calculations, to improve performance.

fudge

Fudge factor to prevent very small density estimates in the leave-one-out calculation. If fudge > 0, then the lowest permitted value for a leave-one-out estimate of intensity is fudge/L, where L is the total length of the network.

verbose

Logical value indicating whether to print progress reports,

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.

Author

Greg McSwiggan and Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

Details

This function is a method for the generic bw.relrisk. It computes an optimal value of smoothing bandwidth for the nonparametric estimation of relative risk on a linear network using relrisk.lpp. The optimal value is found by minimising a cross-validation criterion.

The cross-validation criterion is selected by the argument method:

method="likelihood"(negative) likelihood cross-validation
method="leastsquares"least squares cross-validation
method="KelsallDiggle"Kelsall and Diggle (1995) density ratio cross-validation
method="McSwiggan"McSwiggan et al (2019) modified density ratio cross-validation

See McSwiggan et al (2019) for details.

The result 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 ‘optimal’ bandwidth is the value of bandwidth which minimises the cross-validation criterion.

The range of values for the smoothing bandwidth sigma is set by the arguments hmin, hmax. There is a sensible default, based on the linear network version of Scott's rule bw.scott.iso.

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.

The cross-validation procedure is based on kernel estimates of intensity, which are computed by density.lpp. Any arguments ... are passed to density.lpp to control the kernel estimation procedure. This includes the argument distance which specifies the type of kernel. The default is distance="path"; the fastest option is distance="euclidean".

References

Kelsall, J.E. and Diggle, P.J. (1995) Kernel estimation of relative risk. Bernoulli 1, 3--16.

McSwiggan, G., Baddeley, A. and Nair, G. (2019) Estimation of relative risk for events on a linear network. Statistics and Computing 30 (2) 469--484.

See Also

relrisk.lpp, bw.relrisk, bw.optim.object

Examples

Run this code
   set.seed(2020)
   X <- superimpose(A=runiflpp(20, simplenet),
                    B=runifpointOnLines(20, as.psp(simplenet)[1]))
   plot(bw.relrisk(X, hmin=0.13, hmax=0.22, method="McSwiggan"))
   plot(bw.relrisk(X, hmin=0.1, hmax=0.2, nh=8, distance="euclidean"))

Run the code above in your browser using DataLab