Learn R Programming

spatstat.core (version 2.3-1)

dmixpois: Mixed Poisson Distribution

Description

Density, distribution function, quantile function and random generation for a mixture of Poisson distributions.

Usage

dmixpois(x, mu, sd, invlink = exp, GHorder = 5)
pmixpois(q, mu, sd, invlink = exp, lower.tail = TRUE, GHorder = 5)
qmixpois(p, mu, sd, invlink = exp, lower.tail = TRUE, GHorder = 5)
rmixpois(n, mu, sd, invlink = exp)

Arguments

x

vector of (non-negative integer) quantiles.

q

vector of quantiles.

p

vector of probabilities.

n

number of random values to return.

mu

Mean of the linear predictor. A single numeric value.

sd

Standard deviation of the linear predictor. A single numeric value.

invlink

Inverse link function. A function in the R language, used to transform the linear predictor into the parameter lambda of the Poisson distribution.

lower.tail

Logical. If TRUE (the default), probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

GHorder

Number of quadrature points in the Gauss-Hermite quadrature approximation. A small positive integer.

Value

Numeric vector: dmixpois gives probability masses, ppois gives cumulative probabilities, qpois gives (non-negative integer) quantiles, and rpois generates (non-negative integer) random deviates.

Details

These functions are analogous to dpois ppois, qpois and rpois except that they apply to a mixture of Poisson distributions.

In effect, the Poisson mean parameter lambda is randomised by setting lambda = invlink(Z) where Z has a Gaussian \(N(\mu,\sigma^2)\) distribution. The default is invlink=exp which means that lambda is lognormal. Set invlink=I to assume that lambda is approximately Normal.

For dmixpois, pmixpois and qmixpois, the probability distribution is approximated using Gauss-Hermite quadrature. For rmixpois, the deviates are simulated exactly.

See Also

dpois, gauss.hermite.

Examples

Run this code
# NOT RUN {
  dmixpois(7, 10, 1, invlink = I)
  dpois(7, 10)

  pmixpois(7, log(10), 0.2)
  ppois(7, 10)

  qmixpois(0.95, log(10), 0.2)
  qpois(0.95, 10)

  x <- rmixpois(100, log(10), log(1.2))
  mean(x)
  var(x)
# }

Run the code above in your browser using DataLab