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

Add left-truncation support in dpcens() #63

Open
zsusswein opened this issue Sep 11, 2024 · 1 comment
Open

Add left-truncation support in dpcens() #63

zsusswein opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@zsusswein
Copy link

zsusswein commented Sep 11, 2024

Is your feature request related to a problem? Please describe.
I frequently work with generation interval distributions and need to convert them from parametric specifications to probability mass functions. I can do some of this conversion with dpcens() but not all because dpcens() only supports right-truncation correction via D. I also need to left-truncate and renormalize my generation interval distribution PMF because the renewal equation assumes no same-day transmission so I need to truncate the lower bound of the PMF at 1 day.

Describe the solution you'd like
As suggested by @seabbs in this comment:

in some sense it could intoduce a API change (but I could handle with lifecycle) as maybe D should become D_lower and D_upperr or potentially even a 2 length vector (i.e (0, Inf) by default and then here (1, 27).

I like the 2-length vector idea. It feels clean to me.

Describe alternatives you've considered

The D_upper and D_lower argument idea would also add this functionality.

Additional context
Here's a reproducible script where I'm using dpcens() and manually applying the correction.

@seabbs
Copy link
Contributor

seabbs commented Sep 12, 2024

Thanks for this @zsusswein. I agree this makes sense for both the R and stan code.

I think I agree that the D as a vector might be the best option. This throws up some thoughts:

  • In R is length 1 allowed as this could be used to get the current behaviour?
  • In Stan this will mean appending into a array or always passing a array (of length individual delays and with length 2. This could be a hassle but maybe its not that bad?

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

No branches or pull requests

2 participants