bw.relrisklpp  R Documentation 
Uses crossvalidation to select a smoothing bandwidth for the estimation of relative risk on a linear network.
bw.relrisklpp(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 = 1e20, fudge = 0, verbose = FALSE, warn = TRUE)
X 
A multitype point pattern on a linear network (object of class

... 
Arguments passed to 
method 
Character string (partially matched) determining the crossvalidation method. See Details. 
distance 
Character string (partially matched)
specifying the type of smoothing kernel.
See 
hmin,hmax 
Optional. Numeric values.
Range of trial values of smoothing bandwith 
nh 
Number of trial values of smoothing bandwidth 
fast 
Logical value specifying whether the leaveoneout density estimates
should be computed using a fast approximation ( 
fastmethod, floored 
Developer use only. 
reference 
Character string (partially matched) specifying the
bandwidth for calculating the
reference intensities used in the McSwiggan method
(modified KelsallDiggle method).

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 crossvalidation calculations, to improve performance. 
fudge 
Fudge factor to prevent very small density estimates in the
leaveoneout calculation. If 
verbose 
Logical value indicating whether to print progress reports, 
warn 
Logical. If 
This function 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 optimising a crossvalidation criterion.
The crossvalidation criterion is selected by the argument method
:
method="likelihood"  likelihood crossvalidation 
method="leastsquares"  least squares crossvalidation 
method="KelsallDiggle"  Kelsall and Diggle (1995) density ratio crossvalidation 
method="McSwiggan"  McSwiggan et al (2019) modified density ratio crossvalidation 
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 crossvalidation
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 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 crossvalidation 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"
.
A numerical value giving the selected bandwidth.
The result also belongs to the class "bw.optim"
which can be plotted.
Greg McSwiggan and \adrian.
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.
relrisk.lpp
set.seed(2020) X < superimpose(A=runiflpp(20, simplenet), B=runifpointOnLines(20, as.psp(simplenet)[1])) plot(bw.relrisklpp(X, hmin=0.1, hmax=0.25, method="McSwiggan")) plot(bw.relrisklpp(X, hmin=0.1, hmax=0.3, nh=8, distance="euclidean"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.