-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Using Distance 2.0.0 and mrds 3.0.0.
The following code uses these duiker data: DaytimeDistances.txt
DuikerCameraTraps <- read.csv(file="DaytimeDistances.txt", header=TRUE, sep="\t")
DuikerCameraTraps$Area <- DuikerCameraTraps$Area / (1000*1000)
DuikerCameraTraps$object <- NA
DuikerCameraTraps$object[!is.na(DuikerCameraTraps$distance)] <- 1:sum(!is.na(DuikerCameraTraps$distance))
library(Distance)
trunc.list <- list(left = 2, right = 15)
mybreaks <- c(seq(2, 8, 1), 10, 12, 15)
conversion <- convert_units("meter", NULL, "square kilometer")
hn2 <- ds(DuikerCameraTraps, transect = "point", key = "hn", adjustment = "cos",
nadj=2, convert_units = conversion,
cutpoints = mybreaks, truncation = trunc.list)
plot(hn2)
This produces the following output:
Fitting half-normal key function with cosine(2,3) adjustments
Warning in check.mono(result, n.pts = control$mono.points) :
Detection function is greater than 1 at some distances
Warning in check.mono(result, n.pts = control$mono.points) :
Detection function is greater than 1 at some distances
AIC= 44031.553
Warning in mrds::check.mono(model, n.pts = 10) :
Detection function is greater than 1 at some distances
However, the fitted detection function looks fine:

It's possible perhaps that the issue is to do with left truncation, and that the detection function goes marginally above 1 at distances less than the left truncation distance
plot(hn2, xlim = c(0, 16))
Here is a check of that
> x <- seq(0, 1, by = 0.1)
> x
[1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
> detfct(x, hn2$ddf$ds$aux$ddfobj, width = 15, index = 1)
[1] 1.0000000 1.0000006 1.0000021 1.0000035 1.0000030 0.9999982 0.9999862 0.9999631
[9] 0.9999246 0.9998658 0.9997812
Yes, that seems to be it. I'll post as an issue and perhaps we can discuss how this arises -- perhaps the bounds within the optimizer are not the same as those in check.mono, perhaps just for left truncated data?
