R语言 如何在iNext中生成样本完整性~多样性顺序图?

bvuwiixz  于 2023-01-10  发布在  其他
关注(0)|答案(1)|浏览(609)

我正尝试创建一个样式与下面所示的完整性~多样性顺序图类似的图,但引用了不同的数据集。

  • 上图为Chao等人2020年的图3a。*

我想为iNEXT包中包含的ciliate数据集创建一个这种样式的图,主要使用函数iNEXT::iNEXT()iNEXT::ggiNEXT()。我看到函数iNEXT()的输出中包含了样本完整性值,作为变量SC,位于多个位置(如下所示)。

> library(ggplot2)
> library(iNEXT)
> data("ciliates")
>
> #define output of function iNEXT as object c
> c <- iNEXT::iNEXT(ciliates, datatype = "incidence_raw", q=c(0,1,2), se=TRUE, nboot = 10) 
>
> head(c$iNextEst$size_based)
  Assemblage t      Method Order.q        qD    qD.LCL    qD.UCL        SC    SC.LCL    SC.UCL
1  EtoshaPan 1 Rarefaction       0  27.15789  25.46898  28.84681 0.1901378 0.1602758 0.2199998
2  EtoshaPan 2 Rarefaction       0  49.15205  46.46171  51.84239 0.3154101 0.2763704 0.3544499
3  EtoshaPan 3 Rarefaction       0  67.74407  64.36418  71.12395 0.4040033 0.3625663 0.4454402
4  EtoshaPan 4 Rarefaction       0  83.93008  80.01195  87.84822 0.4704869 0.4293215 0.5116523
5  EtoshaPan 5 Rarefaction       0  98.31054  93.93120 102.68989 0.5227274 0.4830091 0.5624458
6  EtoshaPan 6 Rarefaction       0 111.27226 106.47865 116.06587 0.5652248 0.5274311 0.6030185
>
> head(c$iNextEst$coverage_based)
  Assemblage        SC t      Method Order.q        qD    qD.LCL    qD.UCL
1  EtoshaPan 0.1901402 1 Rarefaction       0  27.15824  25.46933  28.84715
2  EtoshaPan 0.3154100 2 Rarefaction       0  49.15201  43.79056  54.51347
3  EtoshaPan 0.4040045 3 Rarefaction       0  67.74432  61.04684  74.44180
4  EtoshaPan 0.4704874 4 Rarefaction       0  83.93019  75.75317  92.10722
5  EtoshaPan 0.5227259 5 Rarefaction       0  98.31009  88.86377 107.75640
6  EtoshaPan 0.5652251 6 Rarefaction       0 111.27235 100.79007 121.75464
>
> c$DataInfo
           Assemblage  T   U S.obs     SC  Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
1           EtoshaPan 19 516   216 0.8017 107 44 26 14  6  5  4  3  2   2
2  CentralNamibDesert 17 379   130 0.8425  63 28 13  4  3  7  1  2  1   0
3 SouthernNamibDesert 15 358   150 0.7816  82 28 14  8  6  1  1  2  2   1

然而,在对象c中,我没有看到集合(EtoshaPanCentralNamibDesertSouthernNamibDesert)、样本完整性值和多样性顺序(上图中的"顺序q")的唯一组合。简单地通过在函数ggiNEXT中设置适当的参数就可以创建样本完整性~多样性顺序图吗?如果不能,我必须采取什么步骤来创建它?
编辑:我不是唯一一个问这个问题的人:* 一个月一次 *
参考文献:* Chao,Anne,et al.《量化样本完整性并比较群落多样性》,《生态研究》35.2(2020):第292至314段。
参考文献链接:link

vlju58qv

vlju58qv1#

这可以通过iNEXT.4steps包来完成,该包可以从GitHub下载。

> #install_github('AnneChao/iNEXT.4steps') #not currently on CRAN
> library(iNEXT)
> library(iNEXT)
> library(iNEXT.4steps)
> library(ggplot2)
> data("ciliates")   #included in package iNEXT
> 
> i <- iNEXT4steps(ciliates, 
+             diversity = "TD", 
+             q = seq(0, 2, 0.2),
+             datatype = "incidence_raw",
+             nboot = 99)
> i$figure   #automatically generate plots shown below
> i
$summary
$summary$`STEP1. Sample completeness profiles`
           Assemblage q = 0 q = 1 q = 2
1  CentralNamibDesert  0.66  0.84  0.98
2           EtoshaPan  0.64  0.80  0.95
3 SouthernNamibDesert  0.57  0.78  0.96

$summary$`STEP2. Asymptotic analysis`
           Assemblage         Diversity Observed Estimator  s.e.    LCL    UCL
1  CentralNamibDesert  Species richness   130.00    196.71 21.27 155.02 238.39
2  CentralNamibDesert Shannon diversity    81.81    106.48  6.06  94.60 118.36
3  CentralNamibDesert Simpson diversity    54.22     59.56  3.31  53.07  66.05
4           EtoshaPan  Species richness   216.00    339.25 25.67 288.94 389.57
5           EtoshaPan Shannon diversity   158.37    222.94 11.84 199.74 246.13
6           EtoshaPan Simpson diversity   116.68    142.83  8.78 125.62 160.04
7 SouthernNamibDesert  Species richness   150.00    262.07 26.45 210.23 313.90
8 SouthernNamibDesert Shannon diversity   103.70    149.91  8.09 134.05 165.77
9 SouthernNamibDesert Simpson diversity    72.33     84.60  4.48  75.82  93.37

$summary$`STEP3. Non-asymptotic coverage-based rarefaction and extrapolation analysis`
         Cmax = 0.893  q = 0  q = 1  q = 2
1  CentralNamibDesert 151.42  88.95  55.70
2           EtoshaPan 272.81 185.79 126.43
3 SouthernNamibDesert 207.21 127.10  77.98

$summary$`STEP4. Evenness among species abundances`
                    Pielou J' q = 1 q = 2
CentralNamibDesert       0.89  0.58  0.36
EtoshaPan                0.93  0.68  0.46
SouthernNamibDesert      0.91  0.61  0.37

$figure
$figure[[1]]

$figure[[2]]

$figure[[3]]

$figure[[4]]

$figure[[5]]

$figure[[6]]

相关问题