Skip to contents

First rung of the diagnostic ladder: if OLS residuals show significant Moran's I, an SDM (or SEM/SAR) is warranted over OLS.

Usage

mrm_morans_i(residuals, W)

Arguments

residuals

Numeric vector of length N (e.g. OLS residuals).

W

Numeric matrix of shape (N, N) – the spatial weight matrix. Need not be row-standardised but must be aligned with residuals.

Value

A named list with classes morie_mrm_result, morie_rich_result, list. Carries morans_i (the scalar statistic) plus interpretation

  • warnings.

Details

Statistic:

$$I = \frac{n}{\sum_{ij} w_{ij}} \cdot \frac{e^\top W e}{e^\top e}, \quad e = r - \bar r.$$

\(I \in `[-1, 1]`\). Positive -> clustering, negative -> dispersion, ~0 -> spatial randomness.

Examples

set.seed(4)
N <- 20
W <- matrix(runif(N * N), N, N); diag(W) <- 0; W <- W / rowSums(W)
resid <- rnorm(N)
mrm_morans_i(resid, W)$morans_i
#> [1] -0.0867284