View source: R/BOOT.spattemp.R

BOOT.spattemp | R Documentation |

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.

```
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)
```

`pp` |
An object of class |

`tt` |
A numeric vector of equal length to the number of points in |

`tlim` |
A numeric vector of length 2 giving the limits of the temporal domain over which to smooth. If supplied, all times in |

`eta` |
Fixed scalar bandwidth to use for the spatial margin of the reference density estimate; if |

`nu` |
Fixed scalar bandwidth to use for the temporal margin of the reference density estimate; if |

`sedge` |
Character string dictating spatial edge correction. |

`tedge` |
As |

`ref.density` |
Optional. An object of class |

`sres` |
Numeric value > 0. Resolution of the [ |

`tres` |
Numeric value > 0. Resolution of the evaluation points in the temporal margin as defined by the |

`start` |
Optional positive numeric vector of length 2 giving starting values for the internal call to |

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

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.

A numeric vector of length 2 giving the jointly optimised spatial and temporal bandwidths (named `h`

and `lambda`

respectively).

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 `optim`

isation routine. The ‘Examples’ section also offers some rough indications of evaluation times on this author's local machine.

T. M. Davies

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

`LSCV.spattemp`

, `spattemp.density`

```
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)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.