1\name{sp.mantel.mc}
2\alias{sp.mantel.mc}
3\alias{plot.mc.sim}
4
5\title{Mantel-Hubert spatial general cross product statistic}
6\description{
7  A permutation test for the spatial general cross product statistic with
8Moran (\eqn{C_{ij} = z_i z_j}{C(i,j) = z(i)*z(j)}), Geary
9(\eqn{C_{ij} = (z_i - z_j)^2}{C(i,j) = (z(i) - z(j))^2}), and Sokal
10(\eqn{C_{ij} = |z_i - z_j|}{C(i,j) = |z(i) - z(j)|}) criteria, for
11\eqn{z_i = (x_i - \bar{x}) / \sigma_{x}}{z(i) = (x(i) - mean(x))/sd(x)}.
12\code{plot.mc.sim} is a helper function to plot the outcomes of the
13permutation test.
14}
15\usage{
16sp.mantel.mc(var, listw, nsim, type = "moran", zero.policy = NULL,
17 alternative = "greater", spChk=NULL, return_boot=FALSE)
18\method{plot}{mc.sim}(x, xlim, xlab, main, sub, ..., ptype="density")
19}
20%- maybe also `usage' for other objects documented here.
21\arguments{
22  \item{var}{a numeric vector the same length as the neighbours list in listw}
23  \item{listw}{a \code{listw} object created for example by \code{nb2listw}}
24  \item{nsim}{number of permutations}
25  \item{type}{"moran", "geary" or "sokal" criteria for similarity}
26  \item{zero.policy}{default NULL, use global option value; if TRUE assign zero to the lagged value of zones without
27  neighbours, if FALSE assign NA}
28  \item{alternative}{a character string specifying the alternative hypothesis,
29  must be one of "greater" (default), or "less".}
30  \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()}}
31  \item{return_boot}{return an object of class \code{boot} from the equivalent permutation bootstrap rather than an object of class \code{htest}}
32  \item{x}{the object to be plotted}
33  \item{xlim}{the range of the x axis}
34  \item{xlab}{a title for the x axis}
35  \item{main}{an overall title for the plot}
36  \item{sub}{a sub title for the plot}
37  \item{ptype}{either "density" or "hist"}
38  \item{...}{further arguments passed through}
39}
40
41\value{
42A list with class \code{htest} and \code{mc.sim} containing the following components:
43  \item{statistic}{the value of the observed Geary's C.}
44  \item{parameter}{the rank of the observed Geary's C.}
45  \item{alternative}{a character string describing the alternative hypothesis.}
46  \item{method}{a character string giving the method used.}
47  \item{data.name}{a character string giving the name(s) of the data, and the
48  number of simulations.}
49  \item{p.value}{the pseudo p-value of the test.}
50  \item{res}{nsim simulated values of statistic, final value is observed
51  statistic}
52  \item{estimate}{the mean and variance of the simulated distribution.}
53}
54\references{Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 22-24,
55Haining, R. 1990 \emph{Spatial data analysis in the social
56and environmental sciences}, Cambridge: Cambridge University Press, p. 230--1.
57The function has been checked against general matrix code posted to the
58r-help list by Ben Bolker on 1 May 2001; another \code{mantel()} function
59is in the vegan package.}
60\author{Roger Bivand \email{Roger.Bivand@nhh.no}}
61
62\seealso{\code{\link{moran.mc}}, \code{\link{joincount.mc}},
63\code{\link{geary.mc}}}
64
65\examples{
66data(oldcol)
67sim1 <- sp.mantel.mc(COL.OLD$CRIME, nb2listw(COL.nb),
68 nsim=99, type="geary", alternative="less")
69sim1
70plot(sim1)
71sp.mantel.mc(COL.OLD$CRIME, nb2listw(COL.nb), nsim=99,
72 type="sokal", alternative="less")
73sp.mantel.mc(COL.OLD$CRIME, nb2listw(COL.nb), nsim=99,
74 type="moran")
75}
76\keyword{spatial}
77