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

Detection function key name not printed correctly when key = "unif" #50

Open
dfifield opened this issue Aug 3, 2023 · 2 comments
Open
Milestone

Comments

@dfifield
Copy link

dfifield commented Aug 3, 2023

Hi Distance Folks,

Thanks for all your great work!

I noticed today that if you use a detection function with a unif key in a dsm, then the key name is not printed when printing the dsm object.

Minimal example

library(Distance)
library(dsm)
data(mexdolphins)

# try two ddfs, one unif and one hn
uni.mod <- ds(distdata, key= "unif", adjustment = "cos", truncation = 6000)
hn.mod <- ds(distdata, key = "hn", adjustment = "cos", truncation = 6000)

# fit a simple smooth of x and y
dsm.uni <- dsm(count~s(x, y), uni.mod, segdata, obsdata)
dsm.hn <- dsm(count~s(x, y), hn.mod, segdata, obsdata)

# Copmare output lines starting with "Detection function : " Note that the key name is missing for the dsm with uniform key. 
dsm.uni
dsm.hn

The problem

The problem is at lines 20-22 in ddf.model.description.R - there is no case in the switch for the unif key:

 key <- switch(model$ds$aux$ddfobj$type,
                hn = "Half-normal",
                hr = "Hazard-rate")

Presumably changing it to this would fix the problem?

 key <- switch(model$ds$aux$ddfobj$type,
                hn = "Half-normal",
                hr = "Hazard-rate",
                unif = "Uniform")

Thanks!

@erex
Copy link
Member

erex commented Aug 4, 2023

Appreciate the sharp eye and the recommended solution Dave. It's on the issues list for our next revision of the dsm package.

@lenthomas lenthomas added this to the dsm 2.3.4 milestone Aug 4, 2023
@dfifield
Copy link
Author

dfifield commented Aug 4, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants