knitr::opts_chunk$set(echo = FALSE)
library(drake)
library(dplyr)
library(ggplot2)

all_di <- read.csv(here::here("analysis", "reports", "all_di.csv"), stringsAsFactors = F)

all_di <- all_di %>%
  mutate(log_nparts = log(gmp:::as.double.bigz(nparts)),
         log_nsamples = log(nsamples),
         log_s0 = log(s0),
         log_n0 = log(n0)) %>%
  filter(n0 != s0,
         s0 != 1,
         !singletons,
         n0 != (s0 + 1)) %>%
  mutate(dat = ifelse(grepl(dat, pattern = "fia"), "fia", dat),
         dat = ifelse(dat == "misc_abund_short", "misc_abund", dat)) %>%
  mutate(Dataset = dat,
         Dataset = ifelse(Dataset == "fia", "FIA", Dataset),
         Dataset = ifelse(Dataset == "bbs", "Breeding Bird Survey", Dataset),
         Dataset = ifelse(Dataset == "mcdb", "Mammal Communities", Dataset),
         Dataset = ifelse(Dataset == "gentry", "Gentry", Dataset),
         Dataset = ifelse(Dataset == "misc_abund", "Misc. Abundance", Dataset))

Figure S5.

s3_fig2 <- gridExtra::grid.arrange(grobs = list(
  ggplot(filter(all_di, s0 > 2, nparts > 20), aes(x = log_nparts, y= skew_95_ratio_1t)) +
  geom_point(alpha = .1) +
  theme_bw() +
  xlim(0, 100) +
  ylim(0,1)+
  xlab("Log number of elements in the feasible set") +
  ylab("Breadth index") +
  ggtitle("Breadth index (skewness)"),

ggplot(filter(all_di, nparts > 20), aes(x = log_nparts, y= simpson_95_ratio_1t)) +
  geom_point(alpha = .1) +
  theme_bw() +
  xlim(0, 100) +
  ylim(0, 1)+
  xlab("Log number of elements in the feasible set") +
  ggtitle("Breadth index (evenness)") +
  ylab("Breadth index")
), ncol = 2)


pdf("figure_s5.pdf", bg = "white")
plot(s3_fig2)
dev.off()

Legend. The breadth index (defined as the ratio of the width of a one-tailed 95% density interval relative to the full range of a distribution) for the distributions of skewness and evenness obtained from the sampled feasible set declines as the number of elements in the feasible set increases. This indicates more narrow and well-resolved statistical baselines for large feasible sets.



diazrenata/scadsanalysis documentation built on May 14, 2021, 6:59 p.m.