-
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
Add probability and quantile functions #54
Comments
A simpler solution, supposing prtrunclnorm <- function(..., a, b) {
if (lower.tail) {
return(plnorm(q) - plnorm(a))
} else {
return(plnorm(b) - plnorm(q))
}
} And the same goes for the other distros. |
Yes, definitely a good suggestion. The only limitation I see, is if we have distributions, where the corresponing untruncated dist is not part of Base R (continuous Bernouilli, inverse Gamma)
… 18. jun. 2021 kl. 10:03 skrev Waldir Leoncio ***@***.***>:
A simpler solution, supposing prtrunclnorm(q, a) is the same as plnorm(q) - plnorm(a) is to do
prtrunclnorm <- function(..., a, b
) {
if (lower.tail
) {
return(plnorm(q) - plnorm(a
))
}
else
{
return(plnorm(b) - plnorm(q
))
}
}
And the same goes for the other distros.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Removed this from 1.0.0 because it can be part of the MVP and, thus, a publication of a 0.1.0 version of the package. Adding the prob and quantile functions might take a while, so I think it's a good idea to publish 0.1.0 as a milestone before adding these to an eventual 1.0.0. |
Removed from MVP as agreed in our 2021-11-04 meeting. These functions are important, but not essential for the 1.0.0 launch. |
Easy implementation from #80 (comment) (adapted, where
|
Progress for
|
`q_T` equation in #78 (comment) suggested that `p = [q - F(a)] / [F(b) - F(a)]`.
As a consequence, `lower.tail` and `log.p` must now be named. On the plus side, since these are usually unused, `ptrunc()` calls are more sensible (distribution args come first), but they also follow the same order as their `stats` counterparts (again, distro parms come first)
In some low-probability cases (`a` and/or `qt` in the tail of the distro), `pbeta()` would give out a warning. The proposed solution avoids this.
* issue-54: Resolved linting Improved validation a <= q <= b (#54) Worked around extreme cases (#54) Added more tests to `ptrunc.beta()` (#54) Added validation for `ptrunc.beta()` (#54) Fixed docs Moved `...` to middle of arg list (#54) Isolated repeated calculation of `p` (#54) Fixed docs Increment version number to 1.1.0.9001 Implemented `ptrunc.beta()` (#54) Restructured `ptrunc()` generic (#54) Added comments
Hi René, Thanks again for providing me with the formulas. The one I was using previously (here, with corrections posted after "Edit") was wrong, which explains the issues I was having. The latest one you posted (here) have been implemented and seem to be working fine for Normal. I'll continue work on the remaining distros. |
* issue-54: Increment version number to 1.1.1.9016 Implemented `qtrunc.beta()` (#54)
* issue-54: Increment version number to 1.1.1.9018 Implemented `qtrunc.chisq()` (#54)
* issue-54: Increment version number to 1.1.1.9019 Implemented `qtrunc.contbern()` (#54)
After we've implemented the
r*
andd*
functions, work onp*
andq*
. Both would probably be numerically determined (though analytical solutions are of course preferred).Maybe one function can do the job for all distributions, since the procedure is similar see sketch below)?
and
q*
is basically the other way around.ptrunc*
qtrunc*
The text was updated successfully, but these errors were encountered: