Learn R Programming

secrlinear (version 1.2.4)

linearkd: Kernel Density on Linear Network

Description

This function applies the kernel density methods of McSwiggan et al. (2016) as implemented in spatstat (Baddeley et al. 2015). The default method solves the heat equation McSwiggan et al. (2016).

Usage

linearkd(X, linmask, sigma, which = NULL, ...)

Value

A linear habitat mask identical to the input except for the additional covariate.

Arguments

X

2-column matrix of coordinates

linmask

linear habitat mask

sigma

numeric spatial scale of kernel

which

index vector to select subset of edges (optional)

...

other arguments passed to spatstat.linnet::density.lpp

Warning

This function is still in development: there are details to resolve concerning terminal vertices etc.

Details

The density along the network of the points in X is saved as covariate `density' of the linear mask.

Setting to FALSE the argument `finespacing' of densityHeat.lpp speeds up estimation.

References

Baddeley, A., Rubak, E., and Turner, R. 2015. Spatial Point Patterns: Methodology and Applications with R. Chapman and Hall/CRC Press, London. ISBN 9781482210200, https://www.routledge.com/Spatial-Point-Patterns-Methodology-and-Applications-with-R/Baddeley-Rubak-Turner/p/book/9781482210200/.

McSwiggan, G., Baddeley, A. and Nair, G. 2016. Kernel density estimation on a linear network. Scandinavian Journal of Statistics 44, 324--345.

See Also

read.linearmask

Examples

Run this code

# simulate some points
set.seed(123)
pop <- sim.linearpopn(glymemask, N = 40)

# restrict edges to overcome a glitch in this particular linearmask

tmp <- linearkd(X = pop, linmask = glymemask, sigma = 30, 
    which = 1:325, finespacing = FALSE)

plot(tmp, cov = 'density', cex = 1.7)
plot (pop, add = TRUE, cex = 1.4)

# view covariates
head(covariates(tmp))

Run the code above in your browser using DataLab