Skip to contents

morie_morans_i is the statistic I = (n/S0) * (z' W z) / (z'z) with z = x - mean(x). morie_morans_i_test mirrors spdep::moran.test: under the null E[I] = -1/(n-1) and the variance takes the randomisation form (conditioning on the observed values, treating only their arrangement as random) or the normality form.

Usage

morie_morans_i(x, W)

morie_morans_i_test(x, W, randomisation = TRUE, alternative = "greater")

Arguments

x

numeric vector of observations

W

numeric spatial weights matrix

randomisation

Argument randomisation; see Usage.

alternative

Argument alternative; see Usage.

Value

morie_morans_i a number; morie_morans_i_test a list with estimate, expectation, variance, statistic and p_value

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_morans_i(V, V)
#> [1] -0.7777778 -0.5555556 -0.3333333 -0.1111111  0.1111111  0.3333333  0.5555556
#> [8]  0.7777778