Type: | Package |
Title: | Conditional Negative Binomial Distribution |
Version: | 1.0.1 |
Date: | 2017-07-04 |
Author: | Xiaotian Zhu |
Maintainer: | Xiaotian Zhu <xiaotian.zhu.psualum@gmail.com> |
Description: | Provided R functions for working with the Conditional Negative Binomial distribution. |
License: | GPL-3 |
Depends: | R (≥ 3.2.2) |
Imports: | hypergeo (≥ 1.2-13), stats (≥ 3.3.2) |
Suggests: | rmutil (≥ 1.1.0), testthat (≥ 1.0.2), knitr (≥ 1.16), rmarkdown (≥ 1.6) |
NeedsCompilation: | no |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.0.1 |
VignetteBuilder: | knitr |
Packaged: | 2017-07-17 02:43:49 UTC; SAINT |
Repository: | CRAN |
Date/Publication: | 2017-07-17 09:50:23 UTC |
PMF of Conditional Negative Binomial
Description
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 = lambda.
Usage
dcnb(x, D, r1, r2, lambda)
Arguments
x |
a nonempty vector of non-negative integer(s) <= D. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
A vector providing values of Pr(X = x | X + Y = D) for each element in x.
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
dcnb(980, 2000, 120, 90, 0.994)
dcnb(0:7, 7, 2, 0.4, 0.6)
Mean of Conditional Negative Binomial
Description
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 = lambda.
Usage
mu_cnb(D, r1, r2, lambda)
Arguments
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
E(X | X + Y = D).
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
mu_cnb(7, 2, 0.4, 0.6)
CDF of Conditional Negative Binomial
Description
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 = lambda.
Usage
pcnb(x, D, r1, r2, lambda)
Arguments
x |
a nonempty vector of real numbers. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
A vector providing values of Pr(X <= x | X + Y = D) for each element in x.
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
pcnb(980, 2000, 120, 90, 0.994)
pcnb(0:7, 7, 2, 0.4, 0.6)
Quantile Function of Conditional Negative Binomial
Description
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 = lambda.
Usage
qcnb(p, D, r1, r2, lambda)
Arguments
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. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
A vector x such that x[i] = Inf{x in 0:D, p[i] <= Pr(X <= x | X + Y = D)} for all i.
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
qcnb(0.035193, 2000, 120, 90, 0.994)
qcnb(seq(0, 1, 0.05), 7, 2, 0.4, 0.6)
Random Number Generation from Conditional Negative Binomial
Description
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 = lambda.
Usage
rcnb(n, D, r1, r2, lambda)
Arguments
n |
a positive integer. |
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
n iid draws from X|X+Y=D.
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
x <- rcnb(1e3, 7, 2, 0.4, 0.6)
hist(x)
Variance of Conditional Negative Binomial
Description
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 = lambda.
Usage
sigma2_cnb(D, r1, r2, lambda)
Arguments
D |
a positive integer. |
r1 |
a positive value. |
r2 |
a positive value. |
lambda |
a positive value. |
Details
Need to specify full list of arguments, as default values have not been set.
Value
V(X | X + Y = D).
Author(s)
Xiaotian Zhu, xiaotian.zhu.psualum@gmail.com
See Also
Examples
sigma2_cnb(7, 2, 0.4, 0.6)