2016-08-03 124 views
-1

我已使用specaccum()命令爲我的樣品開發物種積累曲線。查找物種積累曲線達到漸近線的位置

下面是一些示例性數據:

site1<-c(0,8,9,7,0,0,0,8,0,7,8,0) 
site2<-c(5,0,9,0,5,0,0,0,0,0,0,0) 
site3<-c(5,0,9,0,0,0,0,0,0,6,0,0) 
site4<-c(5,0,9,0,0,0,0,0,0,0,0,0) 
site5<-c(5,0,9,0,0,6,6,0,0,0,0,0) 
site6<-c(5,0,9,0,0,0,6,6,0,0,0,0) 
site7<-c(5,0,9,0,0,0,0,0,7,0,0,3) 
site8<-c(5,0,9,0,0,0,0,0,0,0,1,0) 
site9<-c(5,0,9,0,0,0,0,0,0,0,1,0) 
site10<-c(5,0,9,0,0,0,0,0,0,0,1,6) 
site11<-c(5,0,9,0,0,0,5,0,0,0,0,0) 
site12<-c(5,0,9,0,0,0,0,0,0,0,0,0) 
site13<-c(5,1,9,0,0,0,0,0,0,0,0,0) 

species_counts<-rbind(site1,site2,site3,site4,site5,site6,site7,site8,site9,site10,site11,site12,site13) 

accum <- specaccum(species_counts, method="random", permutations=100) 

plot(accum) 

爲了確保我已經充分採樣,我需要確保物種累積曲線的曲線達到漸近線,定義爲< 0.3之間的斜率最後兩點(站點12和13之間的ei)。

results <- with(accum, data.frame(sites, richness, sd)) 

產生以下:

sites richness  sd 
1  1  3.46 0.9991916 
2  2  4.94 1.6625403 
3  3  5.94 1.7513054 
4  4  7.05 1.6779918 
5  5  8.03 1.6542263 
6  6  8.74 1.6794660 
7  7  9.32 1.5497149 
8  8  9.92 1.3534841 
9  9 10.51 1.0492422 
10 10 11.00 0.8408750 
11 11 11.35 0.7017295 
12 12 11.67 0.4725816 
13 13 12.00 0.0000000 

我覺得我到達那裏。我可以用站點對豐富度生成一個lm,並提取站點12和站點13之間的確切斜率(相切?)。在這裏搜索更長的時間。

+0

嘗試查看是否可以先獲取它,然後發佈代碼並提供幫助,這一點很重要。 – Vedda

+0

你的*特定*問題是什麼? – Barranka

回答

1

簡化您的數據生成過程中一點點:

species_counts <- matrix(c(0,8,9,7,0,0,0,8,0,7,8,0, 
5,0,9,0,5,0,0,0,0,0,0,0, 5,0,9,0,0,0,0,0,0,6,0,0, 
5,0,9,0,0,0,0,0,0,0,0,0, 5,0,9,0,0,6,6,0,0,0,0,0, 
5,0,9,0,0,0,6,6,0,0,0,0, 5,0,9,0,0,0,0,0,7,0,0,3, 
5,0,9,0,0,0,0,0,0,0,1,0, 5,0,9,0,0,0,0,0,0,0,1,0, 
5,0,9,0,0,0,0,0,0,0,1,6, 5,0,9,0,0,0,5,0,0,0,0,0, 
5,0,9,0,0,0,0,0,0,0,0,0, 5,1,9,0,0,0,0,0,0,0,0,0), 
byrow=TRUE,nrow=13) 

始終運行隨機測試之前最好先set.seed()(讓我們知道specaccumvegan包):

set.seed(101) 
library(vegan) 
accum <- specaccum(species_counts, method="random", permutations=100) 

從返回的對象中提取richnesssites組件並計算d(richness)/d(sites)(注意,斜率向量是比t短的一個元素他出身網站/豐富載體:要小心,如果你想匹配與網站的特定編號)

(slopes <- with(accum,diff(richness)/diff(sites))) 
## [1] 1.45 1.07 0.93 0.91 0.86 0.66 0.65 0.45 0.54 0.39 0.32 0.31 

在這種情況下斜坡,斜坡實際上從未低於0.3,所以這段代碼尋找第一時間斜率低於0.3:

which(slopes<0.3)[1] 

返回NA

+0

謝謝你,這正是我一直在尋找的!我會盡力在未來更具體。 – lken