
Distribution function of the difference of two Beta-binomial proportions
Source:R/pbetabinomdiff.R
pbetabinomdiff.RdComputes \(\Pr(Y_t / m_t - Y_c / m_c \le q)\) (or the upper tail \(\Pr(Y_t / m_t - Y_c / m_c > q)\)) for independent \(Y_t \sim \textrm{Beta-binomial}(m_t, a_t, b_t)\) and \(Y_c \sim \textrm{Beta-binomial}(m_c, a_c, b_c)\). This is the posterior predictive probability for the difference in response proportions of a future study with \(m_t\) and \(m_c\) subjects.
Arguments
- q
Numeric vector of quantiles.
- m_t, m_c
Numbers of future subjects in the treatment and control groups (whole numbers of at least 1).
- a_t, b_t
Positive shape parameters of the treatment group.
- a_c, b_c
Positive shape parameters of the control group.
- lower.tail
Logical; if
TRUE(default), probabilities are \(\Pr(Y_t / m_t - Y_c / m_c \le q)\), otherwise \(\Pr(Y_t / m_t - Y_c / m_c > q)\).
Value
A numeric vector of probabilities. The arguments q,
a_t, b_t, a_c and b_c are recycled to a common
length; each must have length 1 or the common length.
Details
The probability is an exact finite sum. The probability mass functions are
computed on the log scale, so large values of \(m_t\) and \(m_c\) do not
cause overflow. Each difference is compared with q after a single
division of the exact integer numerator \(m_c Y_t - m_t Y_c\) by
\(m_t m_c\), so differences that are mathematically equal to a decimal
q are classified correctly (they belong to the lower tail).
See also
Other distributions:
cellprob_binary2(),
pbetadiff(),
phazardratio(),
psurvdiff(),
ptdiff(),
rdirichlet()