Natively built for computing Moran's I on
dgCMatrix objects, this
routine allows computing the I on large sparse matrices (graphs), feature that
is not supported on
Numeric vector of size n.
Numeric matrix of size n * n. Weights. It can be
either a object of class
Logical scalar. When TRUE normalizes rowsums to one (or zero).
Numeric scalar with Moran's I.
George G. Vega Yon
Moran's I. (2015, September 3). In Wikipedia, The Free Encyclopedia. Retrieved 06:23, December 22, 2015, from https://en.wikipedia.org/w/index.php?title=Moran%27s_I&oldid=679297766
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Not run: # Generating a small random graph set.seed(123) graph <- rgraph_ba(t = 4) w <- igraph::distances(igraph::graph_from_adjacency_matrix(graph)) x <- rnorm(5) # Computing Moran's I moran(x, w) # Comparing with the ape's package version moran(x, w/rowSums(as.array(w))) ape::Moran.I(x, w) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.