Skip to content

Commit ae837b6

Browse files
committed
Simplify article setup
1 parent 0f2ee5a commit ae837b6

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

vignettes/web_only/multispecies.Rmd

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ vignette: >
1111
**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'.**
1212

1313
```{r setup, include = FALSE, cache = FALSE}
14-
dplyr_installed <- require("dplyr", quietly = TRUE)
15-
ggplot_installed <- require("ggplot2", quietly = TRUE)
16-
pkgs <- dplyr_installed && ggplot_installed
17-
EVAL <- identical(Sys.getenv("NOT_CRAN"), "true") && pkgs
14+
EVAL <- identical(Sys.getenv("NOT_CRAN"), "true")
1815
knitr::opts_chunk$set(
1916
collapse = TRUE,
2017
warning = FALSE,
@@ -27,9 +24,7 @@ knitr::opts_chunk$set(
2724
)
2825
```
2926

30-
```{r packages, message = FALSE, warning = TRUE}
31-
library(ggplot2)
32-
library(dplyr)
27+
```{r packages, message=FALSE}
3328
library(sdmTMB)
3429
```
3530

@@ -227,11 +222,24 @@ logLik(fit_svc)
227222
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:
228223

229224
```{r echo=FALSE}
230-
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"))
231-
knitr::kable(desc)
225+
desc <- data.frame(
226+
Form = c(
227+
"Main effects",
228+
"Spatial effects",
229+
"Spatial effects w/shared variance",
230+
"Spatiotemporal effects"),
231+
Implementation = c(
232+
"Year-by-species interactions or smooths by year",
233+
"Spatially varying coefficients",
234+
"Spatially varying coefficients + map argument",
235+
"Species-year factor as time variable")
236+
)
237+
if (require("knitr", quietly = TRUE)) {
238+
knitr::kable(desc)
239+
} else
240+
print(desc)
232241
```
233242

234243
### Further extensions
235244

236245
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.
237-

0 commit comments

Comments
 (0)