Skip to content

Commit

Permalink
enable setting se arg to dht() to turn off calculation of uncertainty
Browse files Browse the repository at this point in the history
(for bootdht) addresses #44
  • Loading branch information
David Lawrence Miller committed Jun 30, 2021
1 parent 93ea9d8 commit 549cbba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions R/ds.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#' @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 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.
#' @param dht.se should uncertainty be calculated when using `dht`? Safe to leave as `TRUE`, used in `bootdht`.
#' @return a list with elements:
#' * `ddf` a detection function model object.
#' * `dht` abundance/density information (if survey region data was supplied,
Expand Down Expand Up @@ -293,7 +294,7 @@ ds <- function(data, truncation=ifelse(is.null(cutpoints),
region.table=NULL, sample.table=NULL, obs.table=NULL,
convert.units=1, er.var=ifelse(transect=="line", "R2", "P3"),
method="nlminb", quiet=FALSE, debug.level=0,
initial.values=NULL, max.adjustments=5, er.method=2){
initial.values=NULL, max.adjustments=5, er.method=2, dht.se=TRUE){

# capture the call
this_call <- match.call(expand.dots = FALSE)
Expand Down Expand Up @@ -707,7 +708,7 @@ ds <- function(data, truncation=ifelse(is.null(cutpoints),
dht.res <- NULL
}else{
dht.res <- dht(model, region.table, sample.table,
options=dht_options, se=TRUE)
options=dht_options, se=dht.se)
}
}else{
message("No obs.table supplied nor does data have Region.Label and Sample.Label columns, only estimating detection function.\n")
Expand All @@ -726,7 +727,7 @@ ds <- function(data, truncation=ifelse(is.null(cutpoints),
dht.res <- NULL
}else{
dht.res <- dht(model, region.table, sample.table, obs.table,
options=dht_options, se=TRUE)
options=dht_options, se=dht.se)
}
}
}else{
Expand Down
5 changes: 4 additions & 1 deletion man/ds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 549cbba

Please sign in to comment.