# Distance sampling: Advanced topics

David L Miller

## Recap

### Line transects - general idea

• 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$$)

### Line transects - distances

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

### Fitting detection functions

• Using the package Distance
• Need to have data setup a certain way
• At least columns called object, distance
library(Distance)
df_hn <- ds(distdata, truncation=6000, adjustment = NULL)


### Model summary

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


### Plotting models

plot(df_hn)


## New stuff

### Overview

Here we'll look at:

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

### Why check models?

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

### What to check?

• 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!)

### Convergence

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.

### Monotonicity

• Only a problem with adjustments
• check.mono can help
check.mono(df_hr\$ddf)

[1] TRUE