Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ds produces density estimates of zero #165

Open
erex opened this issue Mar 31, 2023 · 1 comment
Open

ds produces density estimates of zero #165

erex opened this issue Mar 31, 2023 · 1 comment
Assignees

Comments

@erex
Copy link
Member

erex commented Mar 31, 2023

Question from the list about output for density and abundance being zero.

Seems this is caused by the object field being a character string rather than a number. Perhaps code could be more robust to this.

minimum reproducible example

library(Distance)
data(wren_lt)
wren_lt$object <- paste0(wren_lt$Region.Label, wren_lt$object)
tst <- ds(wren_lt)
summary(tst)
Summary for distance analysis 
Number of observations :  156 
Distance range         :  0  -  100 

Model : Half-normal key function with cosine adjustment term of order 2 

Strict monotonicity constraints were enforced.
AIC   : 1417.611 

Detection function parameters
Scale coefficient(s):  
            estimate        se
(Intercept) 4.072296 0.1247543

Adjustment term coefficient(s):  
                estimate        se
cos, order 2 -0.06852801 0.1282726

                       Estimate         SE        CV
Average p             0.7210344  0.1120697 0.1554291
N in covered region 216.3558470 34.8503833 0.1610790

Summary statistics:
    Region Area CoveredArea Effort n  k ER se.ER cv.ER
1 Montrave 33.2        1932   9.66 0 19  0     0     0

Abundance:
  Label Estimate se cv lcl ucl df
1 Total        0  0  0   0   0 18

Density:
  Label Estimate se cv lcl ucl df
1 Total        0  0  0   0   0 18

Remedy:

Check if the object field is.numeric otherwise, fail gracefully.

@lenthomas lenthomas added the triage New items to look at and decide what to do label Apr 4, 2023
@LHMarshall
Copy link
Member

Also an issue in mrds... but only an issue at the dht stage - model can be fitted ok. Will need to fail gracefully in mrds and catch it in Distance and only return the ddf part.

data(book.tee.data)
region <- book.tee.data$book.tee.region
egdata <- book.tee.data$book.tee.dataframe
egdata$object <- paste0("A", egdata$object)
samples <- book.tee.data$book.tee.samples
obs <- book.tee.data$book.tee.obs
obs$object <- paste0("A", obs$object)

result <- ddf(dsmodel=~mcds(key="hn", formula=~1), data=egdata, method="ds",
              meta.data=list(width=4))

dht(result,
    region,
    samples,
    obs)

@LHMarshall LHMarshall removed the triage New items to look at and decide what to do label Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants