moranbi.mc {bispdep} | R Documentation |
Permutation test for bivariate Moran's Ixy statistic
Description
A permutation test for bivariate Moran's Ixy statistic calculated by using nsim random permutations of x
and y
for the given spatial weighting scheme, to establish the rank of the observed statistic in relation to the nsim simulated values.
Usage
moranbi.mc(varX, varY, listw, nsim, zero.policy=NULL, alternative="greater",
na.action=na.fail, spChk=NULL, return_boot=FALSE, adjust.n=TRUE, parallel="no",
ncpus = getOption("boot.ncpus", 1L), cl = NULL)
Arguments
varX |
a numeric vector of the variable |
varY |
a numeric vector of the variable |
listw |
a |
nsim |
number of permutations |
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), "two.sided", or "less". |
na.action |
a function (default |
spChk |
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use |
return_boot |
return an object of class |
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 |
parallel |
The type of parallel operation to be used (if any). If missing, the default is "no". for more details see |
ncpus |
integer: number of processes to be used in parallel operation: number of available CPUs. By default it is set to 1 with getOption("boot.ncpus", 1L) |
cl |
An optional parallel or snow cluster for use if |
Value
A list with class htest
and mc.sim
containing the following components:
statistic |
the value of the observed bivariate Moran's I. |
parameter |
the rank of the observed bivariate Moran's I. |
p.value |
the pseudo p-value of the test. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string giving the method used. |
data.name |
a character string giving the name(s) of the data, and the number of simulations. |
res |
nsim simulated values of statistic, final value is observed statistic |
References
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 63-5.
See Also
Examples
library(spdep)
data(oldcol)
colw <- nb2listw(COL.nb, style="W")
nsim <- 999
set.seed(123)
sim1 <- moranbi.mc(COL.OLD$CRIME, COL.OLD$INC, listw=colw, nsim=nsim, zero.policy=TRUE)
sim1
mean(sim1$res[1:nsim])
var(sim1$res[1:nsim])
summary(sim1$res[1:nsim])
colold.lags <- nblag(COL.nb, 3)
set.seed(1234)
sim2 <- moranbi.mc(COL.OLD$CRIME, COL.OLD$INC, nb2listw(colold.lags[[2]],style="W"),
nsim=nsim, zero.policy=TRUE)
summary(sim2$res[1:nsim])
sim3 <- moranbi.mc(COL.OLD$CRIME, COL.OLD$INC, nb2listw(colold.lags[[3]],style="W"),
nsim=nsim, zero.policy=TRUE)
summary(sim3$res[1:nsim])
sim4 <- moranbi.mc(COL.OLD$CRIME, COL.OLD$INC, colw, nsim=nsim, zero.policy=TRUE,
return_boot=TRUE,parallel="multicore")
sim4