This document is designed to give you some pointers so that you can perform the Mark-Recapture Distance Sampling practical directly using the mrds package in R, rather than via the Distance visual interface. I assume you have some knowledge of R, the mrds package, and Distance.

This analysis is described in Borchers et al. (2005) of aerial survey data looking for seals in the Antarctic pack ice. There were four observers in the plane, two on each side (front and back).

The data from the survey has been saved in a `.csv`

file. This file can be easily read into R, and with the `checkdata()`

function, the information to construct the region, sample, and observation table can be extracted. Note that these tables are only needed when estimating abundance by scaling up from the covered region to the study area.

`library(Distance)`

```
Loading required package: mrds
Package Rsolnp (1.14) loaded. To cite, see citation("Rsolnp")
This is mrds 2.1.11
Built: R 3.1.1; ; 2014-10-08 21:38:45 UTC; unix
```

```
crabseal <- read.csv("crabbieMRDS.csv")
# Half normal detection function, 700m truncation distance,
# logit function for mark-recapture component
crab.ddf.io <- ddf(method="io", dsmodel=~cds(key="hn"),
mrmodel=~glm(link="logit", formula=~distance),
data=crabseal, meta.data=list(width=700))
summary(crab.ddf.io)
```

```
Summary for io.fi object
Number of observations : 1740
Number seen by primary : 1394
Number seen by secondary : 1471
Number seen by both : 1125
AIC : 3011
Conditional detection function parameters:
estimate se
(Intercept) 2.107762 0.0994391
distance -0.003088 0.0003159
Estimate SE CV
Average primary p(0) 0.8917 0.009606 0.010774
Average secondary p(0) 0.8917 0.009606 0.010774
Average combined p(0) 0.9883 0.002082 0.002106
Summary for ds object
Number of observations : 1740
Distance range : 0 - 700
AIC : 22314
Detection function:
Half-normal key function
Detection function parameters
Scale Coefficients:
estimate se
(Intercept) 5.829 0.02686
Estimate SE CV
Average p 0.5846 0.01248 0.02135
Summary for io object
Total AIC value : 25326
Estimate SE CV
Average p 0.5777 0.01239 0.02145
N in covered region 3011.8139 79.84198 0.02651
```

Goodness of fit could be examined in the same manner as the golf tees by the use of `ddf.gof(crab.ddf.io)`

but I have not shown this step.

Following model criticism and selection, estimation of abundance ensues. the estimates of abundance for the study area are arbitrary because inference of the study was restricted to the covered region. Hence the estimates of abundance here are artificial, but if we wished to produce them, we would need to produce the region, sample, and observation tables and apply Horvitz-Thompson like estimators to produce estimates of \(\hat{N}\). The use of `covert.units`

adjusts the units of perpendicular distance measurement (m) to units of transect effort (km). Be sure to perform the conversion correctly or your abundance estimates will be off by orders of magnitude.

```
tables <- Distance:::checkdata(crabseal)
crab.ddf.io.abund <- dht(region=tables$region.table, sample=tables$sample.table, obs=tables$obs.table,
model=crab.ddf.io, se=TRUE, options=list(convert.units=0.001))
print(crab.ddf.io.abund)
```

```
Summary for clusters
Summary statistics:
Region Area CoveredArea Effort n k ER se.ER cv.ER
1 1 1000000 8594 6139 1740 118 0.2835 0.02591 0.0914
Abundance:
Label Estimate se cv lcl ucl df
1 Total 350452 32903 0.09389 291165 421811 130.2
Density:
Label Estimate se cv lcl ucl df
1 Total 0.3505 0.0329 0.09389 0.2912 0.4218 130.2
Summary for individuals
Summary statistics:
Region Area CoveredArea Effort n ER se.ER cv.ER mean.size
1 1 1000000 8594 6139 2053 0.3344 0.03254 0.09731 1.18
se.mean
1 0.01274
Abundance:
Label Estimate se cv lcl ucl df
1 Total 413493 41201 0.09964 339671 503360 128.6
Density:
Label Estimate se cv lcl ucl df
1 Total 0.4135 0.0412 0.09964 0.3397 0.5034 128.6
Expected cluster size
Region Expected.S se.Expected.S cv.Expected.S
1 Total 1.18 0.02002 0.01697
2 Total 1.18 0.02002 0.01697
```

Borchers, D. L., J. L. Laake, C. Southwell, and C. G. M. Paxton. 2005. “Accommodating Unmodeled Heterogeneity in Double-Observer Distance Sampling Surveys.” *Biometrics* 62 (2). Wiley-Blackwell: 372–78. doi:10.1111/j.1541-0420.2005.00493.x.