Description Usage Arguments Value Author(s) References See Also Examples
The global G statistic for spatial autocorrelation, complementing the local Gi LISA measures: localG
.
1 2 |
x |
a numeric vector the same length as the neighbours list in listw |
listw |
a |
zero.policy |
default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA |
alternative |
a character string specifying the alternative hypothesis, must be one of "greater" (default), "less" or "two.sided". |
spChk |
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use |
adjust.n |
default TRUE, if FALSE the number of observations is not adjusted for no-neighbour observations, if TRUE, the number of observations is adjusted |
B1correct |
default TRUE, if TRUE, the erratum referenced below: "On page 195, the coefficient of W2 in B1, (just below center of the page) should be 6, not 3." is applied; if FALSE, 3 is used (as in CrimeStat IV) |
A list with class htest
containing the following components:
statistic |
the value of the standard deviate of Moran's I. |
p.value |
the p-value of the test. |
estimate |
the value of the observed statistic, its expectation and variance. |
alternative |
a character string describing the alternative hypothesis. |
data.name |
a character string giving the name(s) of the data. |
Hisaji ONO hi-ono@mn.xdsl.ne.jp and Roger Bivand Roger.Bivand@nhh.no
Getis. A, Ord, J. K. 1992 The analysis of spatial association by use of distance statistics, Geographical Analysis, 24, p. 195; see also Getis. A, Ord, J. K. 1993 Erratum, Geographical Analysis, 25, p. 276.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | example(nc.sids)
sidsrate79 <- (1000*nc.sids$SID79)/nc.sids$BIR79
dists <- c(10, 20, 30, 33, 40, 50, 60, 70, 80, 90, 100)
ndists <- length(dists)
ZG <- vector(mode="list", length=ndists)
names(ZG) <- as.character(dists)
milesxy <- cbind(nc.sids$east, nc.sids$north)
for (i in 1:ndists) {
thisnb <- dnearneigh(milesxy, 0, dists[i])
thislw <- nb2listw(thisnb, style="B", zero.policy=TRUE)
ZG[[i]] <- globalG.test(sidsrate79, thislw, zero.policy=TRUE)
}
t(sapply(ZG, function(x) c(x$estimate[1], x$statistic, p.value=unname(x$p.value))))
for (i in 1:ndists) {
thisnb <- dnearneigh(milesxy, 0, dists[i])
thislw <- nb2listw(thisnb, style="B", zero.policy=TRUE)
ZG[[i]] <- globalG.test(sidsrate79, thislw, zero.policy=TRUE, alternative="two.sided")
}
t(sapply(ZG, function(x) c(x$estimate[1], x$statistic, p.value=unname(x$p.value))))
|
Loading required package: sp
Loading required package: Matrix
nc.sds> require(maptools)
Loading required package: maptools
Checking rgeos availability: TRUE
nc.sds> nc.sids <- readShapePoly(system.file("etc/shapes/sids.shp", package="spdep")[1],
nc.sds+ ID="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
nc.sds> rn <- sapply(slot(nc.sids, "polygons"), function(x) slot(x, "ID"))
nc.sds> ncCC89_nb <- read.gal(system.file("etc/weights/ncCC89.gal", package="spdep")[1],
nc.sds+ region.id=rn)
nc.sds> ncCR85_nb <- read.gal(system.file("etc/weights/ncCR85.gal", package="spdep")[1],
nc.sds+ region.id=rn)
nc.sds> ## Not run:
nc.sds> ##D plot(nc.sids, border="grey")
nc.sds> ##D plot(ncCR85_nb, coordinates(nc.sids), add=TRUE, col="blue")
nc.sds> ##D plot(nc.sids, border="grey")
nc.sds> ##D plot(ncCC89_nb, coordinates(nc.sids), add=TRUE, col="blue")
nc.sds> ## End(Not run)
nc.sds>
nc.sds>
nc.sds>
Warning message:
use rgdal::readOGR or sf::st_read
Global G statistic standard deviate p.value
10 0.000612124 0.81651489 0.2071029
20 0.014698945 0.27046614 0.3934008
30 0.039947466 -0.11849772 0.5471634
33 0.053122713 0.40157023 0.3440002
40 0.074002794 -0.04345713 0.5173314
50 0.114717434 0.58686472 0.2786473
60 0.154575526 -0.35823892 0.6399177
70 0.198390232 -0.27864299 0.6097406
80 0.246069725 -0.18791364 0.5745278
90 0.300734634 0.11457610 0.4543906
100 0.348799963 0.31591356 0.3760341
Global G statistic standard deviate p.value
10 0.000612124 0.81651489 0.4142057
20 0.014698945 0.27046614 0.7868017
30 0.039947466 -0.11849772 0.9056733
33 0.053122713 0.40157023 0.6880003
40 0.074002794 -0.04345713 0.9653371
50 0.114717434 0.58686472 0.5572946
60 0.154575526 -0.35823892 0.7201645
70 0.198390232 -0.27864299 0.7805188
80 0.246069725 -0.18791364 0.8509443
90 0.300734634 0.11457610 0.9087811
100 0.348799963 0.31591356 0.7520681
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.