Skip to content

Commit

Permalink
Simplify article setup
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Dec 4, 2024
1 parent 0f2ee5a commit ae837b6
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions vignettes/web_only/multispecies.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ vignette: >
**If the code in this vignette has not been evaluated, a rendered version is available on the [documentation site](https://pbs-assess.github.io/sdmTMB/index.html) under 'Articles'.**

```{r setup, include = FALSE, cache = FALSE}
dplyr_installed <- require("dplyr", quietly = TRUE)
ggplot_installed <- require("ggplot2", quietly = TRUE)
pkgs <- dplyr_installed && ggplot_installed
EVAL <- identical(Sys.getenv("NOT_CRAN"), "true") && pkgs
EVAL <- identical(Sys.getenv("NOT_CRAN"), "true")
knitr::opts_chunk$set(
collapse = TRUE,
warning = FALSE,
Expand All @@ -27,9 +24,7 @@ knitr::opts_chunk$set(
)
```

```{r packages, message = FALSE, warning = TRUE}
library(ggplot2)
library(dplyr)
```{r packages, message=FALSE}
library(sdmTMB)
```

Expand Down Expand Up @@ -227,11 +222,24 @@ logLik(fit_svc)
These examples illustrate a number of ways that species-specific effects can be included in `sdmTMB` models, and can be extended to other categories/groups/cohorts within a species for which one wants to control the amount of information shared between groups (e.g., age-, size-, or stage-specific estimates). A brief summary of these approaches can be summarized as:

```{r echo=FALSE}
desc <- data.frame("Form" = c("Main effects", "Spatial effects", "Spatial effects w/shared variance", "Spatiotemporal effects"), "Implementation" = c("Year-by-species interactions or smooths by year", "Spatially varying coefficients", "Spatially varying coefficients + map argument", "Species-year factor as time variable"))
knitr::kable(desc)
desc <- data.frame(
Form = c(
"Main effects",
"Spatial effects",
"Spatial effects w/shared variance",
"Spatiotemporal effects"),
Implementation = c(
"Year-by-species interactions or smooths by year",
"Spatially varying coefficients",
"Spatially varying coefficients + map argument",
"Species-year factor as time variable")
)
if (require("knitr", quietly = TRUE)) {
knitr::kable(desc)
} else
print(desc)
```

### Further extensions

As long as you're willing to treat spatiotemporal and group-level fields (e.g., for different species or age cohorts) as independent, sdmTMB can be used to fit models to these data. For example, this allows sdmTMB to be used for standardization of age or length composition data as in [Thorson and Haltuch (2018) CJFAS](https://doi.org/10.1139/cjfas-2018-0015). The approach is to similar to the above and we plan to write a separate vignette on the topic.

0 comments on commit ae837b6

Please sign in to comment.