aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Kellner <ken@kenkellner.com>2017-11-17 15:33:05 (GMT)
committerKen Kellner <ken@kenkellner.com>2017-11-17 15:33:05 (GMT)
commit28fd1eb65e706db522698923f298cd7fa65d4839 (patch)
tree5677ee267ce13cea158a17c0c428a89a169effef
parenteb36068e0d642f28b3a40158c5f2fbd211c15e80 (diff)
Combined supplement
-rw-r--r--supplements/appendixS1.Rmd307
1 files changed, 307 insertions, 0 deletions
diff --git a/supplements/appendixS1.Rmd b/supplements/appendixS1.Rmd
new file mode 100644
index 0000000..4e849ea
--- /dev/null
+++ b/supplements/appendixS1.Rmd
@@ -0,0 +1,307 @@
+---
+title: "Appendix S1"
+output: pdf_document
+---
+
+Supplemental information for:
+
+Kellner, K. F., Duchamp, J. E., & Swihart R. K. Niche breadth and vertebrate sensitivity to habitat modification: signals from multiple taxa across replicated landscapes. Diversity & Distributions.
+
+```{r, echo=FALSE, warning=FALSE, message=FALSE}
+setwd('..')
+source('.Rprofile')
+```
+
+# Species Included
+
+**Table S1.1**. All species included in the analysis, including scientific names, 4-letter alpha code, taxa, standardized niche breadth, and total observations.
+
+```{r, echo=F}
+mam.counts <- read.csv(datapath('mam_counts.csv'),header=T,stringsAsFactors=F)
+bat.counts <- read.csv(datapath('bat_counts.csv'),header=T,stringsAsFactors=F)
+bird.counts <- read.csv(datapath('bird_counts.csv'),header=T,stringsAsFactors=F)
+turtle.counts <- read.csv(datapath('turtle_counts.csv'),header=T,stringsAsFactors=F)
+
+load(outpath('out_mam_lvl1.Rdata'))
+load(outpath('out_bird_lvl1.Rdata'))
+load(outpath('out_bat_lvl1.Rdata'))
+load(outpath('out_turtle_lvl1.Rdata'))
+
+codes <- c(mam.counts$codes,bat.counts$code,bird.counts$code,turtle.counts$code)
+spname <- c(names(mam.phylo),names(bat.phylo),names(bird.phylo),names(turtle.phylo))
+taxa <- c(rep('small_mammal',length(mam.counts$codes)),
+ rep('bat',length(bat.counts$code)),
+ rep('bird',length(bird.counts$code)),
+ rep('turtle',length(turtle.counts$code)))
+niche <- c(mam.niche,bat.niche,bird.niche,turtle.niche)
+counts <- c(mam.counts$counts,bat.counts$count,bird.counts$count,turtle.counts$count)
+
+out <- data.frame(code=codes,scientific_name=spname,taxa=taxa,niche_breadth_z=niche,observations=counts)
+knitr::kable(out)
+```
+
+\pagebreak
+
+# Phylogenetic Trees
+
+Phylogenetic trees used to generate correlation matrices in R package `ape` for models NP and IP.
+
+```{r, echo=FALSE, warning=FALSE, message=FALSE}
+library(ape)
+par(mar = c(4,4.5,1.5,2) + 0.1)
+```
+
+**Figure S1.1**. Mammal phylogenetic tree, pruned to only species included in the analysis. The tree was obtained using Phylomatic (http://phylodiversity.net/phylomatic/).
+
+```{r, echo=FALSE}
+mam.length <- read.tree(datapath('smammals_lengths.phylo'))
+
+mam.pruned <- drop.tip(mam.length,mam.length$tip.label[3])
+
+plot(mam.pruned)
+```
+
+\pagebreak
+
+**Figure S1.2**. Bat phylogenetic tree, pruned to only species included in the analysis. The tree was obtained using Phylomatic (http://phylodiversity.net/phylomatic/).
+
+```{r, echo=FALSE}
+load(outpath('out_bat_lvl1.Rdata'))
+
+bats.length <- read.tree(datapath('bats_lengths.phylo'))
+
+bats.pruned <- drop.tip(bats.length,bats.length$tip.label[bats.length$tip.label%in%c('Nycticeius_humeralis')])
+
+plot(bats.pruned)
+```
+
+\pagebreak
+
+**Figure S1.3**. Bird phylogenetic tree, pruned to only species included in the analysis. The tree was obtained using phyloT (http://phylot.biobyte.de/index.html). All branch lengths were assumed to be 1.
+
+```{r, echo=FALSE, fig.height=8}
+load(outpath('out_bird_lvl1.Rdata'))
+
+birds.nolength <- read.tree(datapath('birds_nolengths.phylo'))
+
+birds.pruned <- drop.tip(birds.nolength,birds.nolength$tip.label[!birds.nolength$tip.label%in%colnames(bird.phylo)])
+
+plot(birds.pruned)
+```
+
+\pagebreak
+
+**Figure S1.4**. Turtle phylogenetic tree, pruned to only species included in the analysis. The tree was obtained using phyloT (http://phylot.biobyte.de/index.html). All branch lengths were assumed to be 1.
+
+```{r, echo=FALSE}
+turtle.nolength <- read.tree(datapath('turtles_nolengths.phylo'))
+
+plot(turtle.nolength)
+```
+
+\pagebreak
+
+# Habitat Effects on Detection Probability
+
+```{r, echo=FALSE,warning=FALSE,message=FALSE}
+line.col <- 'black'
+```
+
+**Figure S1.5**. Effects of habitat type (relative to the forest baseline) on detection probability for mammals, from occupancy models. Error bars represent 95% credible intervals. Species codes can be found in Table S1.
+
+```{r, echo=FALSE}
+load(outpath('out_mam_lvl1.Rdata'))
+
+mam.codes <- c(colnames(mam.cellocc)[1],'NA',colnames(mam.cellocc)[2:11])
+mam.codes[1] <- '13GR'
+
+## Effects
+agvals <- c(out.mam.lvl1$mean$beta.pag[!out.mam.lvl1$overlap0$beta.pag&out.mam.lvl1$Rhat$beta.pag<=1.1])
+agupper <- c(out.mam.lvl1$q97.5$beta.pag[!out.mam.lvl1$overlap0$beta.pag&out.mam.lvl1$Rhat$beta.pag<=1.1])
+aglower <- c(out.mam.lvl1$q2.5$beta.pag[!out.mam.lvl1$overlap0$beta.pag&out.mam.lvl1$Rhat$beta.pag<=1.1])
+agcodes <- c(mam.codes[!out.mam.lvl1$overlap0$beta.pag&out.mam.lvl1$Rhat$beta.pag<=1.1])
+
+grassvals <- c(out.mam.lvl1$mean$beta.pgrass[!out.mam.lvl1$overlap0$beta.pgrass&out.mam.lvl1$Rhat$beta.pgrass<=1.1])
+grassupper <- c(out.mam.lvl1$q97.5$beta.pgrass[!out.mam.lvl1$overlap0$beta.pgrass&out.mam.lvl1$Rhat$beta.pgrass<=1.1])
+grasslower <- c(out.mam.lvl1$q2.5$beta.pgrass[!out.mam.lvl1$overlap0$beta.pgrass&out.mam.lvl1$Rhat$beta.pgrass<=1.1])
+grasscodes <- c(mam.codes[!out.mam.lvl1$overlap0$beta.pgrass&out.mam.lvl1$Rhat$beta.pgrass<=1.1])
+
+##Figure
+structure <- c(1:6)
+comb.vals <- c(agvals,grassvals)
+comb.upper <- c(agupper,grassupper)
+comb.lower <- c(aglower,grasslower)
+comb.codes <- c(agcodes,grasscodes)
+
+par(mar = c(4.5,4.5,0.5,1) + 0.1, oma=c(0,0,0,0),mgp=c(2.5,1,0))
+
+plot(structure,comb.vals,xaxt='n',xlab="",ylim=c(-3.5,6.2),ylab="",
+ pch=19)
+axis(1,at=structure,labels=comb.codes,las=2)
+
+text(1.5,5.7,"Agriculture",cex=1.3)
+text(4.5,5.7,"Grassland",cex=1.3)
+
+abline(v=2.5)
+abline(h=0,col=line.col,lty=2)
+
+segments(structure,comb.lower,structure,comb.upper)
+
+mtext('Detection effect',2,3.5)
+mtext('(relative to forest)',2,2.5)
+mtext('Species',1,3.6)
+```
+
+\pagebreak
+
+**Figure S1.6**. Effects of habitat type (relative to the forest baseline) on detection probability for bats, from occupancy models. Error bars represent 95% credible intervals. Species codes can be found in Table S1.
+
+```{r, echo=FALSE}
+load(outpath('out_bat_lvl1.Rdata'))
+
+bat.codes <- colnames(bat.cellocc)
+
+## Effects
+agvals <- c(out.bat.lvl1$mean$beta.pag[!out.bat.lvl1$overlap0$beta.pag&out.bat.lvl1$Rhat$beta.pag<=1.1])
+agupper <- c(out.bat.lvl1$q97.5$beta.pag[!out.bat.lvl1$overlap0$beta.pag&out.bat.lvl1$Rhat$beta.pag<=1.1])
+aglower <- c(out.bat.lvl1$q2.5$beta.pag[!out.bat.lvl1$overlap0$beta.pag&out.bat.lvl1$Rhat$beta.pag<=1.1])
+agcodes <- c(bat.codes[!out.bat.lvl1$overlap0$beta.pag&out.bat.lvl1$Rhat$beta.pag<=1.1])
+
+grassvals <- c(out.bat.lvl1$mean$beta.pgrass[!out.bat.lvl1$overlap0$beta.pgrass&out.bat.lvl1$Rhat$beta.pgrass<=1.1])
+grassupper <- c(out.bat.lvl1$q97.5$beta.pgrass[!out.bat.lvl1$overlap0$beta.pgrass&out.bat.lvl1$Rhat$beta.pgrass<=1.1])
+grasslower <- c(out.bat.lvl1$q2.5$beta.pgrass[!out.bat.lvl1$overlap0$beta.pgrass&out.bat.lvl1$Rhat$beta.pgrass<=1.1])
+grasscodes <- c(bat.codes[!out.bat.lvl1$overlap0$beta.pgrass&out.bat.lvl1$Rhat$beta.pgrass<=1.1])
+
+wetvals <- c(out.bat.lvl1$mean$beta.pwet[!out.bat.lvl1$overlap0$beta.pwet&out.bat.lvl1$Rhat$beta.pwet<=1.1])
+wetupper <- c(out.bat.lvl1$q97.5$beta.pwet[!out.bat.lvl1$overlap0$beta.pwet&out.bat.lvl1$Rhat$beta.pwet<=1.1])
+wetlower <- c(out.bat.lvl1$q2.5$beta.pwet[!out.bat.lvl1$overlap0$beta.pwet&out.bat.lvl1$Rhat$beta.pwet<=1.1])
+wetcodes <- c(bat.codes[!out.bat.lvl1$overlap0$beta.pwet&out.bat.lvl1$Rhat$beta.pwet<=1.1])
+
+##Figure
+structure <- c(1:2)
+comb.vals <- c(grassvals,wetvals)
+comb.upper <- c(grassupper,wetupper)
+comb.lower <- c(grasslower,wetlower)
+comb.codes <- c(grasscodes,wetcodes)
+
+par(mar = c(4.5,4.5,0.5,1) + 0.1, oma=c(0,0,0,0),mgp=c(2.5,1,0))
+
+plot(structure,comb.vals,xaxt='n',xlim=c(0.5,2.5),xlab="",ylim=c(-1.6,0.5),ylab="",
+ pch=19)
+axis(1,at=structure,labels=comb.codes,las=2)
+
+text(1,0.3,"Grassland",cex=1.3)
+text(2,0.3,"Wetland",cex=1.3)
+
+abline(v=1.5)
+abline(h=0,col=line.col,lty=2)
+
+segments(structure,comb.lower,structure,comb.upper)
+
+mtext('Detection effect',2,3.5)
+mtext('(relative to forest)',2,2.5)
+mtext('Species',1,3.6)
+```
+
+\pagebreak
+
+**Figure S1.7**. Effects of habitat type (relative to the forest baseline) on detection probability for birds, from occupancy models. Error bars represent 95% credible intervals. Species codes can be found in Table S1.
+
+```{r, echo=FALSE}
+load(outpath('out_bird_lvl1.Rdata'))
+
+bird.codes <- colnames(bird.cellocc)
+
+## Effects
+agvals <- c(out.bird.lvl1$mean$beta.pag[!out.bird.lvl1$overlap0$beta.pag&out.bird.lvl1$Rhat$beta.pag<=1.1])
+agupper <- c(out.bird.lvl1$q97.5$beta.pag[!out.bird.lvl1$overlap0$beta.pag&out.bird.lvl1$Rhat$beta.pag<=1.1])
+aglower <- c(out.bird.lvl1$q2.5$beta.pag[!out.bird.lvl1$overlap0$beta.pag&out.bird.lvl1$Rhat$beta.pag<=1.1])
+agcodes <- c(bird.codes[!out.bird.lvl1$overlap0$beta.pag&out.bird.lvl1$Rhat$beta.pag<=1.1])
+
+grassvals <- c(out.bird.lvl1$mean$beta.pgrass[!out.bird.lvl1$overlap0$beta.pgrass&out.bird.lvl1$Rhat$beta.pgrass<=1.1])
+grassupper <- c(out.bird.lvl1$q97.5$beta.pgrass[!out.bird.lvl1$overlap0$beta.pgrass&out.bird.lvl1$Rhat$beta.pgrass<=1.1])
+grasslower <- c(out.bird.lvl1$q2.5$beta.pgrass[!out.bird.lvl1$overlap0$beta.pgrass&out.bird.lvl1$Rhat$beta.pgrass<=1.1])
+grasscodes <- c(bird.codes[!out.bird.lvl1$overlap0$beta.pgrass&out.bird.lvl1$Rhat$beta.pgrass<=1.1])
+
+wetvals <- c(out.bird.lvl1$mean$beta.pwet[!out.bird.lvl1$overlap0$beta.pwet&out.bird.lvl1$Rhat$beta.pwet<=1.1])
+wetupper <- c(out.bird.lvl1$q97.5$beta.pwet[!out.bird.lvl1$overlap0$beta.pwet&out.bird.lvl1$Rhat$beta.pwet<=1.1])
+wetlower <- c(out.bird.lvl1$q2.5$beta.pwet[!out.bird.lvl1$overlap0$beta.pwet&out.bird.lvl1$Rhat$beta.pwet<=1.1])
+wetcodes <- c(bird.codes[!out.bird.lvl1$overlap0$beta.pwet&out.bird.lvl1$Rhat$beta.pwet<=1.1])
+
+urbanvals <- c(out.bird.lvl1$mean$beta.purban[!out.bird.lvl1$overlap0$beta.purban&out.bird.lvl1$Rhat$beta.purban<=1.1])
+urbanupper <- c(out.bird.lvl1$q97.5$beta.purban[!out.bird.lvl1$overlap0$beta.purban&out.bird.lvl1$Rhat$beta.purban<=1.1])
+urbanlower <- c(out.bird.lvl1$q2.5$beta.purban[!out.bird.lvl1$overlap0$beta.purban&out.bird.lvl1$Rhat$beta.purban<=1.1])
+urbancodes <- c(bird.codes[!out.bird.lvl1$overlap0$beta.purban&out.bird.lvl1$Rhat$beta.purban<=1.1])
+
+## Figure
+structure <- c(1:10)
+comb.vals <- c(agvals,grassvals,wetvals,urbanvals)
+comb.upper <- c(agupper,grassupper,wetupper,urbanupper)
+comb.lower <- c(aglower,grasslower,wetlower,urbanlower)
+comb.codes <- c(agcodes,grasscodes,wetcodes,urbancodes)
+
+par(mar = c(4.5,4.5,0.5,1) + 0.1, oma=c(0,0,0,0),mgp=c(2.5,1,0))
+
+plot(structure,comb.vals,xaxt='n',xlab="",ylim=c(-3.4,8.5),ylab="",
+ pch=19)
+axis(1,at=structure,labels=comb.codes,las=2)
+
+text(1.5,8.2,"Agriculture",cex=1.2)
+text(4,8.2,"Grassland",cex=1.2)
+text(6.5,8.2,"Wetland",cex=1.2)
+text(9,8.2,"Urban",cex=1.2)
+
+abline(v=2.5)
+abline(v=5.5)
+abline(v=7.5)
+abline(h=0,col=line.col,lty=2)
+
+segments(structure,comb.lower,structure,comb.upper)
+
+mtext('Detection effect',2,3.5)
+mtext('(relative to forest)',2,2.5)
+mtext('Species',1,3.6)
+
+```
+
+\pagebreak
+
+# JAGS Model Code
+
+```{r, echo=FALSE, warning=FALSE, error=FALSE, message=FALSE}
+library(knitr)
+read_chunk('../models/model_lvl2_NN.R')
+read_chunk('../models/model_lvl2_IN.R')
+read_chunk('../models/model_lvl2_NP.R')
+read_chunk('../models/model_lvl2_IP.R')
+```
+
+**Code S1.1**. JAGS model code for model NN: no imperfect detection, no phylogenetic effect in fragmentation response.
+
+```{r, eval=FALSE}
+<<model.nn>>
+```
+
+\pagebreak
+
+**Code S1.2**. JAGS model code for model IN: imperfect detection, no phylogenetic effect in fragmentation response.
+
+```{r, eval=FALSE}
+<<model.in>>
+```
+
+\pagebreak
+
+**Code S1.3**. JAGS model code for model NP: no imperfect detection, phylogenetic effect in fragmentation response.
+
+```{r, eval=FALSE}
+<<model.np>>
+```
+
+\pagebreak
+
+**Code S1.4**. JAGS model code for model IP: imperfect detection, phylogenetic effect in fragmentation response.
+
+```{r, eval=FALSE}
+<<model.ip>>
+```