ocbe-uio / TruncExpFam

R package to generate data related to the Truncated Exponential Family
https://ocbe-uio.github.io/TruncExpFam/
GNU General Public License v3.0
0 stars 1 forks source link

dtrunc() uses eta as argument instead of distribution parameters #79

Closed rho62 closed 1 year ago

rho62 commented 2 years ago

The truncated sampling functions names are on the form "rtruncXXXX" - Fine! The truncated density functions are however on the form "dtrunc.trunc_XXXX" eg. dtrunc.trunc_gamma. To be consistent and to conform with the base R, I suggest that all density functions are named on the form "dtruncXXXX"

Note the dtruncXXXX are also used in rtruncXXX for the discrete distributions. See #77

wleoncio commented 2 years ago

There are already aliases in place for the dtrunc family, so the user can simply call dtrunc*. The dtrunc.trunc_* functions are for internal use only (i.e. for dispatching from the generic dtrunc() function). See example below:

bilde

The difference between dtrunc* and d* is that the former takes y and eta as arguments, whereas the latter uses x and whatever the parameteres of the original distribution are. Should we worry about aligning those?

wleoncio commented 2 years ago

For the record, dtrunc() can also be called directly if y was generated from rtrunc(). See image below, taken directly from example(dtrunc):

bilde

wleoncio commented 2 years ago

dtrunc() is implemented, but the argument conformity is enough to keep this open. I'll just change the title accordingly.

wleoncio commented 2 years ago

Retrieving original parameters

bilde

Use natural2parameters() for conversion. Try to change the function in a way that the user can call dtrunc() with either the original parameters or the natural ones. If that is too hard, it should be preferred to call with the original parameters.