After completing the pcnm analysis on the set of data I can call on all of the axes and kick out the newly created standarized values from the analysis. However, before I go putting these values into multiple regression or other analyses I would like to know how much of the variation is accounted in each axis. I've tried telling r to kick out a screeplot, which would suffice, but with no luck. I've mostly worked in SAS previous to this analysis, so I am not well-versed in the R language. The code below all works well and does everything I need it to do, but it just doesn't give a whole lot of information about how the analysis performed or what the results of the analysis are. So the bottom line here is I would like some accounting for the proportion of variation accounted for by each component. Thank you all for your help.

I have attempted to use the screeplot code that is used for other ordination analysis in R, according the vegan package manual, but it never specifies that it can be used for pcnm.

#set working directory
setwd("G:/Cyprinodon_elegans")
#read in the data
loc<-read.csv("hydrologic_distances.csv",header=T)
attributes<-read.csv("balmorhea_locations.csv",header=T)
#have a look at the data
names(loc)
#pull only the values for origin, distination, and length
loc.go<-loc[,c(5,6,10)]
names(loc.go)
#create a matrix
loc.mat<-matrix(0,ncol=40,nrow=40)
loc.mat[cbind(loc.go$Origin,loc.go$Destination)]<-loc.go$Total_Length
#grab the row and column IDs
labels<-as.character(sort(unique(loc.go$Origin)))
rownames(loc.mat)<-labels
colnames(loc.mat)<-labels
#pull only the the lower right and make it a distance matrix
matrix2<-as.dist(loc.mat)
#load vegan library to run pcnm analysis
library(vegan)
#run pcnm
pcnm1<-pcnm(matrix2)
output<-as.data.frame(pcnm1$vectors)
output$UniqueID<-as.factor(as.character(row.names(output)))
output
#combine with other attributes
all.data<-cbind(attributes,output)
#plot the output
plot(all.data$Long,all.data$Lat)
ordisurf(all.data[,c(3:2)], scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1")
ordisurf(all.data[,c(3,2)], scores(pcnm1, choi=2), bubble = 4, main = "PCNM 2")
ordisurf(all.data[,c(3,2)], scores(pcnm1, choi=3), bubble = 4, main = "PCNM 3")
ordisurf(all.data[,c(3,2)], scores(pcnm1, choi=4), bubble = 4, main = "PCNM 4")
ordisurf(all.data[,c(3,2)], scores(pcnm1, choi=5), bubble = 4, main = "PCNM 5")
#write the output
write.table(all.data,"PCNM.output.csv")

0 Answers