| Title: | Conditional Negative Binomial Distribution |
|---|---|
| Description: | Provided R functions for working with the Conditional Negative Binomial distribution. |
| Authors: | Xiaotian Zhu |
| Maintainer: | Xiaotian Zhu <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.1 |
| Built: | 2026-05-13 05:43:18 UTC |
| Source: | https://github.com/xiaotianzhu/cnbdistr |
Probability mass function of the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
dcnb(x, D, r1, r2, theta)dcnb(x, D, r1, r2, theta)
x |
a nonempty vector of non-negative integer(s) <= D. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
A vector providing values of Pr(X = x | X + Y = D) for each element in x.
Xiaotian Zhu, [email protected]
dcnb(980, 2000, 120, 90, 0.994) dcnb(0:7, 7, 2, 0.4, 0.6)dcnb(980, 2000, 120, 90, 0.994) dcnb(0:7, 7, 2, 0.4, 0.6)
Function calculating mean of the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
mu_cnb(D, r1, r2, theta)mu_cnb(D, r1, r2, theta)
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
E(X | X + Y = D).
Xiaotian Zhu, [email protected]
mu_cnb(7, 2, 0.4, 0.6)mu_cnb(7, 2, 0.4, 0.6)
Cumulative distribution function of the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
pcnb(x, D, r1, r2, theta)pcnb(x, D, r1, r2, theta)
x |
a nonempty vector of real numbers. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
A vector providing values of Pr(X <= x | X + Y = D) for each element in x.
Xiaotian Zhu, [email protected]
pcnb(980, 2000, 120, 90, 0.994) pcnb(0:7, 7, 2, 0.4, 0.6)pcnb(980, 2000, 120, 90, 0.994) pcnb(0:7, 7, 2, 0.4, 0.6)
Quantile function of the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
qcnb(p, D, r1, r2, theta)qcnb(p, D, r1, r2, theta)
p |
a nonempty vector of probabilities (0 <= p[i] <= 1 for all i). |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
A vector x such that x[i] = Inf{x in 0:D, p[i] <= Pr(X <= x | X + Y = D)} for all i.
Xiaotian Zhu, [email protected]
qcnb(0.035193, 2000, 120, 90, 0.994) qcnb(seq(0, 1, 0.05), 7, 2, 0.4, 0.6)qcnb(0.035193, 2000, 120, 90, 0.994) qcnb(seq(0, 1, 0.05), 7, 2, 0.4, 0.6)
Random number generation from the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
rcnb(n, D, r1, r2, theta)rcnb(n, D, r1, r2, theta)
n |
a positive integer. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
n iid draws from X|X+Y=D.
Xiaotian Zhu, [email protected]
x <- rcnb(1e3, 7, 2, 0.4, 0.6) hist(x)x <- rcnb(1e3, 7, 2, 0.4, 0.6) hist(x)
Function calculating variance of the conditional distribution of X given X + Y = D, where X ~ NB(r1, p1) and Y ~ NB(r2, p2) are drawn from two negative binomials, independent of each other, and assuming p1/p2 = theta.
sigma2_cnb(D, r1, r2, theta)sigma2_cnb(D, r1, r2, theta)
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
theta |
a positive value. |
Need to specify full list of arguments, as default values have not been set.
V(X | X + Y = D).
Xiaotian Zhu, [email protected]
sigma2_cnb(7, 2, 0.4, 0.6)sigma2_cnb(7, 2, 0.4, 0.6)