Given a base X/Y dataset, calculates guassian kernel density for nearby points in feat dataset
Usage
kern_xy(base, feat, bandwidth, weight = 1)
Value
A vector of densities (or weighted densities)
Arguments
base
base dataset (eg gridcells), needs to be SpatialPolygonsDataFrame or SpatialPointsDataFrame
feat
feature dataset (eg another crime generator), needs to be SpatialPointsDataFrame
bandwidth
scaler bandwidth for the normal KDE
weight
if 1 (default), does not use weights, else pass in string that is the variable name for weights in feat
Details
This generates a density of nearby features at particular control points (specified by base). Useful for risk terrain
style feature engineering given nearby crime generators. Loops through all pairwise distances (and uses dnorm()). So will be slow
for large base + feature datasets (although should be OK memory wise). Consider aggregating/weighting data if feat is very large.
References
Caplan, J. M., Kennedy, L. W., & Miller, J. (2011). Risk terrain modeling: Brokering criminological theory and GIS methods for crime forecasting. Justice Quarterly, 28(2), 360-381.
Wheeler, A. P., & Steenbeek, W. (2021). Mapping the risk terrain for crime using machine learning. Journal of Quantitative Criminology, 37(2), 445-480.
See Also
dist_xy() for calculating distance to nearest
count_xy() for counting points inside polygon
kern_xy() for estimating gaussian density of points for features at base polygon xy coords
bisq_xy() to estimate bi-square kernel weights of points for features at base polygon xy coords
idw_xy() to estimate inverse distance weights of points for features at base polygon xy coords