Making this a draft PR so you can see what I meant in #103
new functions
add methods eval_transform(dist, at), eval_inverse(dist, at) and eval_deriv(dist, at) which given a distribution object evaluate the corresponding transformation, inverse transformation or jacobian at the values in the at vector
these currently return the same as vec_data(dist)[[1]]['transform'] etc for a signle distribution, but could also be applied to a distribution vector. Their output format matches that of density(dist, at), etc.
all internal calls to dist"trainsform" replaced with eval_transform(dist, at), etc.
nicer to use from a user's perspective, but also potentially more future proof - any future changes to how transforms, inverses or derivatives are stored or accessed will not require changes to the core package functions such as density, etc. Rather, they will make changes in the eval_*() methods
this also makes it easier to define tests that don't need to be changed if the methods for storing, accessing or calculating these functions change
new tests
in test-utils - test that the format output of eval_*() functions is correct and matches that of the other user facing functions such as density()
expect_correct_inverse() and expect_correct_derivative() in test-transformed, test for a wide array of simple and nested transformations
I think more tests should be added, but I wanted to share this as it is now so that you can see the idea behind what I mentioned in #103
Making this a draft PR so you can see what I meant in #103
new functions
eval_transform(dist, at)
,eval_inverse(dist, at)
andeval_deriv(dist, at)
which given a distribution object evaluate the corresponding transformation, inverse transformation or jacobian at the values in theat
vectorvec_data(dist)[[1]]['transform']
etc for a signle distribution, but could also be applied to a distribution vector. Their output format matches that of density(dist, at), etc.new tests
test-utils
- test that the format output of eval_*() functions is correct and matches that of the other user facing functions such as density()expect_correct_inverse()
andexpect_correct_derivative()
in test-transformed, test for a wide array of simple and nested transformationsI think more tests should be added, but I wanted to share this as it is now so that you can see the idea behind what I mentioned in #103