inverse_distance_swm | R Documentation |
Function for constructing inverse distance weight.
inverse_distance_swm(sfj, power = 1, bandwidth = NULL)
sfj |
Vector object that can be converted to |
power |
(optional) Default is 1. Set to 2 for gravity weights. |
bandwidth |
(optional) When the distance is bigger than bandwidth, the
corresponding part of the weight matrix is set to 0. Default is |
The inverse distance weight formula is
w_{ij} = 1 / d_{ij}^\alpha
A inverse distance weight matrices with class of matrix
.
library(sf)
pts = read_sf(system.file('extdata/pts.gpkg',package = 'sdsfun'))
wt = inverse_distance_swm(pts)
wt[1:5,1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.