-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow specifying tolerance at to dist_spec
upon definition
#724
Conversation
dist_spec
upon definition
I expect > attributes(LogNormal(1,2))
$names
[1] "parameters" "distribution"
$class
[1] "dist_spec" "list"
> attributes(LogNormal(1,2, max= 1, tolerance = 0.1))
$names
[1] "parameters" "distribution"
$class
[1] "dist_spec" "list"
$max
[1] 1
$tolerance
[1] 0.1 |
Upon further digging, I see it rather only sets them when they're finite. I think for consistency, it would probably be better to always set them and rather not use them downstream if |
I'm in two minds about this. I see your point but setting them is a way to signal that the user has not made a choice here which then allows e.g. the delay option functions to make an informed default choice when distributions are used for a specific purpose. With this in mind, does the current set up make more sense, or do you think we should try to work around a set up where these attributes are always set? |
Mmmh I think we may be thinking of the word "setting" differently here. I thought the attributes are rather set when the user makes a choice? i.e., In the case where a user sets a finite
I will trust your judgement on this. |
I agree. My point was that someone who specifies |
Oh, I see. That makes sense. |
I've updated this to be clearer, i.e. now you get > gt_opts(Gamma(shape = 2, rate = 2))
Unconstrained distributon passed as a delay. Constraining with default tolerance 0.001
- gamma distribution (tolerance: 0.001):
shape:
2
rate:
2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Description
This PR closes #533.
Doing so and paving the way for #525 required a few changes to the infrastructure of how distributions are handled. This PR:
multi_dist_spec
class representing distributions that are a convolution of multiple distributionsget_parameters()
andget_distribution()
for extracting these from single or combined distributions, andndist()
for getting the number of distributions that make up a combined distributionmax
andtolerance
attributes, with functionality to specify the tolerance either at the level of the convolved or constituent distribution(s)apply_tolerance()
tobound_dist()
as it now also applies themax
Initial submission checklist
devtools::test()
anddevtools::check()
).devtools::document()
).lintr::lint_package()
).After the initial Pull Request