inverse_distance_swm {sdsfun} | R Documentation |
construct inverse distance weight
Description
Function for constructing inverse distance weight.
Usage
inverse_distance_swm(sfj, power = 1, bandwidth = NULL)
Arguments
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 |
Details
The inverse distance weight formula is
w_{ij} = 1 / d_{ij}^\alpha
Value
A inverse distance weight matrices with class of matrix
.
Examples
library(sf)
pts = read_sf(system.file('extdata/pts.gpkg',package = 'sdsfun'))
wt = inverse_distance_swm(pts)
wt[1:5,1:5]
[Package sdsfun version 0.1.1 Index]