Provides fixed bandwidths for spatial or spatiotemporal data based on the maximal smoothing (oversmoothing) principle of Terrell (1990).
An object of class ppp
giving the observed
2D data to be smoothed.
Optional. Controls the value to use in place of the number of
observations n in the oversmoothing formula. Either a character
string, "npoints"
(default) or "geometric"
(only possible for OS
), or a positive
numeric value. See `Details'.
Optional. Controls the value for a scalar representation of
the spatial (and temporal for OS.spattemp
) scale of the data. Either a character string, "silverman"
(default), "IQR"
, "sd"
, or "var"
; or positive numeric
value(s). See `Details'.
A numeric vector of equal length to the number of points in pp
,
giving the time corresponding to each spatial observation. If unsupplied,
the function attempts to use the values in the marks
attribute of the ppp.object
in pp
.
A single numeric value of the estimated spatial bandwidth for OS
, or a named numeric vector of length 2 giving
the spatial bandwidth (as h
) and the temporal bandwidth (as lambda
) for OS.spattemp
.
These functions calculate scalar smoothing bandwidths for kernel density
estimates of spatial or spatiotemporal data: the ``maximal amount of smoothing
compatible with the estimated scale of the observed data''. See Terrell
(1990). The OS
function returns a single bandwidth for isotropic smoothing
of spatial (2D) data. The OS.spattemp
function returns two values -- one for
the spatial margin and another for the temporal margin, based on independently applying
Terrell's (1990) rule (in 2D and 1D) to the spatial and temporal margins of the supplied data.
The formula
requires a sample size, and this can be minimally tailored via nstar
.
By default, the function simply uses the number of observations in
pp
: nstar = "npoints"
. Alternatively, the user can specify their own value by simply
supplying a single positive numeric value to nstar
.
For OS
(not applicable to OS.spattemp
), if pp
is a
ppp.object
with factor-valued
marks
, then the user has the option of using
nstar = "geometric"
, which sets the sample size used in the formula
to the geometric mean of the counts of observations of each mark. This can
be useful for e.g. relative risk calculations, see Davies and Hazelton
(2010).
The scaler
argument is used to specify spatial
(as well as temporal, in use of OS.spattemp
) scale. For isotropic smoothing in the spatial
margin, one may use the `robust' estimate
of standard deviation found by a weighted mean of the interquartile ranges
of the \(x\)- and \(y\)-coordinates of the data respectively
(scaler = "IQR"
). Two other options are the raw mean of the
coordinate-wise standard deviations (scaler = "sd"
), or the square
root of the mean of the two variances (scaler = "var"
). A fourth
option, scaler = "silverman"
(default), sets the scaling constant to
be the minimum of the "IQR"
and "sd"
options; see Silverman
(1986), p. 47. In use of OS.spattemp
the univariate version of the elected scale
statistic is applied to the recorded times of the data for the temporal bandwidth.
Alternatively, like nstar
, the user can specify their
own value by simply supplying a single positive numeric value to
scaler
for OS
, or a numeric vector of length 2 (in the order of [<spatial scale>, <temporal scale>])
for OS.spattemp
.
Davies, T.M. and Hazelton, M.L. (2010), Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.
Terrell, G.R. (1990), The maximal smoothing principle in density estimation, Journal of the American Statistical Association, 85, 470-477.
data(pbc)
OS(pbc)
#> [1] 3.004161
OS(pbc,nstar="geometric") # uses case-control marks to replace sample size
#> [1] 3.498445
OS(pbc,scaler="var") # set different scalar measure of spread
#> [1] 4.947973
data(burk)
OS.spattemp(burk$cases)
#> h lambda
#> 11.24394 560.69475
OS.spattemp(burk$cases,scaler="sd")
#> h lambda
#> 12.52481 560.69475