# moran.I.multi: Moran's I for symmetric and asymmetric weighting matrix In AEM: Tools to construct Asymmetric eigenvector maps (AEM) spatial variables

## Description

Calculate Moran's I for spatial variables out of the eigenfunction-based spatial filtering framework. The function also tests each Moran's I with a permutation or parametric test. The calculation of Moran's I and the test of significance are carried out by the function.

## Usage

 ```1 2``` ```moran.I.uni(x, mat.W, scaled = FALSE,normalize=FALSE, na.rm = FALSE, test.type="permutation",nperm=999,alternative = "greater") moran.I.multi(eigenvector.mat,link,weight,scaled=FALSE,normalize=FALSE,na.rm = FALSE,test.type="permutation",nperm=999,plot.res=TRUE) ```

## Arguments

 `x` A numeric vector. `mat.W` A matrix of weights. `eigenvector.mat` Matrix. A set of orthogonal spatial variables, created by the function `aem`. `link` A 2-column matrix describing the link edges. It has 2 columns (from, to) and as many rows as there are edges. The object names in the From-To list are the order numbers of the objects, not their names if the names differ from the order numbers. `weight` A vector providing weights associated to the edges. If no weights are given, the function consider all edges to have the same weights. `scaled` Logical (`TRUE`, `FALSE`) determining if the index should be scaled to allow comparisons between indices (default to `FALSE`). `normalize` Logical (`TRUE`, `FALSE`) determining if the matrix of weights should be row-normalized to 1 (default to `FALSE`). `na.rm` Logical (`TRUE`, `FALSE`) determining whether missing values should be removed (default to `FALSE`). `alternative` A character string specifying the alternative hypothesis that is tested against the null hypothesis of no spatial autocorrelation; must be of one "two.sided", "less", or "greater", or any unambiguous abbrevation of these. `test.type` A character string specifying the type of test to be carried out. Either "permutation", or "parametric", or any unambiguous abbrevation of these. Default is "permutation" `nperm` Numeric. a number specifying the number of permutation to be carried out. This argument is inactive when performing a parametric test. `plot.res` Logical (`TRUE`, `FALSE`) determining if the expected and observed values and the results of the test of significance of Moran's I, for each AEM eigenfunction, should be plotted (default to `TRUE`).

## Details

`moran.I.uni` is a modification of `Moran.I` (the code was heavily borrowed from library ape). In `Moran.I` the normalization is carried out by default, whereas in `moran.I.uni` the choice is given to the user.

Other type of orthogonal spatial variables (MEM, PCNM) created through the Moran's eigenvector maps framework (result of `scores.listw` or `pcnm`) can also be tested with those functions.

Function `moran.I.basic` is simple function to compute Moran's I. It is used by both `moran.I.uni` and `moran.I.multi`.

## Value

 ` observed ` The computed Moran's I ` expected ` Numeric. The expected Moran's I under the null hypothesis. ` sd ` Numeric. The standard deviation of the Moran's I under the null hypothesis. This value is calculated only during parametric tests. `p.value` The P-value of the null hypothesis's test against the alternative hypothesis specified in ` alternative ` ` res.mat ` A 2-column matrix. The first column gives the observed Moran's I value, the second column gives the associated p-value.

## Author(s)

F. Guillaume Blanchet

`Moran.I`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```### Construct AEM eigenfunctions nb<-cell2nb(5,5,"queen") xy <- cbind(1:25,expand.grid(1:5,1:5)) bin.mat <- build.binary(nb,xy) aem1 <- aem(build.binary=bin.mat) ### Calculate and test Moran's I for each AEM eigenfunction moran.I.multi(aem1\$vectors, bin.mat[[2]]) #--------------------------- ### Example using spacemakeR ### This section is temporarily in comments because spacemakeR fails to compile on R-forge. #--------------------------- #require(spacemakeR) ### Construct Moran's eigenvector maps #nb<-cell2nb(5,5,"queen") #sc.queen<-scores.listw(nb2listw(nb,style="B")) ### Calculate and test Moran's I for each MEM eigenfunction #moran.I.multi(sc.queen\$vector,listw2sn(nb2listw(nb))[,1:2]) ```