BOOT.spattemp: Bootstrap bandwidths for a spatiotemporal kernel density...

View source: R/BOOT.spattemp.R

BOOT.spattempR Documentation

Bootstrap bandwidths for a spatiotemporal kernel density estimate

Description

Bandwidth selection for standalone spatiotemporal density/intensity based on bootstrap estimation of the MISE, providing an isotropic scalar spatial bandwidth and a scalar temporal bandwidth.

Usage

BOOT.spattemp(pp, tt = NULL, tlim = NULL, eta = NULL, nu = NULL,
  sedge = c("uniform", "none"), tedge = sedge, ref.density = NULL,
  sres = 64, tres = sres, start = NULL, verbose = TRUE)

Arguments

pp

An object of class ppp giving the spatial coordinates of the observations to be smoothed. Possibly marked with the time of each event; see argument tt.

tt

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.

tlim

A numeric vector of length 2 giving the limits of the temporal domain over which to smooth. If supplied, all times in tt must fall within this interval (equality with limits allowed). If unsupplied, the function simply uses the range of the observed temporal values.

eta

Fixed scalar bandwidth to use for the spatial margin of the reference density estimate; if NULL it is calculated as the oversmoothing bandwidth of pp using OS. Ignored if ref.density is supplied. See ‘Details’.

nu

Fixed scalar bandwidth to use for the temporal margin of the reference density estimate; if NULL it is calculated from tt using the univariate version of Terrell's (1990) oversmoothing principle. Ignored if ref.density is supplied. See ‘Details’.

sedge

Character string dictating spatial edge correction. "uniform" (default) corrects based on evaluation grid coordinate. Setting sedge="none" requests no edge correction.

tedge

As sedge, for temporal edge correction.

ref.density

Optional. An object of class stden giving the reference density from which data is assumed to originate in the bootstrap. Must be spatially edge-corrected if sedge = "uniform".

sres

Numeric value > 0. Resolution of the [sres \times sres] evaluation grid in the spatial margin.

tres

Numeric value > 0. Resolution of the evaluation points in the temporal margin as defined by the tlim interval. If unsupplied, the density is evaluated at integer values between tlim[1] and tlim[2].

start

Optional positive numeric vector of length 2 giving starting values for the internal call to optim, in the order of (<spatial bandwidth>, <temporal bandwidth>).

verbose

Logical value indicating whether to print a function progress bar to the console during evaluation.

Details

For a spatiotemporal kernel density estimate \hat{f} defined on W x T \in R^3, the mean integrated squared error (MISE) is given by E[\int_W \int_T (\hat{f}(x,t) - f(x,t))^2 dt dx], where f is the corresponding true density. Given observed spatiotemporal locations X (arguments pp and tt) of n observations, this function finds the scalar spatial bandwidth h and scalar temporal bandwidth \lambda that jointly minimise

E^*[\int_W \int_T (\hat{f}^*(x,t) - \hat{f}(x,t))^2 dt dx],

where \hat{f}(x,t) is a density estimate of X constructed with ‘reference’ bandwidths \eta (spatial; argument eta) and \nu (temporal; argument nu); \hat{f}^*(x,t) is a density estimate using bandwidths h and \lambda of n observations X^* generated from \hat{f}(x,t). The notation E^* denotes expectation with respect to the distribution of the X^*. The user may optionally supply ref.density as an object of class stden, which must be evaluated on the same spatial and temporal domains W and T as the data (arguments pp, tt, and tlim). In this case, the reference bandwidths are extracted from this object, and eta and nu are ignored.

This function is based on an extension of the theory of Taylor (1989) to the spatiotemporal domain and to cope with the inclusion of edge-correction factors. No resampling is necessary due to the theoretical properties of the Gaussian kernel.

Value

A numeric vector of length 2 giving the jointly optimised spatial and temporal bandwidths (named h and lambda respectively).

Warning

Bootstrapping for spatiotemporal bandwidth selection for spatiotemporal data is very computationally demanding. Keeping verbose = TRUE offers an indication of the computational burden by printing each pair of bandwidths at each iteration of the optimisation routine. The ‘Examples’ section also offers some rough indications of evaluation times on this author's local machine.

Author(s)

T. M. Davies

References

Taylor, C.C. (1989) Bootstrap choice of the smoothing parameter in kernel density estimation, Biometrika, 76, 705-712.

See Also

LSCV.spattemp, spattemp.density

Examples



data(burk) # Burkitt's Uganda lymphoma data
burkcas <- burk$cases

#~85 secs
hlam1 <- BOOT.spattemp(burkcas) 

#~75 secs. Widen time limits, reduce ref. bw.
hlam2 <- BOOT.spattemp(burkcas,tlim=c(400,5800),eta=8,nu=450) 

#~150 secs. Increase ref. bw., custom starting vals
hlam3 <- BOOT.spattemp(burkcas,eta=20,nu=800,start=c(7,400)) 

rbind(hlam1,hlam2,hlam3)


tilmandavies/sparr documentation built on July 8, 2024, 2:57 p.m.