geo_weights: Inverse Geographic Weight Matrix

View source: R/general_helpers.R

geo_weightsR Documentation

Inverse Geographic Weight Matrix

Description

Calculates a inverse-distance based weight matrix for the function ssMRCD (see details).

Usage

geo_weights(coordinates, groups)

Arguments

coordinates

matrix of coordinates of observations.

groups

vector of neighborhood groups.

Details

First, the centers (means of the coordinates given) c_i of each neighborhood is calculated. Then, the Euclidean distance between the centers is calculated and the weight is based on the inverse distance between two neighborhoods,

w_{ij} = \frac{1}{dist(c_i, c_j)}.

It is scaled according to a weight matrix.

Value

Returns a weighting matrix W and the coordinates of the centers per neighborhood centersN.

See Also

rescale_weights

Examples

coordinates = matrix(rnorm(1000), ncol = 2, nrow = 500)
groups = sample(1:5, 500, replace = TRUE)

geo_weights(coordinates, groups)


ssMRCD documentation built on Sept. 11, 2024, 5:14 p.m.