diff --git a/DESCRIPTION b/DESCRIPTION
index 0314c3d..53d6205 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -15,8 +15,8 @@ Description: A simple way of fitting detection functions to distance sampling
supported. Abundance and density estimates can also be calculated (via a
Horvitz-Thompson-like estimator) if survey area information is provided. See
Miller et al. (2019) for more information on
- methods and for example analyses.
-Version: 2.0.0.9008
+ methods and for example analyses.
+Version: 2.0.0.9010
URL: https://github.com/DistanceDevelopment/Distance/
BugReports: https://github.com/DistanceDevelopment/Distance/issues
Language: en-GB
@@ -26,7 +26,8 @@ Depends:
Imports:
dplyr,
methods,
- rlang
+ rlang,
+ Rdpack
Suggests:
rmarkdown,
kableExtra,
@@ -45,3 +46,4 @@ Suggests:
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
+RdMacros: Rdpack
diff --git a/NAMESPACE b/NAMESPACE
index 3f6e9ca..6ecccc9 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -32,6 +32,7 @@ export(summarize_ds_models)
export(unflatten)
export(units_table)
import(mrds)
+importFrom(Rdpack,reprompt)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,all_of)
diff --git a/NEWS.md b/NEWS.md
index 9c2127d..0d8eef7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -6,6 +6,10 @@
* Truncation distances greater than the largest cutpoint value for binned data are no longer permitted as these cause fitting issues. (Issue #175)
* print.dht_result now displays estimates for groups as well as individuals by default when group size is present. (Issue #178)
+Enhancements
+
+* Warnings and documentation clarification regarding ER variance estimation when there is only a single transect. (Issue #192 and mrds Issue #115)
+
# Distance 2.0.0
* Requires mrds 3.0.0. mrds is called by ds for fitting detection functions. In mrds there has been a change of optimizer used for CDS detection functions - a constraint solver slsqp now used. This removes the need for external optimizer MCDS.exe in most cases. Other minor changes to optimization have been implemented to improve reliability (see NEWS file of mrds for more info).
@@ -26,7 +30,7 @@
# Distance 1.0.7
-* dht2 now requires the object field in flatfile formatted data. The following vignette shows how to add an object field if your data does not have already have one: https://examples.distancesampling.org/Distance-cameratraps/camera-distill.html
+* dht2 now requires the object field in flatfile formatted data. The following vignette shows how to add an object field if your data does not have already have one: https://distancesampling.org/Distance/articles/web-only/CTDS/camera-distill.html
* Fix bugs when a uniform is fitted with no adjustments
* Fixed error in dht2 when binned data used distend / distbegin
@@ -112,7 +116,7 @@
* Added lots of example data sets
* new abundance estimation via dht2! Handles more complex situations.
* bootstrap variance estimation via bootdht
-* for more examples see http://examples.distancesampling.org
+* for more examples see https://distancesampling.org/resources/vignettes.html
# Distance 0.9.8
diff --git a/R/Distance-package.R b/R/Distance-package.R
index 71ce46e..da4a923 100644
--- a/R/Distance-package.R
+++ b/R/Distance-package.R
@@ -8,7 +8,7 @@
#' necessary to use `mrds`.
#'
#' Examples of distance sampling analyses are available at
-#' .
+#' .
#'
#' For help with distance sampling and this package, there is a Google Group
#' .
@@ -72,10 +72,11 @@ NULL
#' observation.
#'
#' The example given below was provided by Eric Rexstad. Additional examples
-#' can be found at .
+#' can be found at .
#'
#' @name flatfile
#' @docType methods
+#' @importFrom Rdpack reprompt
#' @examples
#' \dontrun{
#' library(Distance)
diff --git a/R/bootdht.R b/R/bootdht.R
index 4d5c658..a926993 100644
--- a/R/bootdht.R
+++ b/R/bootdht.R
@@ -107,7 +107,7 @@
#' in to `bootdht` must be hard coded (otherwise you get back 0 successful
#' bootstraps). For a worked example showing this, see the camera trap distance
#' sampling online example at
-#' .
+#' .
#'
#' @importFrom utils txtProgressBar setTxtProgressBar getTxtProgressBar
#' @importFrom stats as.formula AIC
diff --git a/R/bootdht_Dhat_summarize.R b/R/bootdht_Dhat_summarize.R
index c1caf4d..295cecb 100644
--- a/R/bootdht_Dhat_summarize.R
+++ b/R/bootdht_Dhat_summarize.R
@@ -6,7 +6,7 @@
#' estimated density (with stratum labels).
#'
#' Further examples of such functions can be found at
-#' .
+#' .
#'
#' @param ests output from [`dht2`][dht2].
#' @param fit fitted detection function object (unused).
diff --git a/R/bootdht_Nhat_summarize.R b/R/bootdht_Nhat_summarize.R
index ebba0cd..2d78dc0 100644
--- a/R/bootdht_Nhat_summarize.R
+++ b/R/bootdht_Nhat_summarize.R
@@ -6,7 +6,7 @@
#' estimated abundance (with stratum labels).
#'
#' Further examples of such functions can be found at
-#' .
+#' .
#'
#' @param ests output from [`dht2`][dht2].
#' @param fit fitted detection function object (unused).
diff --git a/R/dht2.R b/R/dht2.R
index 4d55056..3442fea 100644
--- a/R/dht2.R
+++ b/R/dht2.R
@@ -33,17 +33,17 @@
#' @param ci_width for use with confidence interval calculation (defined as
#' 1-alpha, so the default 95 will give a 95% confidence interval).
#' @param innes logical flag for computing encounter rate variance using either
-#' the method of Innes et al (2002) where estimated abundance per transect
+#' the method of \insertCite{innes2002;textual}{mrds} where estimated abundance per transect
#' divided by effort is used as the encounter rate, vs. (when `innes=FALSE`)
-#' using the number of observations divided by the effort (as in Buckland et
-#' al., 2001)
+#' using the number of observations divided by the effort (as in \insertCite{buckland2001;nobrackets}{mrds})
#' @param total_area for options `stratification="effort_sum"` and
#' `stratification="replicate"` the area to use as the total for combined,
#' weighted final estimates.
#' @param binomial_var if we wish to estimate abundance for the covered area
#' only (i.e., study area = surveyed area) then this must be set to be
-#' `TRUE` and use the binomial variance estimator of Borchers et al.
-#' (1998). This is only valid when objects are not clustered. (This situation
+#' `TRUE` and use the negative binomial variance estimator of
+#' \insertCite{borchers1998;textual}{mrds}. This is only valid when
+#' objects are not clustered. (This situation
#' is rare.)
#' @return a `data.frame` (of class `dht_result` for pretty printing) with
#' estimates and attributes containing additional information, see "Outputs"
@@ -129,7 +129,7 @@
#' total number of animals, you should use this option.
#'
#' A simple example of using `stratification="geographical"` is given below.
-#' Further examples can be found at
+#' Further examples can be found at
#' (see, e.g., the deer pellet survey).
#'
#' @section Variance:
@@ -144,12 +144,12 @@
#' calculated is given here, though see references for more details.
#' * *detection function*: variance from the detection function parameters is
#' transformed to variance about the abundance via a sandwich estimator (see
-#' e.g., Appendix C of Borchers et al (2002)).
+#' e.g., Appendix C of \insertCite{borchers2002;textual}{Distance}).
#' * *encounter rate*: for strata with >1 transect in them, the encounter
-#' rate estimators given in Fewster et al (2009) can be specified via the
+#' rate estimators given in \insertCite{fewster2009;textual}{mrds} can be specified via the
#' `er_est` argument. If the argument `innes=TRUE` then calculations use the
#' estimated number of individuals in the transect (rather than the
-#' observed), which was give by Innes et al (2002) as a superior estimator.
+#' observed), which was given by \insertCite{innes2002;textual}{mrds} as a superior estimator.
#' When there is only one transect in a stratum, Poisson variance is assumed.
#' Information on the Fewster encounter rate variance estimators are given in
#' [`varn`][mrds::varn]
@@ -209,27 +209,7 @@
#' uncertainty in multipliers
#'
#' @references
-#'
-#' Borchers, D.L., S.T. Buckland, P.W. Goedhart, E.D. Clarke, and S.L. Hedley.
-#' 1998. Horvitz-Thompson estimators for double-platform line transect surveys.
-#' *Biometrics* 54: 1221-1237.
-#'
-#' Borchers, D.L., S.T. Buckland, and W. Zucchini. 2002 *Estimating Animal
-#' Abundance: Closed Populations*. Statistics for Biology and Health. Springer
-#' London.
-#'
-#' Buckland, S.T., E.A. Rexstad, T.A. Marques, and C.S. Oedekoven. 2015
-#' *Distance Sampling: Methods and Applications*. Methods in Statistical
-#' Ecology. Springer International Publishing.
-#'
-#' Buckland, S.T., D.R. Anderson, K. Burnham, J.L. Laake, D.L. Borchers, and L.
-#' Thomas. 2001 *Introduction to Distance Sampling: Estimating Abundance of
-#' Biological Populations*. Oxford University Press.
-#'
-#' Innes, S., M. P. Heide-Jorgensen, J.L. Laake, K.L. Laidre, H.J. Cleator, P.
-#' Richard, and R.E.A. Stewart. 2002 Surveys of belugas and narwhals in the
-#' Canadian high arctic in 1996. *NAMMCO Scientific Publications* 4, 169-190.
-#'
+#' \insertAllCited{}
#' @name dht2
#' @examples
#' \dontrun{
diff --git a/R/ds.R b/R/ds.R
index 0cf5486..6a3f16e 100644
--- a/R/ds.R
+++ b/R/ds.R
@@ -41,7 +41,7 @@
#' 1, 2, 3, ... are fitted when `adjustment = "cos"` and order 2, 4, 6, ...
#' otherwise. For `key="hn"` or `"hr"` adjustments of order 2, 3, 4, ... are
#' fitted when `adjustment = "cos"` and order 4, 6, 8, ... otherwise. See
-#' Buckland et al. (2001, p. 47) for details.
+#' \insertCite{buckland2001;textual}{mrds} p. 47 for details.
#' @param order order of adjustment terms to fit. The default value (`NULL`)
#' results in `ds` choosing the orders to use - see `nadj`. Otherwise a scalar
#' positive integer value can be used to fit a single adjustment term of the
@@ -92,11 +92,13 @@
#' @param convert_units conversion between units for abundance estimation, see
#' "Units", below. (Defaults to 1, implying all of the units are "correct"
#' already.)
-#' @param er_var encounter rate variance estimator to use when abundance
-#' estimates are required. Defaults to "R2" for line transects and "P2" for
-#' point transects (>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator
-#' by default for points). See [`dht2`][dht2] for more information and if more
-#' complex options are required.
+#' @param er_var specifies which encounter rate estimator to use in the case
+#' that dht_se is TRUE, er_method is either 1 or 2 and there are two or more
+#' samplers. Defaults to "R2" for line transects and "P2" for point transects
+#' (>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator by default
+#' for points), both of which assume random placement of transects. For
+#' systematic designs, alternative estimators may be more appropriate,
+#' see [`dht2`][dht2] for more information.
#' @param method optimization method to use (any method usable by
#' [`optim`][stats::optim] or [`optimx`][optimx::optimx]). Defaults to
#' `"nlminb"`.
@@ -112,10 +114,13 @@
#' @param max_adjustments maximum number of adjustments to try (default 5) only
#' used when `order=NULL`.
#' @param er_method encounter rate variance calculation: default = 2 gives the
-#' method of Innes et al, using expected counts in the encounter rate. Setting
+#' method of \insertCite{innes2002;textual}{mrds}, using expected counts in the encounter rate. Setting
#' to 1 gives observed counts (which matches Distance for Windows) and 0 uses
-#' binomial variance (only useful in the rare situation where study area =
-#' surveyed area). See [`dht.se`][mrds::dht.se] for more details.
+#' negative binomial variance (only useful in the rare situation where study area =
+#' surveyed area).
+#' See [`dht.se`][mrds::dht.se] for more details, noting this \code{er_method}
+#' argument corresponds to the \code{varflag} element of the \code{options}
+#' argument in \code{dht.se}.
#' @param dht_se should uncertainty be calculated when using `dht`? Safe to
#' leave as `TRUE`, used in `bootdht`.
#' @param optimizer By default this is set to 'both'. In this case
@@ -147,7 +152,7 @@
#' also be supplied. Note that stratification only applies to abundance
#' estimates and not at the detection function level. Density and abundance
#' estimates, and corresponding estimates of variance and confidence intervals,
-#' are calculated using the methods described in Buckland et al. (2001)
+#' are calculated using the methods described in \insertCite{buckland2001;textual}{mrds}
#' sections 3.6.1 and 3.7.1 (further details can be found in the documentation
#' for [`dht`][mrds::dht]).
#'
@@ -155,7 +160,7 @@
#' [`dht`][mrds::dht] and [`dht2`][dht2] functions.
#'
#' Examples of distance sampling analyses are available at
-#' .
+#' .
#'
#' Hints and tips on fitting (particularly optimisation issues) are on the
#' [`mrds_opt`][mrds::mrds_opt] manual page.
@@ -172,7 +177,7 @@
#' can often be the cause of model convergence failures. It is recommended that
#' one plots a histogram of the observed distances prior to model fitting so as
#' to get a feel for an appropriate truncation distance. (Similar arguments go
-#' for left truncation, if appropriate). Buckland et al (2001) provide
+#' for left truncation, if appropriate). \insertCite{buckland2001;textual}{mrds} provide
#' guidelines on truncation.
#'
#' When specified as a percentage, the largest `right` and smallest `left`
@@ -206,7 +211,8 @@
#' monotonicity (and is by default for detection functions without covariates).
#'
#' Monotonicity constraints are supported in a similar way to that described
-#' in Buckland et al (2001). 20 equally spaced points over the range of the
+#' in \insertCite{buckland2001;textual}{mrds}. 20 equally spaced points over
+#' the range of the
#' detection function (left to right truncation) are evaluated at each round
#' of the optimisation and the function is constrained to be either always
#' less than it's value at zero (`"weak"`) or such that each value is
@@ -265,14 +271,7 @@
#' @importFrom stats quantile as.formula
#' @importFrom methods is
#' @references
-#' Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L.,
-#' and Thomas, L. (2001). Distance Sampling. Oxford University Press. Oxford,
-#' UK.
-#'
-#' Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L.,
-#' and Thomas, L. (2004). Advanced Distance Sampling. Oxford University Press.
-#' Oxford, UK.
-#'
+#' \insertAllCited{}
#' @examples
#'
#' # An example from mrds, the golf tee data.
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 9eabe3f..dded847 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -82,12 +82,7 @@ reference:
navbar:
bg: primary
structure:
- right: [twitter, github]
- components:
- twitter:
- icon: fa-twitter
- href: https://twitter.com/distancesamp
- aria-label: Twitter
+ right: [github]
left:
- text: Function reference
href: reference/index.html
diff --git a/docs/404.html b/docs/404.html
index c362581..ea24eec 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -14,7 +14,7 @@
};
-
+
@@ -28,7 +28,7 @@
Distance
- 2.0.0.9004
+ 2.0.0.9010
-
+
Figure 1: Montrave study area; diagonal lines indicate line transects walked to generate these data.
Before creating a host of candidate models, we should address with the question of the appropriate key function for these data. Recall we are not including sightings made from the helicopter platform in our analyses.
Fitting models with half normal key function without adjustments and with and without Search.method
indicates a lack of fit of the half normal key function models. After some rounding to the trackline, the detection function maintains a shoulder before falling away quite rapidly. Even taking into consideration the idea that the sample size is very large (n=961), making the goodness of fit test quite powerful, there is some doubt that the half normal key function is appropriate for these data. We will remove the half normal from further modelling, as the hazard rate will serve our purposes, as the hazard rate without adjustments or covariates, adequately fit the data.
## ## Goodness of fit results for ddf object
@@ -314,11 +328,13 @@
Stage one of detection functi
Counteracting size bias
Conducting our modeling using the hazard rate key function, we turn our attention to incorporating group size into the detection function. The way to counteract the effect of size bias is to include group size in the detection function.
## Model contains covariate term(s): no adjustment terms will be included.
## Fitting hazard-rate key function
## AIC= 2919.357
+
## Warning: Only one sample, assuming abundance in the covered region is Poisson.
+## See help on dht.se for recommendations.
It is a disappointment to learn that a model including group size as a covariate fails to converge. There are numerical difficulties associated with a covariate that spans three orders of magnitude. For more about fitting issues with covariates, consult the covariate example with amakihi.
The distribution of group sizes is strongly skewed to the right, with a very long right tail. A transformation by natural logs will both reduce the range of log(size) to one order of magnitude and shift the centre of the distribution of the covariate (Fig. 4).
@@ -328,15 +344,22 @@
Counteracting size bias
The convergence problems associated with using size as a covariate in the detection function are alleviated as a result of the transformation.
-
+
hr.clus<-ds(nochopper, key="hr", formula =~log(size))
## Model contains covariate term(s): no adjustment terms will be included.
## Fitting hazard-rate key function
## AIC= 2904.307
+
## Warning: Only one sample, assuming abundance in the covered region is Poisson.
+## See help on dht.se for recommendations.
Having successfully incorporated group size into the detection function, we proceed to examine the consequence of using Search.method as a covariate and a model incorporating both covariates.
-
-hr.method<-ds(nochopper, key="hr", formula =~factor(Search.method))
-hr.clus.method<-ds(nochopper, key="hr", formula =~log(size)+factor(Search.method))
+
+hr.method<-ds(nochopper, key="hr", formula =~factor(Search.method))
+
## Warning: Only one sample, assuming abundance in the covered region is Poisson.
+## See help on dht.se for recommendations.
+
+hr.clus.method<-ds(nochopper, key="hr", formula =~log(size)+factor(Search.method))
+
## Warning: Only one sample, assuming abundance in the covered region is Poisson.
+## See help on dht.se for recommendations.
Table 7: Table 8: Models with hazard rate key function fitted to tuna fishing vessel sightings of dolphins. Sightings from helicopter not included in modelling.
diff --git a/docs/articles/web-only/multipliers/multipliers-distill.html b/docs/articles/web-only/multipliers/multipliers-distill.html
index 60b49e0..e620d51 100644
--- a/docs/articles/web-only/multipliers/multipliers-distill.html
+++ b/docs/articles/web-only/multipliers/multipliers-distill.html
@@ -1,14 +1,20 @@
-
+
Multipliers and indirect surveys • Distance
-
+
-
+
@@ -26,7 +32,7 @@
Distance
- 2.0.0.9005
+ 2.0.0.9009
@@ -76,7 +82,7 @@
Fit the usual series of models (i.e. half normal, hazard rate, uniform) models to the distances to pellet groups and decide on a detection function. This detection function (Figure 2) will be used to obtain \(\hat D_{\textrm{pellet groups}}\).
-deer.df<-ds(sikadeer, key="hn", truncation="10%", convert_units =conversion.factor)
-plot(deer.df, main="Half normal detection function")
## Warning: Only one sample in the following strata: F, H, J. For these strata, it
+## is assumed abundance in the covered region is Poisson. See help on dht.se.
+
+plot(deer.df, main="Half normal detection function")
Figure 2: Simple detection function to deer pellet line transect data.
## Warning in dht2(deer.df, flatfile = sikadeer, strat_formula = ~Region.Label, :## One or more strata have only one transect, cannot calculate empirical encounter## rate variance
Survey design1). Elevation of these pastures was ~2500m. We will not deal with pasture-level analysis of these data in this vignette and will alter the data to remove the strata designations.
-
+
Figure 1: Summer grazed pastures along Illinois River Arapaho National Wildlife Refuge, Colorado. Figure from (Knopf et al., 1988).
@@ -297,9 +296,6 @@
Specifying different detection
transect="point", convert_units=conversion.factor, truncation="5%")
## Warning in ddf.ds(dsmodel = dsmodel, data = data, meta.data = meta.data, :## Estimated hazard-rate scale parameter close to 0 (on log scale). Possible
-## problem in data (e.g., spike near zero distance).
-## Warning in ddf.ds(dsmodel = dsmodel, data = data, meta.data = meta.data, :
-## Estimated hazard-rate scale parameter close to 0 (on log scale). Possible## problem in data (e.g., spike near zero distance).
diff --git a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/basichist-1.png b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/basichist-1.png
index 2aa5c6a..2ee2d1d 100644
Binary files a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/basichist-1.png and b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/basichist-1.png differ
diff --git a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/gof-1.png b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/gof-1.png
index 56e6ca5..013f839 100644
Binary files a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/gof-1.png and b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/gof-1.png differ
diff --git a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/modelfit-1.png b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/modelfit-1.png
index 96107a3..35023e4 100644
Binary files a/docs/articles/web-only/points/pointtransects-distill_files/figure-html/modelfit-1.png and b/docs/articles/web-only/points/pointtransects-distill_files/figure-html/modelfit-1.png differ
diff --git a/docs/articles/web-only/points/pointtransects-distill_files/header-attrs-2.29/header-attrs.js b/docs/articles/web-only/points/pointtransects-distill_files/header-attrs-2.29/header-attrs.js
deleted file mode 100644
index dd57d92..0000000
--- a/docs/articles/web-only/points/pointtransects-distill_files/header-attrs-2.29/header-attrs.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
-// be compatible with the behavior of Pandoc < 2.8).
-document.addEventListener('DOMContentLoaded', function(e) {
- var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
- var i, h, a;
- for (i = 0; i < hs.length; i++) {
- h = hs[i];
- if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
- a = h.attributes;
- while (a.length > 0) h.removeAttribute(a[0].name);
- }
-});
diff --git a/docs/articles/web-only/strata/strata-distill.html b/docs/articles/web-only/strata/strata-distill.html
index ddd3fcc..89b987e 100644
--- a/docs/articles/web-only/strata/strata-distill.html
+++ b/docs/articles/web-only/strata/strata-distill.html
@@ -14,7 +14,7 @@
};
-
+
@@ -32,7 +32,7 @@
Distance
- 2.0.0.9005
+ 2.0.0.9009
@@ -82,7 +82,7 @@
logical flag for computing encounter rate variance using either
-the method of Innes et al (2002) where estimated abundance per transect
+the method of Innes et al. (2002)
+ where estimated abundance per transect
divided by effort is used as the encounter rate, vs. (when innes=FALSE)
-using the number of observations divided by the effort (as in Buckland et
-al., 2001)
+using the number of observations divided by the effort (as in Buckland et al. 2001
+)
if we wish to estimate abundance for the covered area
only (i.e., study area = surveyed area) then this must be set to be
-TRUE and use the binomial variance estimator of Borchers et al.
-(1998). This is only valid when objects are not clustered. (This situation
+TRUE and use the negative binomial variance estimator of
+Borchers et al. (1998)
+. This is only valid when
+objects are not clustered. (This situation
is rare.)
Borchers, D.L., S.T. Buckland, P.W. Goedhart, E.D. Clarke, and S.L. Hedley.
-1998. Horvitz-Thompson estimators for double-platform line transect surveys.
-Biometrics 54: 1221-1237.
-
Borchers, D.L., S.T. Buckland, and W. Zucchini. 2002 Estimating Animal
-Abundance: Closed Populations. Statistics for Biology and Health. Springer
-London.
-
Buckland, S.T., E.A. Rexstad, T.A. Marques, and C.S. Oedekoven. 2015
-Distance Sampling: Methods and Applications. Methods in Statistical
-Ecology. Springer International Publishing.
-
Buckland, S.T., D.R. Anderson, K. Burnham, J.L. Laake, D.L. Borchers, and L.
-Thomas. 2001 Introduction to Distance Sampling: Estimating Abundance of
-Biological Populations. Oxford University Press.
-
Innes, S., M. P. Heide-Jorgensen, J.L. Laake, K.L. Laidre, H.J. Cleator, P.
-Richard, and R.E.A. Stewart. 2002 Surveys of belugas and narwhals in the
-Canadian high arctic in 1996. NAMMCO Scientific Publications 4, 169-190.
Buckland ST, Anderson DR, Burnham KP, Laake JL, Borchers DL, Thomas L (2001).
+Introduction to distance sampling: estimating abundance of biological populations.
+Oxford university press.
Fewster RM, Buckland ST, Burnham KP, Borchers DL, Jupp PE, Laake JL, Thomas L (2009).
+“Estimating the encounter rate variance in distance sampling.”
+Biometrics, 65(1), 225-236.
Innes S, Heide-Jørgensen MP, Laake JL, Laidre KL, Cleator HJ, Richard P, Stewart RE (2002).
+“Surveys of belugas and narwhals in the Canadian High Arctic in 1996.”
+NAMMCO Scientific Publications, 4, 169-190.
encounter rate variance estimator to use when abundance
-estimates are required. Defaults to "R2" for line transects and "P2" for
-point transects (>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator
-by default for points). See dht2 for more information and if more
-complex options are required.
+
specifies which encounter rate estimator to use in the case
+that dht_se is TRUE, er_method is either 1 or 2 and there are two or more
+samplers. Defaults to "R2" for line transects and "P2" for point transects
+(>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator by default
+for points), both of which assume random placement of transects. For
+systematic designs, alternative estimators may be more appropriate,
+see dht2 for more information.
encounter rate variance calculation: default = 2 gives the
-method of Innes et al, using expected counts in the encounter rate. Setting
+method of Innes et al. (2002)
+, using expected counts in the encounter rate. Setting
to 1 gives observed counts (which matches Distance for Windows) and 0 uses
-binomial variance (only useful in the rare situation where study area =
-surveyed area). See dht.se for more details.
+negative binomial variance (only useful in the rare situation where study area =
+surveyed area).
+See dht.se for more details, noting this er_method
+argument corresponds to the varflag element of the options
+argument in dht.se.
Buckland ST, Anderson DR, Burnham KP, Laake JL, Borchers DL, Thomas L (2001).
+Introduction to distance sampling: estimating abundance of biological populations.
+Oxford university press.
Innes S, Heide-Jørgensen MP, Laake JL, Laidre KL, Cleator HJ, Richard P, Stewart RE (2002).
+“Surveys of belugas and narwhals in the Canadian High Arctic in 1996.”
+NAMMCO Scientific Publications, 4, 169-190.
diff --git a/inst/REFERENCES.bib b/inst/REFERENCES.bib
new file mode 100644
index 0000000..7aaf46d
--- /dev/null
+++ b/inst/REFERENCES.bib
@@ -0,0 +1,6 @@
+@book{borchers2002,
+ title={Estimating animal abundance: closed populations},
+ author={Borchers, D. L. and Buckland, S. T. and Zucchini, W.},
+ year={2002},
+ publisher={Springer}
+}
\ No newline at end of file
diff --git a/man/Distance-package.Rd b/man/Distance-package.Rd
index fbac46c..0e901a4 100644
--- a/man/Distance-package.Rd
+++ b/man/Distance-package.Rd
@@ -14,7 +14,7 @@ analyses (such as those involving double observer surveys) one may find it
necessary to use \code{mrds}.
Examples of distance sampling analyses are available at
-\url{http://examples.distancesampling.org/}.
+\url{https://distancesampling.org/resources/vignettes.html}.
For help with distance sampling and this package, there is a Google Group
\url{https://groups.google.com/forum/#!forum/distance-sampling}.
diff --git a/man/bootdht.Rd b/man/bootdht.Rd
index d3b57c5..6927d31 100644
--- a/man/bootdht.Rd
+++ b/man/bootdht.Rd
@@ -154,7 +154,7 @@ parallel bootstraps is that any starting values in the model object passed
in to \code{bootdht} must be hard coded (otherwise you get back 0 successful
bootstraps). For a worked example showing this, see the camera trap distance
sampling online example at
-\url{https://examples.distancesampling.org/Distance-cameratraps/camera-distill.html}.
+\url{https://distancesampling.org/Distance/articles/web-only/CTDS/camera-distill.html}.
}
\examples{
diff --git a/man/bootdht_Dhat_summarize.Rd b/man/bootdht_Dhat_summarize.Rd
index c633c0e..f3acbd2 100644
--- a/man/bootdht_Dhat_summarize.Rd
+++ b/man/bootdht_Dhat_summarize.Rd
@@ -25,7 +25,7 @@ estimated density (with stratum labels).
}
\details{
Further examples of such functions can be found at
-\url{http://examples.distancesampling.org}.
+\url{https://distancesampling.org/resources/vignettes.html}.
}
\seealso{
\code{\link{bootdht}} which this function is to be used with and
diff --git a/man/bootdht_Nhat_summarize.Rd b/man/bootdht_Nhat_summarize.Rd
index 60d6a92..effadf5 100644
--- a/man/bootdht_Nhat_summarize.Rd
+++ b/man/bootdht_Nhat_summarize.Rd
@@ -25,7 +25,7 @@ estimated abundance (with stratum labels).
}
\details{
Further examples of such functions can be found at
-\url{http://examples.distancesampling.org}.
+\url{https://distancesampling.org/resources/vignettes.html}.
}
\seealso{
\code{\link{bootdht}} which this function is to be used with and
diff --git a/man/dht2.Rd b/man/dht2.Rd
index dcaf41e..0d9590a 100644
--- a/man/dht2.Rd
+++ b/man/dht2.Rd
@@ -62,10 +62,9 @@ different for each transect).}
1-alpha, so the default 95 will give a 95\% confidence interval).}
\item{innes}{logical flag for computing encounter rate variance using either
-the method of Innes et al (2002) where estimated abundance per transect
+the method of \insertCite{innes2002;textual}{mrds} where estimated abundance per transect
divided by effort is used as the encounter rate, vs. (when \code{innes=FALSE})
-using the number of observations divided by the effort (as in Buckland et
-al., 2001)}
+using the number of observations divided by the effort (as in \insertCite{buckland2001;nobrackets}{mrds})}
\item{stratification}{what do strata represent, see "Stratification" below.}
@@ -75,8 +74,9 @@ weighted final estimates.}
\item{binomial_var}{if we wish to estimate abundance for the covered area
only (i.e., study area = surveyed area) then this must be set to be
-\code{TRUE} and use the binomial variance estimator of Borchers et al.
-(1998). This is only valid when objects are not clustered. (This situation
+\code{TRUE} and use the negative binomial variance estimator of
+\insertCite{borchers1998;textual}{mrds}. This is only valid when
+objects are not clustered. (This situation
is rare.)}
}
\value{
@@ -175,7 +175,7 @@ total number of animals, you should use this option.
}
A simple example of using \code{stratification="geographical"} is given below.
-Further examples can be found at \url{http://examples.distancesampling.org/}
+Further examples can be found at \url{https://distancesampling.org/resources/vignettes.html}
(see, e.g., the deer pellet survey).
}
@@ -193,12 +193,12 @@ calculated is given here, though see references for more details.
\itemize{
\item \emph{detection function}: variance from the detection function parameters is
transformed to variance about the abundance via a sandwich estimator (see
-e.g., Appendix C of Borchers et al (2002)).
+e.g., Appendix C of \insertCite{borchers2002;textual}{Distance}).
\item \emph{encounter rate}: for strata with >1 transect in them, the encounter
-rate estimators given in Fewster et al (2009) can be specified via the
+rate estimators given in \insertCite{fewster2009;textual}{mrds} can be specified via the
\code{er_est} argument. If the argument \code{innes=TRUE} then calculations use the
estimated number of individuals in the transect (rather than the
-observed), which was give by Innes et al (2002) as a superior estimator.
+observed), which was given by \insertCite{innes2002;textual}{mrds} as a superior estimator.
When there is only one transect in a stratum, Poisson variance is assumed.
Information on the Fewster encounter rate variance estimators are given in
\code{\link[mrds:varn]{varn}}
@@ -288,23 +288,5 @@ print(minke_dht2, report="density")
}
}
\references{
-Borchers, D.L., S.T. Buckland, P.W. Goedhart, E.D. Clarke, and S.L. Hedley.
-1998. Horvitz-Thompson estimators for double-platform line transect surveys.
-\emph{Biometrics} 54: 1221-1237.
-
-Borchers, D.L., S.T. Buckland, and W. Zucchini. 2002 \emph{Estimating Animal
-Abundance: Closed Populations}. Statistics for Biology and Health. Springer
-London.
-
-Buckland, S.T., E.A. Rexstad, T.A. Marques, and C.S. Oedekoven. 2015
-\emph{Distance Sampling: Methods and Applications}. Methods in Statistical
-Ecology. Springer International Publishing.
-
-Buckland, S.T., D.R. Anderson, K. Burnham, J.L. Laake, D.L. Borchers, and L.
-Thomas. 2001 \emph{Introduction to Distance Sampling: Estimating Abundance of
-Biological Populations}. Oxford University Press.
-
-Innes, S., M. P. Heide-Jorgensen, J.L. Laake, K.L. Laidre, H.J. Cleator, P.
-Richard, and R.E.A. Stewart. 2002 Surveys of belugas and narwhals in the
-Canadian high arctic in 1996. \emph{NAMMCO Scientific Publications} 4, 169-190.
+\insertAllCited{}
}
diff --git a/man/ds.Rd b/man/ds.Rd
index 3fe5fc2..f109313 100644
--- a/man/ds.Rd
+++ b/man/ds.Rd
@@ -87,7 +87,7 @@ on the \code{key}and \code{adjustment}. For \code{key="unif"}, adjustments of or
1, 2, 3, ... are fitted when \code{adjustment = "cos"} and order 2, 4, 6, ...
otherwise. For \code{key="hn"} or \code{"hr"} adjustments of order 2, 3, 4, ... are
fitted when \code{adjustment = "cos"} and order 4, 6, 8, ... otherwise. See
-Buckland et al. (2001, p. 47) for details.}
+\insertCite{buckland2001;textual}{mrds} p. 47 for details.}
\item{order}{order of adjustment terms to fit. The default value (\code{NULL})
results in \code{ds} choosing the orders to use - see \code{nadj}. Otherwise a scalar
@@ -154,11 +154,13 @@ produced.
"Units", below. (Defaults to 1, implying all of the units are "correct"
already.)}
-\item{er_var}{encounter rate variance estimator to use when abundance
-estimates are required. Defaults to "R2" for line transects and "P2" for
-point transects (>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator
-by default for points). See \code{\link{dht2}} for more information and if more
-complex options are required.}
+\item{er_var}{specifies which encounter rate estimator to use in the case
+that dht_se is TRUE, er_method is either 1 or 2 and there are two or more
+samplers. Defaults to "R2" for line transects and "P2" for point transects
+(>= 1.0.9, earlier versions <= 1.0.8 used the "P3" estimator by default
+for points), both of which assume random placement of transects. For
+systematic designs, alternative estimators may be more appropriate,
+see \code{\link{dht2}} for more information.}
\item{method}{optimization method to use (any method usable by
\code{\link[stats:optim]{optim}} or \code{\link[optimx:optimx]{optimx}}). Defaults to
@@ -181,10 +183,13 @@ used.}
used when \code{order=NULL}.}
\item{er_method}{encounter rate variance calculation: default = 2 gives the
-method of Innes et al, using expected counts in the encounter rate. Setting
+method of \insertCite{innes2002;textual}{mrds}, using expected counts in the encounter rate. Setting
to 1 gives observed counts (which matches Distance for Windows) and 0 uses
-binomial variance (only useful in the rare situation where study area =
-surveyed area). See \code{\link[mrds:dht.se]{dht.se}} for more details.}
+negative binomial variance (only useful in the rare situation where study area =
+surveyed area).
+See \code{\link[mrds:dht.se]{dht.se}} for more details, noting this \code{er_method}
+argument corresponds to the \code{varflag} element of the \code{options}
+argument in \code{dht.se}.}
\item{dht_se}{should uncertainty be calculated when using \code{dht}? Safe to
leave as \code{TRUE}, used in \code{bootdht}.}
@@ -239,7 +244,7 @@ and \code{sample_table} must be supplied. If \code{data} does not contain the co
also be supplied. Note that stratification only applies to abundance
estimates and not at the detection function level. Density and abundance
estimates, and corresponding estimates of variance and confidence intervals,
-are calculated using the methods described in Buckland et al. (2001)
+are calculated using the methods described in \insertCite{buckland2001;textual}{mrds}
sections 3.6.1 and 3.7.1 (further details can be found in the documentation
for \code{\link[mrds:dht]{dht}}).
@@ -247,7 +252,7 @@ For more advanced abundance/density estimation please see the
\code{\link[mrds:dht]{dht}} and \code{\link{dht2}} functions.
Examples of distance sampling analyses are available at
-\url{http://examples.distancesampling.org/}.
+\url{https://distancesampling.org/resources/vignettes.html}.
Hints and tips on fitting (particularly optimisation issues) are on the
\code{\link[mrds:mrds_opt]{mrds_opt}} manual page.
@@ -268,7 +273,7 @@ or bin end point. This is a default will not be appropriate for all data and
can often be the cause of model convergence failures. It is recommended that
one plots a histogram of the observed distances prior to model fitting so as
to get a feel for an appropriate truncation distance. (Similar arguments go
-for left truncation, if appropriate). Buckland et al (2001) provide
+for left truncation, if appropriate). \insertCite{buckland2001;textual}{mrds} provide
guidelines on truncation.
When specified as a percentage, the largest \code{right} and smallest \code{left}
@@ -306,7 +311,8 @@ lead to bias. To avoid this, the detection function can be constrained for
monotonicity (and is by default for detection functions without covariates).
Monotonicity constraints are supported in a similar way to that described
-in Buckland et al (2001). 20 equally spaced points over the range of the
+in \insertCite{buckland2001;textual}{mrds}. 20 equally spaced points over
+the range of the
detection function (left to right truncation) are evaluated at each round
of the optimisation and the function is constrained to be either always
less than it's value at zero (\code{"weak"}) or such that each value is
@@ -412,13 +418,7 @@ AIC(ds.model.cos23)
}
}
\references{
-Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L.,
-and Thomas, L. (2001). Distance Sampling. Oxford University Press. Oxford,
-UK.
-
-Buckland, S.T., Anderson, D.R., Burnham, K.P., Laake, J.L., Borchers, D.L.,
-and Thomas, L. (2004). Advanced Distance Sampling. Oxford University Press.
-Oxford, UK.
+\insertAllCited{}
}
\seealso{
\code{\link{flatfile}}, \code{\link[mrds]{AIC.ds}},
diff --git a/man/flatfile.Rd b/man/flatfile.Rd
index d968824..4ae4720 100644
--- a/man/flatfile.Rd
+++ b/man/flatfile.Rd
@@ -31,7 +31,7 @@ one \code{Region.Label} and a single corresponding \code{Area} duplicated for ea
observation.
The example given below was provided by Eric Rexstad. Additional examples
-can be found at \url{http://examples.distancesampling.org/}.
+can be found at \url{https://distancesampling.org/resources/vignettes.html}.
}
\examples{
\dontrun{
diff --git a/tests/testthat/test_golftees.R b/tests/testthat/test_golftees.R
index 514b49b..310fac4 100644
--- a/tests/testthat/test_golftees.R
+++ b/tests/testthat/test_golftees.R
@@ -51,7 +51,7 @@ context("golftees")
test_that("ER variance", {
# output using old dht
- df <- ds(gtees, truncation=trunc, key="hn", adjustment=NULL)
+ expect_warning(df <- ds(gtees, truncation=trunc, key="hn", adjustment=NULL), "Only one sample, assuming abundance in the covered region is Poisson. See help on dht.se for recommendations.")
# now do a fancy thing
dat$obs.table <- dat$obs.table[dat$obs.table$object %in% gtees$object, ]
@@ -81,7 +81,7 @@ test_that("ER variance", {
test_that("Same results as Distance", {
gtees$sex <- as.factor(gtees$sex)
gtees$sex <- relevel(gtees$sex, ref="1")
- df <- ds(gtees, truncation=trunc, key="hn", adjustment=NULL, formula=~sex)
+ expect_warning(df <- ds(gtees, truncation=trunc, key="hn", adjustment=NULL, formula=~sex), "Only one sample, assuming abundance in the covered region is Poisson. See help on dht.se for recommendations.")
fs_st1 <- expect_warning(dht2(df$ddf, dat$obs.table, dat$sample.table,
dat$region.table, strat_formula=~Region.Label,
diff --git a/tests/testthat/test_summarize.R b/tests/testthat/test_summarize.R
index aab6d94..e64c4bb 100644
--- a/tests/testthat/test_summarize.R
+++ b/tests/testthat/test_summarize.R
@@ -76,7 +76,7 @@ test_that("Passing in models via a list",{
ds.model.cos <- ds(tee.data, 4, adjustment="cos", order=2)
ds.model.hr <- ds(tee.data, 4, key = "hr", nadj = 0)
- expect_warning(test1 <- summarize_ds_models(ds.model, ds.model.cos, ds.model.hr), "Passing models via ... will be depricated in the next release, please pass models in a list using the models argument.")
+ test1 <- summarize_ds_models(ds.model, ds.model.cos, ds.model.hr)
test2 <- summarize_ds_models(models = list(ds.model, ds.model.cos, ds.model.hr))