Title: | Differential Risk Hotspots in a Linear Network |
---|---|
Description: | Performs the identification of differential risk hotspots (Briz-Redon et al. 2019) <doi:10.1016/j.aap.2019.105278> along a linear network. Given a marked point pattern lying on the linear network, the method implemented uses a network-constrained version of kernel density estimation (McSwiggan et al. 2017) <doi:10.1111/sjos.12255> to approximate the probability of occurrence across space for the type of event specified by the user through the marks of the pattern (Kelsall and Diggle 1995) <doi:10.2307/3318678>. The goal is to detect microzones of the linear network where the type of event indicated by the user is overrepresented. |
Authors: | Alvaro Briz-Redon |
Maintainer: | Alvaro Briz-Redon <[email protected]> |
License: | GPL-2 |
Version: | 2.3 |
Built: | 2025-02-18 05:12:06 UTC |
Source: | https://github.com/cran/DRHotNet |
Given a relative probability surface corresponding to the occurrence of a type of event along a linear network, this function filters and groups in hotspots those segments satisfying two conditions: 1) the relative probability in the segment exceeds the average relative probability per segment in k
times the standard deviation of the complete set of probabilities estimated across all the segments of the network, and 2) there are n
or more events at a distance below h
from the middle point of the segment (h
is obtained from the object rel_probs
computed with the function relpnet
). In summary, k
and n
control the formation of differential risk hotspots along the network, given a set of relative probabilities covering the network. The choice of a higher value for k
or n
(or both) represents a more strict criterion and leads to a lower number of differential risk hotspots being detected. Users should test several values of k
and n
(sensitivity analysis on k
and n
) in order to reach reasonable choices for the research or practical purposes of their data analyses. This sensitivity analysis can be carried out with the drsens
function
drhot(X, rel_probs, k, n, dist = "path", event_distances = NULL)
drhot(X, rel_probs, k, n, dist = "path", event_distances = NULL)
X |
- A |
rel_probs |
- An object containing the relative probabilities of a specific type of event along the linear network contained in |
k |
- A numeric value that controls the procedure of detecting differential risk hotspots (departure from average relative probability), as described above |
n |
- A numeric value that controls the procedure of detecting differential risk hotspots (minimum size for the sample of events implicated in the computation of the relative probabilities), as described above |
dist |
- A character indicating which distance to use. Two values are allowed: |
event_distances |
- A matrix that contains the distances between the middle points of the segments satisfying the condition on parameter |
Returns a list that contains the differential risk hotspots found for X
and the type of event specified by rel_probs
Briz-Redon, A., Martinez-Ruiz, F., & Montes, F. (2019). Identification of differential risk hotspots for collision and vehicle type in a directed linear network. Accident Analysis & Prevention, 132, 105278.
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4)
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4)
k
and n
that are provided to drhot
Given a set of ks
and ns
parameters, this function allows the user to perform a sensitivity analysis on the parameters k
and n
by calling drhot
for each combination of k
and n
drsens(X, rel_probs, ks, ns)
drsens(X, rel_probs, ks, ns)
X |
- A |
rel_probs |
- An object containing the relative probabilities of a specific type of event along the linear network contained in |
ks |
- A numeric vector of possible values for the |
ns |
- A numeric vector of possible values for the |
A matrix providing the type-specific prediction accuracy index that corresponds to the set differential risk hotspots obtained for each value of k
or n
provided in ks
and ns
, respectively. A NA
value in this matrix indicates that no differential risk hotspots are found for the corresponding combination of k
and n
Briz-Redon, A., Martinez-Ruiz, F., & Montes, F. (2019). Identification of differential risk hotspots for collision and vehicle type in a directed linear network. Accident Analysis & Prevention, 132, 105278.
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") sensitivity_analysis <- drsens(X = chicago, rel_probs = rel_assault, ks = c(1,2), ns = c(30,40))
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") sensitivity_analysis <- drsens(X = chicago, rel_probs = rel_assault, ks = c(1,2), ns = c(30,40))
This function provides a basic summary of each differential risk hotspot provided in the object hotspots
passed to the function. This includes the proportion of the type of event in each hotspot, the total length of the hotspot, a type-specific prediction accuracy index (PAI_t
). Furthermore, this summary is also provided for an extension of each of the hotspots
drsummary( X, rel_probs, hotspots, order_extension = NULL, compute_p_value = F, n_it = 40 )
drsummary( X, rel_probs, hotspots, order_extension = NULL, compute_p_value = F, n_it = 40 )
X |
- A |
rel_probs |
- An object containing the relative probabilities of a specific type of event along the linear network contained in |
hotspots |
- A set of differential risk hotspots obtained with the function |
order_extension |
- A natural number indicating a neighbourhood order to be used for constructing an extension of the differential risk hotspots. The summary is also given for the segments forming this extension |
compute_p_value |
- A logical value allowing the user to compute a p-value representing the statistical significance of each differential risk hotspot. It is set to FALSE by default |
n_it |
- Number of simulations performed for the estimation of the p-value (if |
Returns a data.frame
providing a summary of a set of differential risk hotspots. Each row of the output corresponds to one hotspot
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4) hotspots_summary <- drsummary(X = chicago, rel_probs = rel_assault, hotspots = hotspots_assault)
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4) hotspots_summary <- drsummary(X = chicago, rel_probs = rel_assault, hotspots = hotspots_assault)
Given a linear network structure, this function creates the neighbourhood matrix ("queen" criterion) associated to it. Two segments of the network are neighbours if they share a vertex
NeighbourhoodMatrixNetwork(network)
NeighbourhoodMatrixNetwork(network)
network |
- A |
Returns a listw
object in "W"
style
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) chicago_neighbourhood <- NeighbourhoodMatrixNetwork(chicago$domain) class(chicago_neighbourhood) chicago_neighbourhood$neighbours[[1]]
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) chicago_neighbourhood <- NeighbourhoodMatrixNetwork(chicago$domain) class(chicago_neighbourhood) chicago_neighbourhood$neighbours[[1]]
DiffHotspots_n_k
This function plots a set of differential risk hotspots located along a linear network. An extension of the hotspots (including the kth order neighbours of the segments of the hotspots) is also plotted
plothot(X, hotspots, order_extension = NULL, which.plot = NULL, eps_image = F)
plothot(X, hotspots, order_extension = NULL, which.plot = NULL, eps_image = F)
X |
- A |
hotspots |
- A set of differential risk hotspots obtained with the function |
order_extension |
- A natural number indicating a neighbourhood order to be used for constructing an extension of the differential risk hotspots. The summary is also given for the segments forming this extension |
which.plot |
- A numeric vector indicating which differential risk hotspots to plot (according to the way they are ordered in |
eps_image |
- If set to |
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4) plothot(X = chicago, hotspots = hotspots_assault)
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") hotspots_assault <- drhot(X = chicago, rel_probs = rel_assault, k = 0.5, n = 4) plothot(X = chicago, hotspots = hotspots_assault)
relpnet
This function plots the relative probability of occurrence of a type of event along a linear network
plotrelp(X, rel_probs, eps_image = F)
plotrelp(X, rel_probs, eps_image = F)
X |
- A |
rel_probs |
- An object containing the relative probabilities of a specific type of event along the linear network contained in |
eps_image |
- If set to |
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") plotrelp(X = chicago, rel_probs = rel_assault)
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault") plotrelp(X = chicago, rel_probs = rel_assault)
Given a marked point pattern lying on a linear network structure, this function uses kernel density estimation (KDE) to estimate a relative probability of occurrence for a type of event specified by the user through the marks of the pattern. The marks of a point pattern represent additional information of the events that are part of the pattern
relpnet(X, lixel_length, h, mark, category_mark, finespacing = F)
relpnet(X, lixel_length, h, mark, category_mark, finespacing = F)
X |
- A |
lixel_length |
- A numeric value representing a lixel length that will be used for creating a split version of the network contained in |
h |
- A numeric value representing the bandwidth parameter (in meters) |
mark |
- Mark of |
category_mark |
- A numeric/character value from the set allowed in the chosen |
finespacing |
- A logical value specifying whether to use a finer spatial resolution (with longer computation time but higher accuracy). It is set to FALSE by default |
Returns a list that contains the relative probability values estimated along the network for the type of event specified by mark
and category_mark
Baddeley, A., Rubak, E., & Turner, R. (2015). Spatial point patterns: methodology and applications with R. Chapman and Hall/CRC.
Briz-Redon, A., Martinez-Ruiz, F., & Montes, F. (2019). Identification of differential risk hotspots for collision and vehicle type in a directed linear network. Accident Analysis & Prevention, 132, 105278.
Diggle, P. J. (2013). Statistical analysis of spatial and spatio-temporal point patterns. Chapman and Hall/CRC.
Kelsall, J. E., & Diggle, P. J. (1995). Kernel estimation of relative risk. Bernoulli, 1(1-2), 3-16.
McSwiggan, G., Baddeley, A., & Nair, G. (2017). Kernel density estimation on a linear network. Scandinavian Journal of Statistics, 44(2), 324-345.
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault")
library(DRHotNet) library(spatstat.geom) library(spatstat.linnet) library(spdep) library(raster) rel_assault <- relpnet(X = chicago, lixel_length = 50, h = 50, mark = "marks", category_mark = "assault")
A simulated lpp
object representing traffic accidents lying on a road structure. The pattern is marked, with the following marks: Collision
, Bicycle
, Car
, Lorry
, Motorcycle
, Public.bus
, Private.bus
and Van
. The mark Collision
is a factor, with the following possible values: Crossing
, Fixed-object
, Rear-end
, Run-off-road
, Run-over
, Side
. The remaining marks are numeric and binary
SampleMarkedPattern
SampleMarkedPattern
An object of class lpp
(inherits from ppx
) of length 3.