inverse_distance_swm: construct inverse distance weight

inverse_distance_swmR 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 sf by sf::st_as_sf().

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 NULL, which means not use the bandwidth.

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]


sdsfun documentation built on April 3, 2025, 8:39 p.m.