|
1 | 1 | #' @title Beta Functions |
2 | 2 | #' @name beta_functions |
3 | | -#' @description Functions to compute the Euler beta function, normalised incomplete beta function, and their complements, as well as their inverses and derivatives. |
4 | | -#' @param a First parameter of the beta function |
5 | | -#' @param b Second parameter of the beta function |
| 3 | +#' @description |
| 4 | +#' Functions to compute the Beta function, normalized incomplete beta function, |
| 5 | +#' and their complements, as well as their inverses and derivatives. |
| 6 | +#' |
| 7 | +#' **Beta Function \eqn{B(a, b)}:** |
| 8 | +#' |
| 9 | +#' * `beta_boost(a, b)` |
| 10 | +#' |
| 11 | +#' \deqn{B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}} |
| 12 | +#' |
| 13 | +#' |
| 14 | +#' **Incomplete Beta Functions:** |
| 15 | +#' |
| 16 | +#' * **Normalized (Regularized) Functions:** |
| 17 | +#' - `ibeta(a, b, x)`: Normalized incomplete beta function \eqn{I_x(a, b)} |
| 18 | +#' |
| 19 | +#' \deqn{I_x(a,b) = \frac{1}{B(a, b)}\int_{0}^{x}t^{a-1}(1-t)^{b-1}dt} |
| 20 | +#' |
| 21 | +#' - `ibetac(a, b, x)`: Normalized complement, \eqn{1 - I_x(a, b) = I_{1-x}(b, a)} |
| 22 | +#' |
| 23 | +#' * **Non-normalized Functions:** |
| 24 | +#' - `beta_boost(a, b, x)`: Full incomplete beta function \eqn{B_x(a, b)} |
| 25 | +#' |
| 26 | +#' \deqn{\int_{0}^{x}t^{a-1}(1-t)^{b-1}dt} |
| 27 | +#' |
| 28 | +#' - `betac(a, b, x)`: Full complement , \eqn{1 - B_x(a, b) = B_{1-x}(b, a)} |
| 29 | +#' |
| 30 | +#' |
| 31 | +#' **Inverse Functions:** |
| 32 | +#' |
| 33 | +#' * **Primary inverses (solving for x):** |
| 34 | +#' - `ibeta_inv(a, b, p)`: Returns \eqn{x} such that \eqn{p = I_x(a, b)} |
| 35 | +#' - `ibetac_inv(a, b, q)`: Returns \eqn{x} such that \eqn{q = 1 - I_x(a, b)} |
| 36 | +#' |
| 37 | +#' * **Parameter inverses (solving for a or b):** |
| 38 | +#' - `ibeta_inva(b, x, p)`: Returns a such that \eqn{p} = I_x(a, b) |
| 39 | +#' - `ibetac_inva(b, x, q)`: Returns a such that \eqn{q} = 1 - I_x(a, b) |
| 40 | +#' - `ibeta_invb(a, x, p)`: Returns b such that \eqn{p} = I_x(a, b) |
| 41 | +#' - `ibetac_invb(a, x, q)`: Returns b such that \eqn{q} = 1 - I_x(a, b) |
| 42 | +#' |
| 43 | +#' **Derivatives:** |
| 44 | +#' |
| 45 | +#' `ibeta_derivative(a, b, x)`: Computes the partial derivative with respect to x |
| 46 | +#' of the incomplete beta function |
| 47 | +#' |
| 48 | +#' \deqn{\frac{\partial}{\partial x}I_x(a,b) = \frac{(1-x)^{b-1}x^{a-1}}{B(a,b)}} |
| 49 | +#' |
| 50 | +#' @param a First parameter of the beta function (must be positive) |
| 51 | +#' @param b Second parameter of the beta function (must be positive) |
6 | 52 | #' @param x Upper limit of integration (0 <= x <= 1) |
7 | 53 | #' @param p Probability value (0 <= p <= 1) |
8 | | -#' @param q Probability value (0 <= q <= 1) |
9 | | -#' @return A single numeric value with the computed beta function, normalised incomplete beta function, or their complements, depending on the function called. |
| 54 | +#' @param q Probability value (0 <= q <= 1), where q = 1 - p |
| 55 | +#' @return A single numeric value with the computed beta function, normalized incomplete beta function, or their complements, depending on the function called. |
10 | 56 | #' @seealso [Boost Documentation](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/sf_beta.html) for more details on the mathematical background. |
11 | 57 | #' @examples |
12 | 58 | #' \dontrun{ |
13 | 59 | #' # Euler beta function B(2, 3) |
14 | 60 | #' beta_boost(2, 3) |
15 | | -#' # Normalised incomplete beta function I_x(2, 3) for x = 0.5 |
| 61 | +#' # Normalized incomplete beta function I_x(2, 3) for x = 0.5 |
16 | 62 | #' ibeta(2, 3, 0.5) |
17 | | -#' # Normalised complement of the incomplete beta function 1 - I_x(2, 3) for x = 0.5 |
| 63 | +#' # Normalized complement of the incomplete beta function 1 - I_x(2, 3) for x = 0.5 |
18 | 64 | #' ibetac(2, 3, 0.5) |
19 | 65 | #' # Full incomplete beta function B_x(2, 3) for x = 0.5 |
20 | 66 | #' beta_boost(2, 3, 0.5) |
21 | 67 | #' # Full complement of the incomplete beta function 1 - B_x(2, 3) for x = 0.5 |
22 | 68 | #' betac(2, 3, 0.5) |
23 | | -#' # Inverse of the normalised incomplete beta function I_x(2, 3) = 0.5 |
| 69 | +#' # Inverse of the normalized incomplete beta function I_x(2, 3) = 0.5 |
24 | 70 | #' ibeta_inv(2, 3, 0.5) |
25 | | -#' # Inverse of the normalised complement of the incomplete beta function I_x(2, 3) = 0.5 |
| 71 | +#' # Inverse of the normalized complement of the incomplete beta function I_x(2, 3) = 0.5 |
26 | 72 | #' ibetac_inv(2, 3, 0.5) |
27 | | -#' # Inverse of the normalised complement of the incomplete beta function I_x(a, b) |
| 73 | +#' # Inverse of the normalized complement of the incomplete beta function I_x(a, b) |
28 | 74 | #' # with respect to a for x = 0.5 and q = 0.5 |
29 | 75 | #' ibetac_inva(3, 0.5, 0.5) |
30 | | -#' # Inverse of the normalised incomplete beta function I_x(a, b) |
| 76 | +#' # Inverse of the normalized incomplete beta function I_x(a, b) |
31 | 77 | #' # with respect to b for x = 0.5 and p = 0.5 |
32 | 78 | #' ibeta_invb(0.8, 0.5, 0.5) |
33 | | -#' # Inverse of the normalised complement of the incomplete beta function I_x(a, b) |
| 79 | +#' # Inverse of the normalized complement of the incomplete beta function I_x(a, b) |
34 | 80 | #' # with respect to b for x = 0.5 and q = 0.5 |
35 | 81 | #' ibetac_invb(2, 0.5, 0.5) |
36 | 82 | #' # Derivative of the incomplete beta function with respect to x for a = 2, b = 3, x = 0.5 |
|
0 commit comments