gearymoran {ade4}R Documentation

Moran's I and Geary'c randomization tests for spatial and phylogenetic autocorrelation

Description

This function performs Moran's I test using phylogenetic and spatial link matrix (binary or general). It uses neighbouring weights so Moran's I and Geary's c randomization tests are equivalent.

Usage

gearymoran(bilis, X, nrepet = 999, alter=c("greater", "less", "two-sided"))

Arguments

bilis : a n by n link matrix where n is the row number of X
X : a data frame with continuous variables
nrepet : number of random vectors for the randomization test
alter a character string specifying the alternative hypothesis, must be one of "greater" (default), "less" or "two-sided"

Details

bilis is a squared symmetric matrix which terms are all positive or null.

bilis is firstly transformed in frequency matrix A by dividing it by the total sum of data matrix :

a_ij = bilis_ij / (sum_i sum_j bilis_ij)

The neighbouring weights is defined by the matrix D = diag(d_1,d_2, \ldots) where d_i = sum_j bilis_ij. For each vector x of the data frame X, the test is based on the Moran statistic t(x)Ax where x is D-centred.

Value

Returns an object of class krandtest (randomization tests).

Author(s)

S├ębastien Ollier ollier@biomserv.univ-lyon1.fr
Daniel Chessel

References

Cliff, A. D. and Ord, J. K. (1973) Spatial autocorrelation, Pion, London.

Thioulouse, J., Chessel, D. and Champely, S. (1995) Multivariate analysis of spatial patterns: a unified approach to local and global structures. Environmental and Ecological Statistics, 2, 1–14.

See Also

moran.test and geary.test for classical versions of Moran's test and Geary's one

Examples

# a spatial example
data(mafragh)
tab0 <- (as.data.frame(scalewt(mafragh$mil)))
bilis0 <- neig2mat(mafragh$neig)
gm0 <- gearymoran(bilis0, tab0, 999)
gm0
plot(gm0, nclass = 20)

## Not run: 
# a phylogenetic example
data(mjrochet)
mjr.phy <- newick2phylog(mjrochet$tre)
mjr.tab <- log(mjrochet$tab)
gearymoran(mjr.phy$Amat, mjr.tab)
gearymoran(mjr.phy$Wmat, mjr.tab)
par(mfrow = c(1,2))
table.value(mjr.phy$Wmat, csi = 0.25, clabel.r = 0)
table.value(mjr.phy$Amat, csi = 0.35, clabel.r = 0)
par(mfrow = c(1,1))

## End(Not run)

Worked out examples


> library(ade4)
> ### Name: gearymoran
> ### Title: Moran's I and Geary'c randomization tests for spatial and
> ###   phylogenetic autocorrelation
> ### Aliases: gearymoran
> ### Keywords: spatial ts
> 
> ### ** Examples
> 
> # a spatial example
> data(mafragh)
> tab0 <- (as.data.frame(scalewt(mafragh$mil)))
> bilis0 <- neig2mat(mafragh$neig)
> gm0 <- gearymoran(bilis0, tab0, 999)
> gm0
class: krandtest 
Monte-Carlo tests
Call: as.krandtest(sim = matrix(res$result, ncol = nvar, byr = TRUE), 
    obs = res$obs, alter = alter, names = test.names)

Test number:   11 
Permutation number:   999 
         Test        Obs   Std.Obs   Alter Pvalue
1      Argile 0.42436873  6.976964 greater  0.001
2       Limon 0.33796853  5.668809 greater  0.001
3       Sable 0.09947991  1.783623 greater  0.049
4         K2O 0.27277951  4.864125 greater  0.001
5        Mg++ 0.18577104  3.296018 greater  0.003
6    Na+/100g 0.26673592  4.695521 greater  0.001
7          K+ 0.66106701 10.863168 greater  0.001
8      Conduc 0.29969555  5.156084 greater  0.002
9  Capa_Reten 0.20099816  3.489107 greater  0.003
10      Na+/l 0.24300034  4.216940 greater  0.001
11   Altitude 0.59526831  9.661508 greater  0.001

other elements: NULL
> plot(gm0, nclass = 20)
> 
>  
> # a phylogenetic example
> data(mjrochet)
> mjr.phy <- newick2phylog(mjrochet$tre)
> mjr.tab <- log(mjrochet$tab)
> gearymoran(mjr.phy$Amat, mjr.tab)
class: krandtest 
Monte-Carlo tests
Call: as.krandtest(sim = matrix(res$result, ncol = nvar, byr = TRUE), 
    obs = res$obs, alter = alter, names = test.names)

Test number:   7 
Permutation number:   999 
  Test       Obs  Std.Obs   Alter Pvalue
1   tm 0.2980015 3.309424 greater  0.003
2   lm 0.3228880 3.667656 greater  0.002
3  l05 0.3405016 3.780642 greater  0.001
4  t05 0.1979037 2.209685 greater  0.021
5   fb 0.2513168 2.820114 greater  0.005
6   fm 0.2675743 3.108877 greater  0.006
7  egg 0.4856311 5.089969 greater  0.001

other elements: NULL
> gearymoran(mjr.phy$Wmat, mjr.tab)
class: krandtest 
Monte-Carlo tests
Call: as.krandtest(sim = matrix(res$result, ncol = nvar, byr = TRUE), 
    obs = res$obs, alter = alter, names = test.names)

Test number:   7 
Permutation number:   999 
  Test        Obs   Std.Obs   Alter Pvalue
1   tm 0.04829667 2.1718577 greater  0.037
2   lm 0.05361623 2.3964992 greater  0.028
3  l05 0.04979818 2.1379317 greater  0.037
4  t05 0.03271208 0.5059124 greater  0.238
5   fb 0.03931859 1.1240359 greater  0.123
6   fm 0.03029947 0.2228492 greater  0.295
7  egg 0.09647961 6.8180077 greater  0.001

other elements: NULL
> par(mfrow = c(1,2))
> table.value(mjr.phy$Wmat, csi = 0.25, clabel.r = 0)
> table.value(mjr.phy$Amat, csi = 0.35, clabel.r = 0)
> par(mfrow = c(1,1))
> 
> 
> 
> 

[Package ade4 Index]