ここでは、種数のように一つの値(単変量)に変換したデータではなく、多次元のままのデータ(多変量)をグラフ化=可視化=グラフ化する方法を簡単に解説します。時間の関係上、詳しく説明できないので、以下のサイトも復習の際には参考にしてください(発展的内容)。多変量解析の基礎
ここでは、「単変量の比較・検定」ページの[1-v]のところでPC上に保存したオブジェクトデータ(species_biwa_data.rds)を使います。
まずはライブラリの読み込み、データとメタデータの読み込みです。
library(vegan)
#load the result
species_biwa_data <- readRDS("./species_biwa_data.rds")
そして、植物プランクトンのデータを割合のデータに変換します。
#convert to the proportion
species_biwa_data_p <- decostand(species_biwa_data, method="total", MARGIN=1)
最後に(解説は割愛しますが)以下のコードを実行すれば何十種類ものプランクトン種に関する多次元データを次元削減し、2次元散布図としてプロットすることができます。
#PCoA based on Bray-Curtis dissimilarity
biwa_bc.d<-vegdist(species_biwa_data_p, method="bray") #Bray-curtis dissimilarity
PCoA_biwa_bc <- cmdscale(biwa_bc.d, k = 2, ) #execute PCoA
x<-PCoA_biwa_bc[,1] #extract the position of each sample
y<-PCoA_biwa_bc[,2]
plot(x,y, cex=0.5) #2D scatter plot
text(x,y,label=species_biwa_data$month_sampling) #set the symbols
図は以下のようになります。