recipEnzpois | R Documentation |
Computes the first reciprocal moment (first negative moment) of the truncated Poisson distribution (the Poisson distribution conditioned to have a nonzero value).
recipEnzpois(mu, exact=TRUE)
mu |
The mean of the original Poisson distribution. A single positive numeric value, or a vector of positive numbers. |
exact |
Logical value specifying whether to use the exact analytic formula if possible. |
This function calculates the expected value of 1/N
given N > 0
, where N
is a Poisson random variable
with mean \mu
.
If the library gsl is loaded, and if exact=TRUE
(the
default), then the calculation uses
the exact analytic formula
\nu = \frac{e^{-\mu}}{1- e^{-\mu}}
\left( Ei(\mu) - \log \mu - \gamma \right)
(see e.g. Grab and Savage, 1954)
where \nu
is the desired reciprocal moment, and
Ei(x) = \int_{-\infty}^x t e^{-t} dt
is the first exponential integral, and
\gamma \approx 0.577
is the Euler-Mascheroni constant.
If gsl is not loaded, or if exact=FALSE
is specified,
the value is computed approximately (and more slowly)
by summing over the possible values of N
up to a finite limit.
A single numerical value or a numeric vector.
.
Grab, E.L. and Savage, I.R. (1954) Tables of the expected value of 1/X for positive Bernoulli and Poisson variables. Journal of the American Statistical Association 49, 169–177.
rpoisnonzero
if(require(gsl)) {
v <- recipEnzpois(10)
print(v)
}
recipEnzpois(10, exact=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.