Cumulative Distribution Function of the Difference Between Two Beta Variables
Source:R/pBetadiff.R
pBetadiff.Rd
This function calculates the cumulative distribution function (CDF) of the difference between two independent beta-distributed random variables using Appell's first hypergeometric function. Specifically, it computes P(X1 - X2 > q) where X1 ~ Beta(alpha1, beta1) and X2 ~ Beta(alpha2, beta2).
Arguments
- q
A numeric value representing the quantile threshold.
- alpha1
A positive numeric value representing the first shape parameter of the first beta distribution.
- alpha2
A positive numeric value representing the first shape parameter of the second beta distribution.
- beta1
A positive numeric value representing the second shape parameter of the first beta distribution.
- beta2
A positive numeric value representing the second shape parameter of the second beta distribution.
Value
A numeric value representing P(X1 - X2 > q), the probability that the difference between the two beta variables exceeds the quantile q.
Details
The function uses a piecewise approach based on the range of the difference π = X1 - X2:
For π ∈ [-1, 0): Uses Appell's F1 function with specific parameters
For π ∈ [0, 1): Uses a different parameterization of Appell's F1 function
Special case handling when π = 0 and certain parameter conditions are met