# Computes Moran's I correlation index

### Description

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`

.

### Usage

1 | ```
moran(x, w, normalize.w = TRUE)
``` |

### Arguments

`x` |
Numeric vector of size |

`w` |
Numeric matrix of size |

`normalize.w` |
Logical scalar. When TRUE normalizes rowsums to one (or zero). |

### Value

Numeric scalar with Moran's I.

### Author(s)

George G. Vega Yon

### References

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

### See Also

Other statistics: `classify_adopters`

,
`cumulative_adopt_count`

, `dgr`

,
`ego_variance`

, `exposure`

,
`hazard_rate`

, `infection`

,
`struct_equiv`

, `threshold`

,
`vertex_covariate_dist`

### Examples

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)
``` |