dCMP | R Documentation |
Functions to compute the probability (dCMP) and cumulative probability (pCMP) for the Conway-Maxwell-Poisson distribution, with rate parameter lambda and dispersion parameter upsilon. There is also a function for computing the expectation (eCMP) and for allowing a re-parameterization by the mean paramater mu (lambdaCMP).
dCMP(x, lambda, upsilon, log = FALSE, error = 0.01)
pCMP(q, lambda, upsilon, lower_tail = TRUE, error = 0.01)
qCMP(p, lambda, upsilon, lower_tail = TRUE, error = 0.01)
eCMP(lambda, upsilon, method = "sum", error = 0.01)
lambdaCMP(mu, upsilon, method = "sum", error = 0.01)
x |
vector of non-negative integers. |
lambda |
vector of non-negative rate parameters. |
upsilon |
vector of non-negative dispersion parameters. |
log |
logical; if TRUE, probabilities p are given as log(p). |
error |
numeric. Upper bound for the error in computing the normalizing constant. |
q |
vector of probabilities. |
lower_tail |
logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x]. |
p |
vector of quantiles. |
method |
character; either 'fast' or 'sum'. See 'details'. |
mu |
vector of non-negative mean parameters. |
When upsilon is greater than 1, the variance is lower than the expectation, while it is larger than expectation when upsilon is in the 0-1 range. The variance equals expectation when upsilon = 1, and then the distribution is the same as the Poisson distribution.
There is no general closed form for the expectation for the CMP distribution, and so it must be approximated. Two methods are available for this. The 'fast' method uses the following approximation in Shmueli et al (2005) for the relationship between the parameters and the expectation:
mu = E(x) ~ lambda^(1/upsilon) - ((upsilon - 1) / (2*upsilon))
The 'sum' method relies on using a truncated sum from 0 to K, where K is determined using the error argument, as in Shmueli et al (2005). For the expectation the sum(x*p(x)) from x = (0, Inf) is approximated. For lambda, the equation sum((mu-x) * p(x)) = 0 is solved (see Huang 2017), with the left hand side sum is approximated.
Shmueli et al (2005) A useful distribution for fitting discrete data: revival of the Conway–Maxwell–Poisson distribution
Huang (2017) Mean-parametrized Conway–Maxwell–Poisson regression models for dispersed counts
upsilon.ml
for a function for estimating the dispersion parameter.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.