Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

betaint

The “Beta Integral”


Description

The “beta integral” which is just a multiple of the non regularized incomplete beta function. This function merely provides an R interface to the C level routine. It is not exported by the package.

Usage

betaint(x, a, b)

Arguments

x

vector of quantiles.

a, b

parameters. See Details for admissible values.

Details

Function betaint computes the “beta integral”

B(a, b; x) = Gamma(a + b) int_0^x t^(a-1) (1-t)^(b-1) dt

for a > 0, b != -1, -2, … and 0 < x < 1. (Here Gamma(a) is the function implemented by R's gamma() and defined in its help.) When b > 0,

B(a, b; x) = Γ(a) Γ(b) I_x(a, b),

where I_x(a, b) is pbeta(x, a, b). When b < 0, b != -1, -2, …, and a > 1 + floor(-b),

B(a, b; x) = -Gamma(a+b) {(x^(a-1) (1-x)^b)/b + [(a-1) x^(a-2) (1-x)^(b+1)]/[b(b+1)] + … + [(a-1)…(a-r) x^(a-r-1) (1-x)^(b+r)]/[b(b+1)…(b+r)]} + [(a-1)…(a-r-1)]/[b(b+1)…(b+r)] Gamma(a-r-1) * Gamma(b+r+1) I_x(a-r-1, b+r+1),

where r = floor(-b).

This function is used (at the C level) to compute the limited expected value for distributions of the transformed beta family; see, for example, levtrbeta.

Value

The value of the integral.

Invalid arguments will result in return value NaN, with a warning.

Note

The need for this function in the package is well explained in the introduction of Appendix A of Klugman et al. (2012). See also chapter 6 and 15 of Abramowitz and Stegun (1972) for definitions and relations to the hypergeometric series.

Author(s)

References

Abramowitz, M. and Stegun, I. A. (1972), Handbook of Mathematical Functions, Dover.

Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.

Examples

x <- 0.3
a <- 7

## case with b > 0
b <- 2
actuar:::betaint(x, a, b)
gamma(a) * gamma(b) * pbeta(x, a, b)    # same

## case with b < 0
b <- -2.2
r <- floor(-b)        # r = 2
actuar:::betaint(x, a, b)

## "manual" calculation
s <- (x^(a-1) * (1-x)^b)/b +
    ((a-1) * x^(a-2) * (1-x)^(b+1))/(b * (b+1)) +
    ((a-1) * (a-2) * x^(a-3) * (1-x)^(b+2))/(b * (b+1) * (b+2))
-gamma(a+b) * s +
    (a-1)*(a-2)*(a-3) * gamma(a-r-1)/(b*(b+1)*(b+2)) *
    gamma(b+r+1)*pbeta(x, a-r-1, b+r+1)

actuar

Actuarial Functions and Heavy Tailed Distributions

v3.1-2
GPL (>= 2)
Authors
Vincent Goulet [cre, aut], Sébastien Auclair [ctb], Christophe Dutang [aut], Nicholas Langevin [ctb], Xavier Milhaud [ctb], Tommy Ouellet [ctb], Alexandre Parent [ctb], Mathieu Pigeon [aut], Louis-Philippe Pouliot [ctb], Jeffrey A. Ryan [aut] (Package API), Robert Gentleman [aut] (Parts of the R to C interface), Ross Ihaka [aut] (Parts of the R to C interface), R Core Team [aut] (Parts of the R to C interface), R Foundation [aut] (Parts of the R to C interface)
Initial release
2021-03-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.