Learn R Programming

mrds - Mark-Recapture Distance Sampling

What is mrds?

This package for R analyzes single or double observer distance sampling data for line or point sampling. It is used in program DISTANCE as one of the analysis engines. Supported double observer configurations include independent, trial and removal. Not all options in mrds are fully supported via DISTANCE.

If you only wish to perform a conventional or multiple covariate distance sampling analysis (CDS/MCDS) (as opposed to a double observer analysis), you may want to try the Distance R package, which has a simplified interface and is available from https://github.com/DistanceDevelopment/Distance.

Getting mrds

The easiest way to ensure you have the latest version of mrds, is to install using the remotes package:

  install.packages("remotes")

then install mrds from github:

  library(remotes)
  install_github("DistanceDevelopment/mrds")

Otherwise:

  • One can download a Windows package binary using the "Releases" tab in github. To install in R, from the R menu, use "Packages\Install from Local Zip file" and browse to location of downloaded zip.
  • Or, download package source files.
  • Finally the current stable version of mrds is available on CRAN, though this may be up to a month out of date due to CRAN policy.

References

The following are references for the methods used in the package.

Burt, M. L., D. L. Borchers, K. J. Jenkins and T. A. Marques. (2014). "Using mark-recapture distance sampling methods on line transect surveys." Methods in Ecology and Evolution 5: 1180-1191.

Buckland, S. T., J. Laake, et al. (2010). "Double observer line transect methods: levels of independence." Biometrics 66: 169-177.

Borchers, D. L., J. L. Laake, et al. (2006). "Accommodating unmodeled heterogeneity in double-observer distance sampling surveys." Biometrics 62(2): 372-378.

Buckland, S. T., D. R. Anderson, et al., Eds. (2004). Advanced distance sampling: estimating abundance of biological populations. Oxford, UK; New York, Oxford University Press. (see chapter 6).

Copy Link

Version

Install

install.packages('mrds')

Monthly Downloads

1,385

Version

3.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Laura Marshall

Last Published

July 5th, 2025

Functions in mrds (3.0.1)

assign.default.values

Assign default values to list elements that have not been already assigned
calc.se.Np

Find se of average p and N
cdf.ds

Cumulative distribution function (cdf) for fitted distance sampling detection function
book.tee.data

Golf tee data used in chapter 6 of Advanced Distance Sampling examples
create.bins

Create bins from a set of binned distances and a set of cutpoints.
assign.par

Extraction and assignment of parameters to vector
covered.region.dht

Covered region estimate of abundance from Horvitz-Thompson-like estimator
check.bounds

Check parameters bounds during optimisations
check.mono

Check that a detection function is monotone
create.command.file

create.command.file
ddf.rem.fi

Mark-Recapture Distance Sampling (MRDS) Removal - FI
ddf.trial

Mark-Recapture Distance Sampling (MRDS) Trial Configuration - PI
coef.ds

Extract coefficients
create.ddfobj

Create detection function object
ddf.gof

Goodness of fit tests for distance sampling models
cds

CDS function definition
ddf

Distance Detection Function Fitting
det.tables

Observation detection tables
flnl.grad

Gradient of the negative log likelihood function
ddf.ds

CDS/MCDS Distance Detection Function Fitting
g0

Compute value of p(0) using a logit formulation
detfct.fit.opt

Fit detection function using key-adjustment functions
create.model.frame

Create a model frame for ddf fitting
compute.Nht

Horvitz-Thompson estimates 1/p_i or s_i/p_i
dht.se

Variance and confidence intervals for density and abundance estimates
dht

Density and abundance estimates and variances
ddf.rem

Mark-Recapture Distance Sampling (MRDS) Removal - PI
detfct.fit

Fit detection function using key-adjustment functions
integratelogistic.analytic

Analytically integrate logistic detection function
ddf.trial.fi

Mark-Recapture Analysis of Trial Configuration - FI
ddf.io.fi

Mark-Recapture Distance Sampling (MRDS) IO - FI
ddf.io

Mark-Recapture Distance Sampling (MRDS) IO - PI
logLik.ddf

log-likelihood value for a fitted detection function
pdot.dsr.integrate.logistic

Compute probability that a object was detected by at least one observer
flt.var

Hessian computation for fitted distance detection function model parameters
dht.deriv

Computes abundance estimates at specified parameter values using Horvitz-Thompson-like estimator
create.varstructure

Creates structures needed to compute abundance and variance
lfgcwa

Golden-cheeked warbler mark-recapture distance sampling analysis
getpar

Extraction and assignment of parameters to vector
keyfct.th1

Threshold key function
MCDS.exe

Run MCDS.exe as a backend for mrds
keyfct.th2

Threshold key function
mcds

MCDS function definition
integratepdf

Numerically integrate pdf of observed distances over specified ranges
flnl

Log-likelihood computation for distance sampling data
plot.ds

Plot fit of detection functions and histograms of data from distance sampling model
plot.io

Plot fit of detection functions and histograms of data from distance sampling independent observer (io) model
flnl.constr.grad.neg

(Negative) gradients of constraint function
keyfct.grad.hn

The gradient of the half-normal key function
integratepdf.grad

Numerically integrates the non-normalised pdf or the detection function of observed distances over specified ranges.
parse.optimx

Parse optimx results and present a nice object
p.dist.table

Distribution of probabilities of detection
distpdf

Detection functions
gstdint

Integral of pdf of distances
keyfct.grad.hz

The gradient of the hazard-rate key function
gof.ds

Compute chi-square goodness-of-fit test for ds models
io.glm

Iterative offset GLM/GAM for fitting detection function
plot.det.tables

Observation detection tables
logisticdupbyx_fast

Logistic for duplicates as a function of covariates (fast)
plot_layout

Layout for plot methods in mrds
print.summary.trial

Print summary of distance detection function model object
logit

Logit function
print.summary.rem.fi

Print summary of distance detection function model object
plot_uncond

Plot unconditional detection function from distance sampling model
ptdata.single

Simulated single observer point count data
qqplot.ddf

Quantile-quantile plot and goodness of fit tests for detection functions
setcov

Creates design matrix for covariates in detection function
distpdf.grad

Gradient of the non-normalised pdf of distances or the detection function for the distances.
histline

Plot histogram line
integratedetfct.logistic

Integrate a logistic detection function
ds.function

Distance Sampling Functions
keyfct.tpn

Two-part normal key function
nlminb_wrapper

Wrapper around nlminb
logisticdetfct

Logistic detection function
logisticdupbyx

Logistic for duplicates as a function of covariates
mrds_opt

Tips on optimisation issues in mrds models
mrds-package

Mark-Recapture Distance Sampling (mrds)
p.det

Double-platform detection probability
print.p_dist_table

Print distribution of probabilities of detection
plot.trial

Plot fit of detection functions and histograms of data from distance sampling trial observer model
print.ddf

Simple pretty printer for distance sampling analyses
predict.ds

Predictions from mrds models
print.ddf.gof

Prints results of goodness of fit tests for detection functions
lfbcvi

Black-capped vireo mark-recapture distance sampling analysis
print.summary.trial.fi

Print summary of distance detection function model object
plot.trial.fi

Plot fit of detection functions and histograms of data from distance sampling trial observer model
plot.rem.fi

Plot fit of detection functions and histograms of data from removal distance sampling model
print.dht

Prints density and abundance estimates
plot.io.fi

Plot fit of detection functions and histograms of data from distance sampling independent observer model with full independence (io.fi)
ptdata.dual

Simulated dual observer point count data
print.det.tables

Print results of observer detection tables
prob.se

Average p and average p(0) variance
setbounds

Set parameter bounds
sample_ddf

Generate data from a fitted detection function and refit the model
process.data

Process data for fitting distance sampling detection function
summary.rem.fi

Summary of distance detection function model object
plot.rem

Plot fit of detection functions and histograms of data from removal distance sampling model
prob.deriv

Derivatives for variance of average p and average p(0) variance
setinitial.ds

Set initial values for detection function based on distance sampling
summary.trial.fi

Summary of distance detection function model object
survey.region.dht

Extrapolate Horvitz-Thompson abundance estimates to entire surveyed region
stake78

Wooden stake data from 1978 survey
stake77

Wooden stake data from 1977 survey
ptdata.removal

Simulated removal observer point count data
summary.trial

Summary of distance detection function model object
plot_cond

Plot conditional detection function from distance sampling model
print.summary.ds

Print summary of distance detection function model object
sim.mix

Simulation of distance sampling data via mixture models Allows one to simulate line transect distance sampling data using a mixture of half-normal detection functions.
solvecov

Invert of covariance matrices
print.summary.io

Print summary of distance detection function model object
summary.io

Summary of distance detection function model object
summary.ds

Summary of distance detection function model object
summary.io.fi

Summary of distance detection function model object
logisticbyx

Logistic as a function of covariates
is.logistic.constant

Is a logit model constant for all observations?
logisticbyz

Logistic as a function of distance
print.summary.io.fi

Print summary of distance detection function model object
print.summary.rem

Print summary of distance detection function model object
summary.rem

Summary of distance detection function model object
is.linear.logistic

Collection of functions for logistic detection functions
pronghorn

Pronghorn aerial survey data from Wyoming
ptdata.distance

Single observer point count data example from Distance
rem.glm

Iterative offset model fitting of mark-recapture with removal model
rescale_pars

Calculate the parameter rescaling for parameters associated with covariates
test.breaks

Test validity for histogram breaks(cutpoints)
varn

Compute empirical variance of encounter rate
adj.check.order

Check order of adjustment terms
add.df.covar.line

Add covariate levels detection function plots
AIC.ddf

Akaike's An Information Criterion for detection functions
adj.series.grad.cos

Series of the gradient of the cosine adjustment series w.r.t. the scaled distance.
adj.cos

Cosine adjustment term, not the series.
adj.series.grad.herm

Series of the gradient of the Hermite polynomial adjustment series w.r.t. the scaled distance.
adj.herm

Hermite polynomial adjustment term, not the series.
adj.poly

Simple polynomial adjustment term, not the series.
apex.gamma

Get the apex for a gamma detection function
adj.series.grad.poly

Series of the gradient of the simple polynomial adjustment series w.r.t. the scaled distance.
NCovered

Compute estimated abundance in covered (sampled) region
average.line

Average detection function line for plotting
DeltaMethod

Numeric Delta Method approximation for the variance-covariance matrix
average.line.cond

Average conditional detection function line for plotting