[R] Significance of Principal Coordinates

Christian Kamenik christian.kamenik at ips.unibe.ch
Mon Mar 14 18:32:12 CET 2005


Dear all,

I was looking for methods in R that allow assessing the number of  
significant principal coordinates. Unfortunatly I was not very 
successful. I expanded my search to the web and Current Contents, 
however, the information I found is very limited.
Therefore, I tried to write code for doing a randomization. I would 
highly appriciate if somebody could comment on the following approach. I 
am neither a statistician, nor an R expert... the data matrix I used has 
72 species (columns) and 167 samples (rows).

Many thanks in advance, Christian

> # focus on ~80% of all the eigenvalues
>
> nEigen <- round(ncol(Data*0.8))
>
> # Calculate Weights for Principal Coordinates Analysis
>
> Total <- apply(Data,1,sum)
> Weight <- round(Total/max(Total)*1000)
>
>
> # Calculate Chord Distance
>
> library(vegan)
> Chord <- vegdist(decostand(Data, "norm"), "euclidean")
>
> # Calculate Principal Coordinates, including distance matrix row weights
>
> library(ade4)
> PCoord.Eigen <- dudi.pco(Chord,row.w=Weight,scann=F,full=T)$eig[1:nEigen]
>
> # Randomization of Principal Coordinates Analysis
>
> library(labdsv)
> for (i in 1:99) {
>     Data.random <- rndtaxa(Data,species=T,plots=T)
>     Total.random <- apply(Data.random,1,sum)
>     Weight.random <- round(Total.random/max(Total.random)*1000)
>     Chord.random <- vegdist(decostand(Data.random, "norm"), "euclidean")
>     PCoord.Eigen.random <- 
> dudi.pco(Chord.random,row.w=Weight.random,scann=F,full=T)$eig[1:nEigen]
>     PCoord.Eigen <- cbind.data.frame(PCoord.Eigen, PCoord.Eigen.random)
> }
>
> # Plot scree diagramm with original eigenvalues and 95%-quantiles of 
> eigenvalues from randomized principal coordinate analysis
>
> plot(c(1:nEigen),PCoord.Eigen[,1],type="b")
> lines(c(1:nEigen),apply(PCoord.Eigen[,-1],1,quantile,probs=c(0.95)),col="red")


Christian Kamenik
Institute of Plant Sciences
University of Bern




More information about the R-help mailing list