-
Notifications
You must be signed in to change notification settings - Fork 1
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
Constrain "trunc_" classes to output of rtrunc()
#97
Comments
The goal is to remove any direct call of methods. The generics should always be called, even within the code. |
To simplify the issue, these are the generics that are affected and need intervention:
All other generics are a function of |
Ok, so I tried the first idea of adding The idea of reimplementing classes also feels strange right now: R6 would introduce a dependency just for the sake of refactoring. RC would solve this, but then again, now I think using OOP would require unnecessary major restructuring, since each distribution would be a subclass of the truncated family, and perhaps the same things for the parameters. Since the regular parameters are already written as attributes of the sample (
|
* issue-97: Minor fix to parameter passing (#97) Increment version number to 1.0.1.9008
Me again
Can we make it tuesday at 11am instead?
/René
…________________________________
Fra: Waldir Leoncio ***@***.***>
Sendt: onsdag 8. november 2023 14:11:31
Til: ocbe-uio/TruncExpFam
Kopi: Subscribed
Emne: Re: [ocbe-uio/TruncExpFam] Constrain "trunc_" classes to output of `rtrunc()` (Issue #97)
Ok, so I tried the first idea of adding y to the generics, and it just breaks everything, so I don't think that's something worth spending much time on.
The idea of reimplementing classes also feels strange right now: R6 would introduce a dependency just for the sake of refactoring. RC would solve this, but then again, now I think using OOP would require unnecessary major restructuring, since each distribution would be a subclass of the truncated family, and perhaps the same things for the parameters.
Since the regular parameters are already written as attributes of the sample (y), what makes most sense to me right now is to just
* add eta as attribute of y
* replace y for eta/parm as the argument on parameters2natural()
* replace y for eta/parm as the argument on natural2parameters()
* replace y for eta/parm as the argument on getGradETinv()
—
Reply to this email directly, view it on GitHub<#97 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFPRUPVOM7RLNLWZL4JLVODYDOAIHAVCNFSM6AAAAAASPSTQW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBRHA3DIOBQHE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
New idea, much cleaner than the suggestion above: There's no reason for |
Several generic functions on https://github.com/ocbe-uio/TruncExpFam/blob/36c134f038f770fa641d57786c8f9ee73330af8a/R/genericFunctions.R dispatch to
trunc_
-class object, and yet they have arguments likeeta
, which has a different structure than the output ofrtrunc()
so it arguably shouldn't be the same class.One solution would be to require these functions to also have a
y
argument, whose purpose would just be to retrieve its class for dispatching.Another solution would be to refactor the whole package to use RC or R6. This would make the
rtrunc_
class a lot better structured, but breaks parallelism with thestats
functions, because the syntax to call methods would be different.Connected to the first idea, perhaps
eta
can be instead added as an attribute ofy
, so that onlyy
is passed to the generic andeta
is retrieved from it. The same would have to be done with theparms
argument, but in this case the attribute must not conflict with the real-parameter attribute created during thertrunc()
call.The text was updated successfully, but these errors were encountered: