---
title: "Species Number and Endemism: The Galápagos Archipelago Revisited"
author: Johnson MP and Raven PH
date: 1973
bibliography: "../../07_background_literature/galapagos.bib"
csl: "../../07_background_literature/science.csl"
output: word_document
abstract: |
   "Regression analyses to determine plant species
   number are repeated ..."
---

```{r, format-defs, eval = TRUE, echo = FALSE, results = 'hide'}
## ci bounds
lower_ci_boundary <- 0.025
upper_ci_boundary <- 0.975
ci_format_string <- "%.1f (%.1f to %.1f)"

## functions to format p-values
format_pvals <- function(pval, digits = 3) {
  if (pval > 1 | pval < 0) {
    stop("P values cannot be greater than 1 or smaller than 0")
  }
  result <-
    ifelse(pval < 1 / 10 ^ digits,
           paste("_p_", "<", 1 / 10 ^ digits),
           paste("_p_", "=", round(pval, digits)))
  return(result)
}

## formating of test statistic values
f_digits <- 2
```

The major factors determining the number of plant species on the
Galápagos Archipelago were analyzed and discussed in Hamilton _et al._
@Hamilton1963. [...]

[...]

```{r, data-table, eval = TRUE, echo = FALSE, results = 'asis'}
pander(gala,
       split.cells = 20,
       split.table = 200,
       caption = "Table 1. List of islands and variables.")
```

```{r, format-coefs, eval = TRUE, echo = FALSE, results = 'asis'}
area_result_str <-
  do.call("sprintf",
          args = c(ci_format_string,
                   as.list(fit_coefs["log(Area)", ])))
area_F <-
  round(drop1(fit.galapagos.glm.1,
              test = "F")["log(Area)", "F value"],
        f_digits)
area_p <-
  format_pvals(drop1(fit.galapagos.glm.1,
                     test = "F")["log(Area)", "Pr(>F)"])
```

[...]

The results differ markedly from those of Hamilton _et al._ Once we
account for overdispersion, our Poisson GLM results indicate that only
area makes a significant contribution to the determination of species
number. For each increase in log(Area), we see a increase of `r
area_result_str` fold (_F_ = `r area_F`, `r area_p`; see Fig. 1).


```{r, figure-area, eval = TRUE, echo = FALSE, results = 'asis'}
plot(Species ~ Area,
     data = gala,
     log = "x",
     pch = 19)
lines(xes, yes)
lines(xes, yes_lwr, lty = 2)
lines(xes, yes_upr, lty = 2)
```

[...]

## References and Notes
