class: center, middle, inverse, title-slide .title[ # Family options in sdmTMB ] .subtitle[ ## DFO TESA sdmTMB workshop ] .author[ ### ] .date[ ### January 16–19 2023 ] --- <!-- Build with: xaringan::inf_mr() --> # Families Many of the same families used in `glm()`, `glmmTMB()`, `mgcv::gam()` can be used here Includes: `gaussian()`, `Gamma()`, `binomial()`, `poisson()`, `Beta()`, `student()`, `tweedie()`, `nbinom1()`, `nbinom2()`, `truncated_nbinom1()`, `truncated_nbinom2()`, `delta_gamma()`, `delta_lognormal()`, `delta_beta()`, and more... All have `link` arguments See `?sdmTMB::Families` --- <!-- These are exported dimensions from Powerpoint * 80% --> .center[ <img src="images/family_diagram.png" width="800px" height = "450px"/> *New distributions continue to be added ] --- # An aside on the Tweedie .small[ Useful for positive continuous data with zeros (e.g., biomass density per unit effort) Dispersion ( `\(\phi\)` ) and power ( `\(p\)` ) parameters allow for a wide variety of shapes including many zeros Also known as compound Poisson-Gamma distribution ] <img src="06-families_files/figure-html/sim-tweedie-1.png" width="400px" style="display: block; margin: auto;" /> --- # Delta models * Delta/hurdle model has 2 sub-models: - presence/absence (binomial, logit link) - positive model (link varies by family) * `family` argument to sdmTMB can be a list() - for convenience, many delta- families implemented: `delta_gamma`, `delta_lognormal`, `delta_truncated_nbinom2` etc --- # Delta models * Some arguments can be a list, e.g. ```r fit <- sdmTMB( list( density ~ 1, density ~ depth ), spatial = list('on', 'off'), spatiotemporal = list('off', 'ar1'), share_range = list(TRUE, FALSE), ... ) ``` * by default, all arguments shared * rest of arguments must be shared * smoothers and random intercepts must be shared --- # An aside on mixture models Positive components may be modeled as a mixture of 2 distributions * Finite mixture model (2 components) * Also referred to as "ECE" (extreme catch event) model, Thorson et al. (2012) * Mechanisms: shoaling, etc. * See `gamma_mix()` and `lognormal_mix()` * Can be delta model as `delta_gamma_mix()` and `delta_lognormal_mix()` --- # SDMs with presence-only data Infinitely Weighted Logistic Regression (IWLR) * [Fithian & Hastie (2013)](https://doi.org/10.1214/13-AOAS667) Downweighted Poisson Regression (DWPR) * [Renner et al. 2015](https://doi.org/10.1111/2041-210X.12352) Code examples with sdmTMB [here](https://github.com/pbs-assess/sdmTMB/blob/main/scratch/julia-vignettes/presence_absence.Rmd)