David L Miller

- Calculate
*average detection probability*- using detection function (\( g(x) \))

- \( \hat{p} = \int_0^w \frac{1}{w} g(x; \hat{\theta}) dx \)
- \( \frac{1}{w} \) tells us about assumed density wrt line
*uniform*from the line (out to \( w \))

- Model drop-off using a
*detection function* - Use extra information estimate \( \hat{N} \)
- How should we adjust \( n \)? (inflate by \( n/\hat{p}) \))

- Using the package
`Distance`

- Need to have data setup a certain way
- At least columns called
`object`

,`distance`

- At least columns called

```
library(Distance)
df_hn <- ds(distdata, truncation=6000, adjustment = NULL)
```

```
summary(df_hn)
```

```
Summary for distance analysis
Number of observations : 132
Distance range : 0 - 6000
Model : Half-normal key function
AIC : 2252.06
Detection function parameters
Scale Coefficients:
estimate se
(Intercept) 7.900732 0.07884776
Estimate SE CV
Average p 0.5490484 0.03662569 0.06670757
N in covered region 240.4159539 21.32287580 0.08869160
```

```
plot(df_hn)
```

Here we'll look at:

- Model checking and selection
- What else affects detection?
- Estimating abundance and uncertainty
- More R!

- AIC best model can still be a terrible model
- AIC only measures
**relative**fit - Don't know if the model gives “sensible” answers

- Convergence
- Fitting ended, but our model is not good

- Monotonicity
- Our model is “lumpy”

- “Goodness of fit”
- Our model sucks statistically

- (Other sampling assumptions are also important!)

`Distance`

will warn you about this:

```
** Warning: Problems with fitting model. Did not converge**
Error in detfct.fit.opt(ddfobj, optim.options, bounds, misc.options) :
No convergence.
```

This can be complicated, see `?"mrds-opt"`

for info.

- Only a problem with adjustments
`check.mono`

can help

```
check.mono(df_hr$ddf)
```

```
[1] TRUE
```