CompGLM (version 2.0)

dcomp: Conway-Maxwell-Poisson Probability Density Function

Description

The PDF of the Conway-Maxwell-Poisson distribution with parameters lam and nu at point y.

Usage

dcomp(y, lam, nu, sumTo = 100L, logP = FALSE)

Arguments

y

an integer vector where the density is to be calculated. If the input is not an integer, it will be coerced to be an integer.

lam

a double vector of the parameter \(\lambda\).

nu

a double vector of the parameter \(\nu\).

sumTo

an integer for the summation term in the density (default 100).

logP

a boolean for if the log of the density should be given (default FALSE).

Value

The value of the PDF (or log PDF if logP = TRUE). Input vectors are recycled to be same length.

Details

The Conway-Maxwell-Poisson distribution has density: $$P(y) = \frac{\lambda^y}{(y!)^\nu Z(\lambda, \nu)}$$ for \(y = 0, 1, 2, \ldots\), and: $$Z(\lambda, \nu) = \sum_{j=0}^\infty \frac{\lambda^j}{(j!)^\nu}$$ where the summation is approximated by summing from j = 0 to sumTo.

Examples

Run this code
# NOT RUN {
dcomp(-5:5, 2.5, 1)
dcomp(2, 2.5, 1.5)
require(graphics)
require(stats)
comp <- dcomp(0:10, 2.5, 0.9)
poisson <- dpois(0:10, 2.5)
barplot(rbind(comp, poisson), beside = TRUE, names= 0:10, legend.text = TRUE)
# }

Run the code above in your browser using DataLab