alexpghayes / distributions3

Probability Distributions as S3 Objects
https://alexpghayes.github.io/distributions3/
Other
100 stars 16 forks source link

Small fixes & improvements #99

Closed zeileis closed 10 months ago

zeileis commented 10 months ago

I noticed that some quantile() and random() methods for certain distributions don't pass on the distribution vector as intended. This typically looked something like this:

quantile.dist <- function(x, probs, drop = TRUE, elementwise = NULL, ...) {
  FUN <- function(at, d) qdist(at, par = x$par, ...)
  apply_dpqr(d = x, FUN = FUN, at = probs, type = "quantile", drop = drop, elementwise = elementwise)
}

Note that x$par is passed on in FUN(at, d) rather than d$par. This never leads to any problems, though, because through lexical scoping the correct distribution vector is found nevertheless. But to employ standard scoping, I changed all of the occurrences to d$par for a number of distributions.

Finally, I made a small improvement in the ?Exponential documentation which addresses the "Lost braces" NOTE we get in the current CRAN checks.

zeileis commented 10 months ago

Re: Automatic checks. So far only one check flavor was successful and the others either failed or are still queued. The failures look like problems in the GitHub Action and not like problems in the actual check. So just fyi: I ran checks locally on my machine with R-release and R-devel, both of which were successful.

alexpghayes commented 10 months ago

Will take a look in the next few days, feel free to ping if you need me to move faster!

On Tue, Jan 23, 2024 at 7:50 AM Achim Zeileis @.***> wrote:

Re: Automatic checks. So far only one check flavor was successful and the others either failed or are still queued. The failures look like problems in the GitHub Action and not like problems in the actual check. So just fyi: I ran checks locally on my machine with R-release and R-devel, both of which were successful.

— Reply to this email directly, view it on GitHub https://github.com/alexpghayes/distributions3/pull/99#issuecomment-1906101660, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTBG26W45GNBAQNPZ4LS7DYP6523AVCNFSM6AAAAABCGW7PGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBWGEYDCNRWGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

zeileis commented 10 months ago

No worries, thanks for the quick feedback!

P.S.: In the next weeks, I'll also try to have a go at some alternative parameterizations for certain distributions (discussed in https://github.com/alexpghayes/distributions3/issues/7 and https://github.com/alexpghayes/distributions3/issues/20). We already have that for the NegativeBinomial but I'll try to add Beta, Exponential, Gamma, and Normal if I get round to it.