-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
Incomplete Beta Inverse #2513
Comments
Im actually planning on working on through the quantile functions (starting with the Gamma distribution at the moment), so this is already on my to-do list (unless you've already started!) |
Nice! I have some icdfs at https://github.com/spinkney/helpful_stan_functions/tree/main/functions%2Finverse_cdf. If the quantile functions are getting implemented, I think I'll start a discussion on copula functions and their design. |
Do you know if there's any discussion on a reserved name for these? Should it be icdf or quantile? |
I was planning on proposing using the |
@andrjohns is it possible to also expose this function when you add the icdfs? This functionay be useful for user defined icdfs in the future |
Yep! The plan is to expose all of the intermediary functions. This function is just waiting on the Hypergeometric pFq, which is needed for the derivatives wrt a and b |
Well, I found an implementation that wasn't too hard to write in Stan. The stan code is at https://github.com/spinkney/helpful_stan_functions/blob/main/functions/special/inc_beta_inverse.stanfunctions. I checked the output on a few cases compared to qbeta in R. Not sure if you want to test against boosts version or not. |
@andrjohns there's a wealth of inverse cdf's here https://people.sc.fsu.edu/~jburkardt/cpp_src/cpp_src.html. I'm going to put some together in Stan but can start trying to get some into the cpp. I want to get this beta one in soon as it allows the beta, student_t, skew_student_t, and probably others right off the bat. @bgoodri has made a good case for Look at this student_t_qf: # http://www.homepages.ucl.ac.uk/~ucahwts/lgsnotes/JCF_Student.pdf
qt2 <- function(u, nu){
x <- ifelse (u < 0.5, 2 * u, 2 * (1 - u))
sign(u - 0.5) * sqrt( nu * (1 / (qbeta(x, shape1=nu / 2, shape2= 0.5))) - 1)
}
all.equal(qt2(0.2, 1), qt(0.2, 1)) |
Oh excellent, thanks for prompting me on this! Will get into having a look at those |
Description
Add incomplete beta inverse. This is needed for the quantile function of the beta distribution (if or when quantile functions get added). By having this available to users they can define the quantile function of the beta distribution as well as the quantile function of the skewed generalized t distribution
The function is available in boost at https://www.boost.org/doc/libs/1_74_0/libs/math/doc/html/math_toolkit/sf_beta/ibeta_inv_function.html
The derivative is defined at https://functions.wolfram.com/GammaBetaErf/InverseBetaRegularized/20/01/01/
The text was updated successfully, but these errors were encountered: