Animal abundance estimation via conventional, multiple covariate and mark-recapture distance sampling (CDS/MCDS/MRDS). Detection function fitting is performed via maximum likelihood. Also included are diagnostics and plotting for fitted detection functions. Abundance estimation is via a Horvitz-Thompson-like estimator.
![Build Status](https://travis-ci.org/DistanceDevelopment/mrds.svg? branch=master) 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. All options in mrds are not yet fully supported via DISTANCE.
mrds
The easiest way to ensure you have the latest version of mrds
, is to install Hadley Wickham's devtools
package:
install.packages("devtools")
then install mrds
from github:
library(devtools)
install_github("DistanceDevelopment/mrds")
Otherwise:
mrds
is available on CRAN, though this may be up to a month out of date due to CRAN policy.The following are references for the methods used in the package.
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).
Bug in unif+cos(1) models when using monotonicity constraints and randomised starting points. Since the model only has 1 parameter, there is a bug in selecting columns in Rsolnp starting value code that makes the result be a vector, which then doesn't work with an apply later. Workaround of not using randomised starting values in mrds for that model. Thanks to Nathalie Cavada for finding this bug.
Fixed bug in pdot.dsr.integrate.logistic which was giving incorrect AIC values for FI models with binned data for points or lines.
Fixed issue where returned optimisation obejct got accessed without being checked to see if it's result was an error, causing problems when encapsulating ddf in other functions.
BUG FIXES
CHANGES
BUG FIXES
BUG FIXES
NEW FEATURES
BUG FIXES
NEW FEATURES
CHANGES
CHANGES
BUG FIXES
BUG FIX
CHANGES
CHANGES
CHANGES
CHANGES
Warning now issued when truncation is set to the largest distance by default.
updated dht documentation
CHANGES
modified det.tables and plot.det.tables so it does not create and plot some tables depending on observer configuration (io,trial,removal).
to plot functions (other than plot.ds) added argument subtitle=TRUE (default). It can be either TRUE, FALSE. If TRUE it shows sub-titles for plot type. If FALSE, no subtitles are shown. With this argument it is possible to get subtitles without main title.
set iterlimit=1 in call to rem.glm from ddf.rem.fi to prevent convergence issues in getting starting values.
created average.line.cond and it is now used in place of calcp.mrds which was computing average line for conditional detection function by weighting values by estimated population proportions for each covariate value. It is now weighted by sample proportions (mean value).
BUG FIXES
patched dht.se so if vc1=NA it will not fail
patched plot.ds to only issue dev.new when not using another graphics device so it plays nice with Distance.
BUG FIXES
patched bug in dht which was returning incorrect values in bysample for sample.area and Dhat.
patched code in dht.se so it would skip over variance component for p when key=unif and p=1.
CHANGES
modified code in detfct.fit.opt and io and rem functions to adapt to changes in optimx
removed old depends statements to optimx and Rsolnp; uses import
BUG FIXES
BUG FIXES
CHANGES
Modified flpt.lnl code to set integrals to 1E-25 if <=0
In integrate.pdf a vector argument for the integration range is converted to matrix if of length 2.
ddf.gof will now use breaks set for binned data unless others are specified.
NEW FEATURES
Added threshold detection functions ("th1" and "th2") which required some minor changes in other functions for summary/print.
Added xlab and ylab arguments to plot functions to over-ride default labels
CHANGES
NEW FEATURES
BUG FIXES
NEW FEATURES
Restructured likelihood/integration code for fitting ds models
Adjustment functions will now work with binned data. Code was added to assure that fields distbegin and distend are available if binned=TRUE and breaks are set as well.
Added argument adj.exp which if set to TRUE will use keyexp(adj) rather than keyadj to keep f(x)>0
Added following restrictions for adjustments: if uniform key, adj.scale must be "width"; if non-uniform key and adj.scale="width", doeachint set to TRUE because scale integration will not work.
Changed code in several functions so a uniform key with no adjustment functions could be used.
New option plot=TRUE/FALSE in qqplot.ddf(), for when you only want the K-S and CvM test statistics, not plotting.
BUG FIXES
Fixed inconsistencies in use and documentation of showit argument
Fixed a bug where groups were not recognised in dht() when the size column occurred in both model data and observation table. (Thanks to Darren Kidney for spotting this.)
NEW FEATURES
Example code for binned point count data added to help for ddf
Modified ddf.rem.fi and ddf.io.fi to use starting values from iterative offset glm to make optimization more robust
Added a restriction so no one attempts fitting adjustment functions with covariates.
Added some code to assure all of the necessary fields are available for binned data (binned=TRUE).
BUG FIXES
Patched create.ddfobj so that point counts with binned data would work properly
Patched ddf.ds such that stored data in object$data has detected=1
Patched ddf.io.fi to throw an error when optimx() does not converge
Patched ddf.io.fi and ddf.rem.fi so inclusion of factor(observer) will work in formula
Patched dht, dht.se and covered.region.dht so it would handle 0 observations
Suppress package messages from optimx
Patched fpt.lnl, flt.lnl, print.ddf, model.description, summary.ds, print.summary.ds and coef.io, coef.trial, coef.rem, plot.io, plot.trial, and plot.rem to handle uniform key function.
NEW FEATURES
BUG FIXES
Fixed code in dht.se such that it uses sample size from detection model in Satterthwaite approximation rather than size of selected subset of observations.
Fixed coef functions so they would return parameter estimates for adjustment functions if any.
BUG FIXES
Changed flt.var to compute variance of average p correctly for point transects.
Numerous changes by dlm to optimization code
Changes to documentation to remove non-ASCII characters
NEW FEATURES
BUG FIXES
Changes to det.tables and gof functions to use include.lowest=TRUE in calls to cut function
Changed all usage of T and F to TRUE and FALSE