View source: R/hotspot_classify.R
hotspot_classify | R Documentation |
Classify cells in a grid based on changes in the clustering of points (typically representing events) in a two-dimensional regular grid over time.
hotspot_classify(
data,
time = NULL,
period = NULL,
start = NULL,
cell_size = NULL,
grid_type = "rect",
grid = NULL,
collapse = FALSE,
params = hotspot_classify_params(),
quiet = FALSE
)
data |
|
time |
Name of the column in |
period |
A character value containing a number followed by a unit of time, e.g. for example, "12 months" or "3.5 days", where the unit of time is one of second, minute, hour, day, week, month, quarter or year (or their plural forms). |
start |
A |
cell_size |
|
grid_type |
|
grid |
|
collapse |
If the range of dates in the data is not a multiple of
|
params |
A list of optional parameters that can affect the output. The
list can be produced most easily using the
|
quiet |
if set to |
An sf
tibble of regular grid cells with
corresponding hot-spot classifications for each cell. This can be plotted
using autoplot
.
Hot-spots are spatial areas that contain more points than would be expected by chance; cold-spots are areas that contain fewer points than would be expected. Whether an area is a hot-spot can vary over time. This function creates a space-time cube, determines whether an area is a hot-spot for each of several consecutive time periods and uses that to classify areas according to whether they are persistent, intermittent, emerging or former hot- or cold-spots.
Hot- and cold-spots are identified by calculating the Getis-Ord
Gi*
(gi-star) or
Gi*
Z
-score statistic for each cell in a regular grid for each time period.
Cells are classified as follows, using the parameters provided in the
params
argument:
Persistent hot-/cold-spots are cells that have been hot-/cold-spots
consistently over time. Formally: if the p-value is less than
critical_p
for at least persistent_prop
proportion of time periods.
Emerging hot-/cold-spots are cells that have become hot-/cold-spots
recently but were not previously. Formally: if the p-value is less
than critical_p
for at least hotspot_prop
of time periods defined as
recent by recent_prop
but the p-value was not less than
critical_p
for at least hotspot_prop
of time periods defined as
non-recent by 1 - recent_prop
.
Former hot-/cold-spots are cells that used to be hot-/cold-spots but have
not been more recently. Formally: if the p-value was less than
critical_p
for at least hotspot_prop
of time periods defined as
non-recent by 1 - recent_prop
but the p-value was not less than
critical_p
for for at least hotspot_prop
of time periods defined as
recent by recent_prop
.
Intermittent hot-/cold-spots are cells that have been hot-/cold-spots,
but not as frequently as persistent hotspots and not only during
recent/non-recent periods. Formally: if the p-value is less than
critical_p
for at least hotspot_prop
of time periods but the cell is
not an emerging or former hotspot.
No pattern if none of the above categories apply.
The grid produced by this function covers the convex hull of the input data
layer. This means the result may include
Gi* or
Gi*
values for cells that are outside the area for which data were provided,
which could be misleading. To handle this, consider cropping the output layer
to the area for which data are available. For example, if you only have crime
data for a particular district, crop the output dataset to the district
boundary using st_intersection
.
If no cell size is given then the cell size will be set so that there are 50
cells on the shorter side of the grid. If the data
SF object is projected
in metres or feet, the number of cells will be adjusted upwards so that the
cell size is a multiple of 100.
Chainey, S. (2020). Understanding Crime: Analyzing the Geography of Crime. Redlands, CA: ESRI.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.