### Overview

• What is a GAM?
• What is smoothing?
• How do GAMs work?
• Fitting GAMs using dsm

## What is a GAM?

### "gam"

1. Collective noun used to refer to a group of whales, or rarely also of porpoises; a pod.
2. (by extension) A social gathering of whalers (whaling ships).

(via Natalie Kelly, AAD. Seen in Moby Dick.)

• Generalized: many response distributions
• Models: well, it's a model…

### What does a model look like?

• Count $$n_j$$ distributed according to some count distribution
• Model as sum of terms

### Mathematically...

Taking the previous example…

$n_j = \color{red}{A_j}\color{blue}{\hat{p}_j} \color{green}{\exp}\left[\color{grey}{ \beta_0 + s(\text{y}_j) + s(\text{Depth}_j)} \right] + \epsilon_j$

where $$\epsilon_j \sim N(0, \sigma^2)$$, $$\quad n_j\sim$$ count distribution

• $$\color{red}{\text{area of segment - offset}}$$
• $$\color{blue}{\text{probability of detection in segment}}$$
• $$\color{green}{\text{link function}}$$
• $$\color{grey}{\text{model terms}}$$

### Response

$\color{red}{n_j} = A_j\hat{p}_j \exp\left[ \beta_0 + s(\text{y}_j) + s(\text{Depth}_j) \right] + \epsilon_j$
where $$\epsilon_j \sim N(0, \sigma^2)$$, $$\quad \color{red}{n_j\sim \text{count distribution}}$$