adjustSpatialWeights: Semantic adjusted spatial weights

View source: R/side_functions.R

adjustSpatialWeightsR Documentation

Semantic adjusted spatial weights

Description

Function to adjust the spatial weights so that they represent semantic distances between neighbours

Usage

adjustSpatialWeights(data, listw, style, mindist = 1e-11)

Arguments

data

A dataframe with numeric columns

listw

A nb object from spdep

style

A letter indicating the weighting scheme (see spdep doc)

mindist

A minimum value for distance between two observations. If two neighbours have exactly the same values, then the euclidean distance between them is 0, leading to an infinite spatial weight. In that case, the minimum distance is used instead of 0.

Value

A listw object (spdep like)

Examples

data(LyonIris)
AnalysisFields <-c("Lden","NO2","PM25","VegHautPrt","Pct0_14","Pct_65","Pct_Img",
"TxChom1564","Pct_brevet","NivVieMed")
dataset <- LyonIris@data[AnalysisFields]
queen <- spdep::poly2nb(LyonIris,queen=TRUE)
Wqueen <- spdep::nb2listw(queen,style="W")
Wqueen2 <- adjustSpatialWeights(dataset,queen,style="C")

geocmeans documentation built on June 17, 2022, 1:05 a.m.