moran: moran

View source: R/moran.R

moranR Documentation

moran

Description

moran

Usage

moran(x, coords, scaled = FALSE, alternative = "two.sided")

Arguments

x

numeric vector of responses

coords

Matrix of coordinates corresponding to values in X, can also be data frame that the distance matrix is generated from

scaled

Boolean, whether to use scaled (standardized) values

alternative

Character string containing the name of residual variable

Value

A list including the observed and expected statistic, standard error, and p-value

Examples


set.seed(2021)
d <- data.frame(
  X = runif(1000), Y = runif(1000),
  year = sample(1:10, size = 1000, replace = TRUE)
)
d$density <- rnorm(0.01 * d$X - 0.001 * d$X * d$X + d$Y * 0.02 - 0.005 * d$Y * d$Y, 0, 0.1)
moran_stat <- moran(d$density, coords = d[, c("X", "Y")])


ericward-noaa/vista documentation built on June 24, 2022, 12:19 a.m.