rhrHlscv: Calculate a Bandwidth for Kernel Density Estimation

Description Usage Arguments Details Value References Examples

View source: R/rhrHlscv.R

Description

Use two dimensional least square cross validation to select the bandwidth of a kernel density estimate.

Usage

1
2
3
4
rhrHlscv(xy, range = do.call(seq, as.list(c(rhrHref(xy)$h * c(0.1, 2),
  length.out = 100))), whichMin = "global", rescale = "none",
  trast = rhrRasterFromExt(rhrExtFromPoints(xy, extendRange = 0.2), nrow =
  100, res = NULL))

Arguments

xy

A two column numeric data.frame with two columns: the x and y coordinates.

range

numeric vector with different candidate h values.

whichMin

A character indicating if the global or local minimum should be searched for.

rescale

A character, indicating if and if how data are rescaled. unitvar rescales x and y coordinates to unit variance, xvar rescales x and y coordinate to variance of x and none uses the raw data.

trast

A RasterLayer with the desired extent and resolution.

Details

Function to calcualte least square cross validation bandwidth. This implementation is based on Seaman and Powell (1996). If whichMin is "global" the global minimum is returned, else the local minimum with the largest candidate bandwidth is returned.

Value

vector of length two

References

Seaman, D. E., & Powell, R. A. (1996). An evaluation of the accuracy of kernel density estimators for home range analysis. _Ecology, 77(7)_, 2075-2085.

Carr and Rodges

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
data(datSH)
hlscv <- rhrHlscv(datSH[1:1000, 2:3])

## Plotting the different values for h
x <- datSH[, 2]
y <- datSH[, 3]


## End(Not run)

jmsigner/rhr documentation built on June 26, 2020, 8:59 a.m.