1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
% Copyright 2002-8 by Roger S. Bivand
\name{globalG.test}
\alias{globalG.test}
\title{Global G test for spatial autocorrelation}
\description{
The global G statistic for spatial autocorrelation, complementing the local Gi LISA measures: \code{\link{localG}}.
}
\usage{
globalG.test(x, listw, zero.policy=NULL, alternative="greater",
spChk=NULL, adjust.n=TRUE, B1correct=TRUE, adjust.x=TRUE, Arc_all_x=FALSE)
}
\arguments{
\item{x}{a numeric vector the same length as the neighbours list in listw}
\item{listw}{a \code{listw} object created for example by \code{nb2listw}; if a sequence of distance bands is to be used, it is recommended that the weights style be binary (one of \code{c("B", "C", "U")}).}
\item{zero.policy}{default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA}
\item{alternative}{a character string specifying the alternative hypothesis, must be one of "greater" (default), "less" or "two.sided".}
\item{spChk}{should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use \code{get.spChkOption()}}
\item{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}
\item{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)}
\item{adjust.x}{default TRUE, if TRUE, x values of observations with no neighbours are omitted in the denominator of G}
\item{Arc_all_x}{default FALSE, if Arc_all_x=TRUE and adjust.x=TRUE, use the full x vector in part of the denominator term for G}
}
\value{
A list with class \code{htest} containing the following components:
\item{statistic}{the value of the standard deviate of Moran's I.}
\item{p.value}{the p-value of the test.}
\item{estimate}{the value of the observed statistic, its expectation and variance.}
\item{alternative}{a character string describing the alternative hypothesis.}
\item{data.name}{a character string giving the name(s) of the data.}
}
\references{Getis. A, Ord, J. K. 1992 The analysis of spatial association by
use of distance statistics, \emph{Geographical Analysis}, 24, p. 195; see
also Getis. A, Ord, J. K. 1993 Erratum, \emph{Geographical Analysis}, 25,
p. 276; Bivand RS, Wong DWS 2018 Comparing implementations of global and local indicators of spatial association. TEST, 27(3), 716--748 \url{https://doi.org/10.1007/s11749-018-0599-x}}
\author{Hisaji ONO \email{hi-ono@mn.xdsl.ne.jp} and Roger Bivand
\email{Roger.Bivand@nhh.no}}
\seealso{\code{\link{localG}}}
\examples{
nc.sids <- st_read(system.file("shapes/sids.shp", package="spData")[1], quiet=TRUE)
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))))
}
\keyword{spatial}
|