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 ape::Moran.I
.
1 
x 
Numeric vector of size n. 
w 
Numeric matrix of size n * n. Weights. It can be
either a object of class 
normalize.w 
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
Other statistics: classify_adopters
,
cumulative_adopt_count
, dgr
,
ego_variance
, exposure
,
hazard_rate
, infection
,
struct_equiv
, threshold
,
vertex_covariate_dist
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)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.