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

harmonize returned values for lambda #27

Closed
wpetry opened this issue Jun 24, 2021 · 2 comments
Closed

harmonize returned values for lambda #27

wpetry opened this issue Jun 24, 2021 · 2 comments
Assignees
Labels
almost bug not quite bugs, but not what you expect either

Comments

@wpetry
Copy link

wpetry commented Jun 24, 2021

I find it confusing that lambda returns λ when type_lambda = 'all' and type_lambda = 'last', but returns log(λ) for type_lambda = 'stochastic'. I suggest adding a logical argument log that allows the user to toggle between these scales. Given the function name lambda, I think it would be most natural to set log = FALSE as the default.

@levisc8 levisc8 self-assigned this Jul 12, 2021
@levisc8 levisc8 added the almost bug not quite bugs, but not what you expect either label Jul 12, 2021
@levisc8
Copy link
Collaborator

levisc8 commented Jul 12, 2021

Hi @wpetry - I thought it was pretty standard to use log lambda for stochastic models. Is that not the case?

Would mean(n_t_1/n_t) as the default for stochastic lambda make more sense then?

@wpetry
Copy link
Author

wpetry commented Jul 12, 2021

You're right about standard usage of the log scale. It just surprised me that the same function returned values a different scale by default. I think I'm tying the function name, lambda, to the linear scale (vs. log_lambda). Moreover, it's not always easy to immediately identify the scale based on the returned value (e.g., log(2.5)=0.92).

I see three options:

  1. prioritize standard usage: this is the current behaviour
  2. prioritize consistency: always report lambda on the linear scale (here, log_lambda could optionally be added as a function that wraps lambda)
  3. prioritize explicit choice: add a boolean argument for log that defaults to TRUE if stochastic model, else FALSE (i.e., mirroring the current behaviour). However, when log = TRUE by default, return an informative warning: log lambda is returned for stochastic models; set 'log = FALSE' for lambda on linear scale. This preserves the existing behaviour, but gives the user more information about how to interpret the output. The warning could be suppressed simply by explicitly setting the log argument.

I like option 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
almost bug not quite bugs, but not what you expect either
Projects
None yet
Development

No branches or pull requests

2 participants