Learn R Programming

spdep (version 0.1-10)

spweights.constants: Provides constants for spatial weights matrices

Description

The function calculates the constants needed for tests of spatial autocorrelation for general weights matrices represented as listw objects

Usage

spweights.constants(listw, zero.policy=FALSE)
Szero(listw)

Arguments

listw
a listw object from for example nb2listw
zero.policy
if TRUE ignore zones without neighbours, if FALSE fail when encountered

Value

  • nnumber of zones
  • n1n - 1
  • n2n - 2
  • n3n - 3
  • nnn * n
  • S0global sum of weights
  • S1S1 sum of weights
  • S2S2 sum of weights

References

Haining, R. 1990 Spatial data analysis in the social and environmental sciences, Cambridge University Press, p. 233; Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 19, 21.

See Also

nb2listw

Examples

Run this code
data(oldcol)
B <- spweights.constants(nb2listw(COL.nb, style="B"))
W <- spweights.constants(nb2listw(COL.nb, style="W"))
C <- spweights.constants(nb2listw(COL.nb, style="C"))
S <- spweights.constants(nb2listw(COL.nb, style="S"))
print(data.frame(rbind(unlist(B), unlist(W), unlist(C), unlist(S)),
  row.names=c("B", "W", "C", "S")))

Run the code above in your browser using DataLab