Search code examples
rderivativebeta-distribution

R - Derivatives of the inverse of the regularized incomplete beta function w.r.t. shape parameters


The regularized incomplete beta function I(x,a,b) is the CDF for a random variable distributed Beta(a,b). I have a problem that requires computing the partial derivatives of its inverse (the quantile function) w.r.t. parameters a and b. Do you know how to do this? Thank you!


Solution

  • I don't know if there's a closed-form analytical expression, but you can do it numerically (numDeriv::grad() uses Richardson extrapolation by default, see the documentation):

    x <- 0.5
    ## dummy (lambda) function with x from above and specified shape parameters
    f <- function(y) qbeta(x, y[1], y[2])
    library(numDeriv)
    grad(f,
       ## shape parameters at which to evaluate partial derivatives
       x = c(1,1)
    )
    ## [1]  0.3465736 -0.3465736
    

    ?