normw: Row-normalize a spatial weight matrix

View source: R/normw.R

normwR Documentation

Row-normalize a spatial weight matrix

Description

The function normw() row-normalizes a spatial weight matrix

Usage

normw(w)

Arguments

w

A matrix of size n \times n

Details

W_{ij}=\frac{W_{ij}}{\sum_kW_{ik}}

Value

A matrix of size n \times n

Author(s)

Aragon Y., Thomas-Agnan C., Ruiz-Gazen A., Robidou L.

References

Thibault Laurent, Anne Ruiz-Gazen, Christine Thomas-Agnan (2012), GeoXp: An R Package for Exploratory Spatial Data Analysis. Journal of Statistical Software, 47(2), 1-23.

See Also

neighbourmap, moranplotmap,makeneighborsw

Examples

###
# data auckland
auckland <- sf::st_read(system.file("shapes/auckland.shp", package="spData")[1])

x.ext <- auckland$Easting[1:10]
y.ext <- auckland$Northing[1:10] 

# matrix based on 3 nearest neighbors
W1 <- makeneighborsw(cbind(x.ext, y.ext), method = "both", m = 3, d = 20)
W2 <- normw(W1)

apply(W1[1:10,], 1, sum)
apply(W2[1:10,], 1, sum)

tibo31/GeoXp documentation built on April 8, 2023, 7:50 a.m.