multispati {ade4}R Documentation

Multivariate spatial analysis

Description

This function ensures a multivariate extension of the univariate method of spatial autocorrelation analysis. By accounting for the spatial dependence of data observations and their multivariate covariance simultaneously, complex interactions among many variables are analysed. Using a methodological scheme borrowed from duality diagram analysis, a strategy for the exploratory analysis of spatial pattern in the multivariate is developped.

Usage

multispati(dudi, listw, scannf = TRUE, nfposi = 2, nfnega = 0)
## S3 method for class 'multispati':
plot(x, xax = 1, yax = 2, ...) 
## S3 method for class 'multispati':
summary(object, ...) 
## S3 method for class 'multispati':
print(x, ...)

Arguments

dudi an object of class dudi for the duality diagram analysis
listw an object of class listw for the spatial dependence of data observations
scannf a logical value indicating whether the eigenvalues bar plot should be displayed
nfposi an integer indicating the number of kept positive axes
nfnega an integer indicating the number of kept negative axes
x, object an object of class multispati
xax, yax the numbers of the x-axis and the y-axis
... further arguments passed to or from other methods

Details

This analysis generalizes the Wartenberg's multivariate spatial correlation analysis to various duality diagrams created by the functions (dudi.pca, dudi.coa, dudi.acm, dudi.mix...) If dudi is a duality diagram created by the function dudi.pca and listw gives spatial weights created by a row normalized coding scheme, the analysis is equivalent to Wartenberg's analysis.

We note X the data frame with the variables, Q the column weights matrix and D the row weights matrix associated to the duality diagram dudi. We note L the neighbouring weights matrix associated to listw. Then, the 'multispati' analysis gives principal axes v that maximize the product of spatial autocorrelation and inertia of row scores :

I(XQv)*\|\|XQv\|\|^2 = t(v)t(Q)t(X)DLXQv

Value

Returns an object of class multispati, which contains the following elements :
eig a numeric vector containing the eigenvalues
nfposi integer, number of kept axes associated to positive eigenvalues
nfnega integer, number of kept axes associated to negative eigenvalues
c1 principle axes (v), data frame with p rows and (nfposi + nfnega) columns
li principal components (XQv), data frame with n rows and (nfposi + nfnega) columns
ls lag vector onto the principal axes (LXQv), data frame with n rows and (nfposi + nfnega) columns
as principal axes of the dudi analysis (u) onto principal axes of multispati (t(u)Qv), data frame with dudi\$nf rows and (nfposi + nfnega) columns

Author(s)

Daniel Chessel
Sebastien Ollier ollier@biomserv.univ-lyon1.fr
Thibaut Jombart jombart@biomserv.univ-lyon1.fr

References

Dray, S., Said, S. and Debias, F. (2008) Spatial ordination of vegetation data using a generalization of Wartenberg's multivariate spatial correlation. Journal of vegetation science, 19, 45–56.

Grunsky, E. C. and Agterberg, F. P. (1988) Spatial and multivariate analysis of geochemical data from metavolcanic rocks in the Ben Nevis area, Ontario. Mathematical Geology, 20, 825–861.

Switzer, P. and Green, A.A. (1984) Min/max autocorrelation factors for multivariate spatial imagery. Tech. rep. 6, Stanford University.

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.

Wartenberg, D. E. (1985) Multivariate spatial correlation: a method for exploratory geographical analysis. Geographical Analysis, 17, 263–283.

Jombart, T., Devillard, S., Dufour, A.-B. and Pontier, D. A spatially explicit multivariate method to disentangle global and local patterns of genetic variability. Submitted to Genetics.

See Also

dudi,mat2listw

Examples

## Not run: 
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    data(mafragh)
    maf.xy <- mafragh$xy
    maf.flo <- mafragh$flo
    maf.listw <- nb2listw(neig2nb(mafragh$neig))
    s.label(maf.xy, neig = mafragh$neig, clab = 0.75)
    maf.coa <- dudi.coa(maf.flo,scannf = FALSE)
    maf.coa.ms <- multispati(maf.coa, maf.listw, scannf = FALSE, nfposi = 2, 
        nfnega = 2)
    maf.coa.ms
    
    ### detail eigenvalues components
    fgraph <- function(obj){
      # use multispati summary
      sum.obj <- summary(obj)
      # compute Imin and Imax
      L <- listw2mat(eval(as.list(obj$call)$listw))
      Imin <- min(eigen(0.5*(L+t(L)))$values)
      Imax <- max(eigen(0.5*(L+t(L)))$values)
      I0 <- -1/(nrow(obj$li)-1)
      # create labels
      labels <- lapply(1:length(obj$eig),function(i) bquote(lambda[.(i)]))
      # draw the plot
      xmax <- eval(as.list(obj$call)$dudi)$eig[1]*1.1
      par(las=1)
      var <- sum.obj[,2]
      moran <- sum.obj[,3]
      plot(x=var,y=moran,type='n',xlab='Inertia',ylab="Spatial autocorrelation (I)",
           xlim=c(0,xmax),ylim=c(Imin*1.1,Imax*1.1),yaxt='n')
      text(x=var,y=moran,do.call(expression,labels))
      ytick <- c(I0,round(seq(Imin,Imax,le=5),1))
      ytlab <- as.character(round(seq(Imin,Imax,le=5),1))
      ytlab <- c(as.character(round(I0,1)),as.character(round(Imin,1)),
           ytlab[2:4],as.character(round(Imax,1)))
      axis(side=2,at=ytick,labels=ytlab)
      rect(0,Imin,xmax,Imax,lty=2)
      segments(0,I0,xmax,I0,lty=2)
      abline(v=0)
      title("Spatial and inertia components of the eigenvalues")
    }
    fgraph(maf.coa.ms)
    ## end eigenvalues details


    par(mfrow = c(1,3))
    barplot(maf.coa$eig)
    barplot(maf.coa.ms$eig) 
    s.corcircle(maf.coa.ms$as)
 
    par(mfrow = c(2,2))
    s.value(maf.xy, -maf.coa$li[,1])
    s.value(maf.xy, -maf.coa$li[,2])
    s.value(maf.xy, maf.coa.ms$li[,1])
    s.value(maf.xy, maf.coa.ms$li[,2])
    par(mfrow = c(1,1))

    par(mfrow = c(1,2))
    w1 <- -maf.coa$li[,1:2]
    w1m <- apply(w1, 2, lag.listw, x = maf.listw)
    s.match(w1, w1m, clab = 0.75)
    w1.ms <- maf.coa.ms$li[,1:2]
    w1.msm <- apply(w1.ms, 2, lag.listw, x = maf.listw)
    s.match(w1.ms, w1.msm, clab = 0.75)
    par(mfrow = c(1,1))

    maf.pca <- dudi.pca(mafragh$mil, scannf = FALSE)
    multispati.randtest(maf.pca, maf.listw)
    maf.pca.ms <- multispati(maf.pca, maf.listw, scannf=FALSE)
    plot(maf.pca.ms)
}

## End(Not run)

Worked out examples


> library(ade4)
> ### Name: multispati
> ### Title: Multivariate spatial analysis
> ### Aliases: multispati plot.multispati summary.multispati print.multispati
> ### Keywords: multivariate spatial
> 
> ### ** Examples
> 
> if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
+     data(mafragh)
+     maf.xy <- mafragh$xy
+     maf.flo <- mafragh$flo
+     maf.listw <- nb2listw(neig2nb(mafragh$neig))
+     s.label(maf.xy, neig = mafragh$neig, clab = 0.75)
+     maf.coa <- dudi.coa(maf.flo,scannf = FALSE)
+     maf.coa.ms <- multispati(maf.coa, maf.listw, scannf = FALSE, nfposi = 2, 
+         nfnega = 2)
+     maf.coa.ms
+     
+     ### detail eigenvalues components
+     fgraph <- function(obj){
+       # use multispati summary
+       sum.obj <- summary(obj)
+       # compute Imin and Imax
+       L <- listw2mat(eval(as.list(obj$call)$listw))
+       Imin <- min(eigen(0.5*(L+t(L)))$values)
+       Imax <- max(eigen(0.5*(L+t(L)))$values)
+       I0 <- -1/(nrow(obj$li)-1)
+       # create labels
+       labels <- lapply(1:length(obj$eig),function(i) bquote(lambda[.(i)]))
+       # draw the plot
+       xmax <- eval(as.list(obj$call)$dudi)$eig[1]*1.1
+       par(las=1)
+       var <- sum.obj[,2]
+       moran <- sum.obj[,3]
+       plot(x=var,y=moran,type='n',xlab='Inertia',ylab="Spatial autocorrelation (I)",
+            xlim=c(0,xmax),ylim=c(Imin*1.1,Imax*1.1),yaxt='n')
+       text(x=var,y=moran,do.call(expression,labels))
+       ytick <- c(I0,round(seq(Imin,Imax,le=5),1))
+       ytlab <- as.character(round(seq(Imin,Imax,le=5),1))
+       ytlab <- c(as.character(round(I0,1)),as.character(round(Imin,1)),
+            ytlab[2:4],as.character(round(Imax,1)))
+       axis(side=2,at=ytick,labels=ytlab)
+       rect(0,Imin,xmax,Imax,lty=2)
+       segments(0,I0,xmax,I0,lty=2)
+       abline(v=0)
+       title("Spatial and inertia components of the eigenvalues")
+     }
+     fgraph(maf.coa.ms)
+     ## end eigenvalues details
+ 
+ 
+     par(mfrow = c(1,3))
+     barplot(maf.coa$eig)
+     barplot(maf.coa.ms$eig) 
+     s.corcircle(maf.coa.ms$as)
+  
+     par(mfrow = c(2,2))
+     s.value(maf.xy, -maf.coa$li[,1])
+     s.value(maf.xy, -maf.coa$li[,2])
+     s.value(maf.xy, maf.coa.ms$li[,1])
+     s.value(maf.xy, maf.coa.ms$li[,2])
+     par(mfrow = c(1,1))
+ 
+     par(mfrow = c(1,2))
+     w1 <- -maf.coa$li[,1:2]
+     w1m <- apply(w1, 2, lag.listw, x = maf.listw)
+     s.match(w1, w1m, clab = 0.75)
+     w1.ms <- maf.coa.ms$li[,1:2]
+     w1.msm <- apply(w1.ms, 2, lag.listw, x = maf.listw)
+     s.match(w1.ms, w1.msm, clab = 0.75)
+     par(mfrow = c(1,1))
+ 
+     maf.pca <- dudi.pca(mafragh$mil, scannf = FALSE)
+     multispati.randtest(maf.pca, maf.listw)
+     maf.pca.ms <- multispati(maf.pca, maf.listw, scannf=FALSE)
+     plot(maf.pca.ms)
+ }
deldir 0.0-12 

     Please note: The process for determining duplicated points
     has changed from that used in version 0.0-9 (and previously).


Multivariate Spatial Analysis
Call: multispati(dudi = maf.coa, listw = maf.listw, scannf = FALSE, 
    nfposi = 2, nfnega = 2)

Scores from the initial duality diagramm:
          var       cum     ratio     moran
RS1 0.8691476 0.8691476 0.1043473 0.7250457
RS2 0.6491089 1.5182565 0.1822775 0.4834366

Multispati eigenvalues decomposition:
             eig       var      moran
CS1   0.68545912 0.8332937  0.8225901
CS2   0.37853390 0.5865926  0.6453097
CS54 -0.08077788 0.2482426 -0.3253990
CS55 -0.08900757 0.2749796 -0.3236879
> 
> 
> 
> 

[Package ade4 Index]