Description Usage Arguments Value Author(s) References See Also Examples
This simple function computes Moran's index of autocorrelation given a variable and a matrix of proximities among observations.
1  | 
x | 
 a numeric vector whose autocorrelation is computed.  | 
prox | 
 a matrix of proximities between observations, as computed
by the   | 
addInfo | 
 a logical indicating whether supplementary info (null value, minimum and maximum values) should be returned (TRUE) or not (FALSE, default); if computed, these quantities are returned as attributes.  | 
The numeric value of Moran's index.
Thibaut Jombart tjombart@imperial.ac.uk
Moran, P.A.P. (1948) The interpretation of statistical maps. Journal of the Royal Statistical Society, B 10, 243–251.
Moran, P.A.P. (1950) Notes on continuous stochastic phenomena. Biometrika, 37, 17–23.
de Jong, P. and Sprenger, C. and van Veen, F. (1984) On extreme values of Moran's I and Geary's c. Geographical Analysis, 16, 17–24.
proxTips which computes phylogenetic proximities
between tips of a phylogeny.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | ## Not run: 
## use maples dataset
data(maples)
tre <- read.tree(text=maples$tre)
dom <- maples$tab$Dom
bif <- maples$tab$Bif
## get a proximity matrix between tips 
W <- proxTips(tre, met="Abouheif")
## compute Moran's I for two traits (dom and bif)
moran.idx(dom, W)
moran.idx(bif, W)
moran.idx(rnorm(nTips(tre)), W)
## build a simple permutation test for 'bif'
sim <- replicate(499, moran.idx(sample(bif), W)) # permutations
sim <- c(moran.idx(bif, W), sim)
pval <- mean(sim>=sim[1]) # right-tail p-value
pval
hist(sim, col="grey", main="Moran's I Monte Carlo test for 'bif'") # plot
mtext("Histogram of permutations and observation (in red)")
abline(v=sim[1], col="red", lwd=3)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.