% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/moransI.R
\name{moransI}
\alias{moransI}
\title{Calculate the Moran's I test statistic for spatial autocorrelation}
\usage{
moransI(x, W)
}
\arguments{
\item{x}{A vector of outcomes}

\item{W}{The matrix of weights, with dimensions equal to the lenght of x}
}
\value{
A vector of length 2: the Moran's I statistic and its variance
}
\description{
The Moran's I test statistic and its variance are calculated
}
\details{
The implementation is inspired on the one from ape::Moran.I, but more
 bare-bones for a weight matrix with certain properties as prepared by buildMoransIWeightMat,
 making it faster and using less memory.
 @note Calculations are only correct for weight matrices as prepared by
 buildMoransIWeightMat!
}
