pg.dist: Poisson-Gamma Distribution (Negative-Binomial)

Description Usage Arguments Details Value References Examples

View source: R/pg.dist.R

Description

The function fits a mixed Poisson distribution, in which the random parameter follows Gamma distribution (the negative-binomial distribution). As teh method of estimation Expectation-maximization algorithm is used. In M-step the analytical formulas taken from [Karlis, 2005] are applied.

Usage

1
pg.dist(variable, alpha.start, beta.start, epsylon)

Arguments

variable

The count variable.

alpha.start

The starting value of the parameter alpha. Default to 1.

beta.start

The starting value of the parameter beta. Default to 0.3

epsylon

Default to epsylon = 10^(-8)

Details

This function provides estimated parameters of the model N|λ \sim Poisson(λ) where λ parameter is also a random variable follows Gamma distribution with hiperparameters α, β. The pdf of Gamma is of the form f_λ(λ)=\frac{λ^{α-1}\exp(-βλ)β^λ}{Γ(α)} .

Value

alpha

the parameter of mixing Gamma distribution

beta

the parameter of mixing Gamma distribution

theta

the value 1/beta

n.iter

the number of steps in EM algorithm

References

Karlis, D. (2005). EM algorithm for mixed Poisson and other discrete distributions. Astin bulletin, 35(01), 3-24.

Examples

1
2
3
library(MASS)
pGamma1 = pg.dist(variable=quine$Days)
print(pGamma1)

Example output

Loading required package: gaussquad
Loading required package: polynom
Loading required package: orthopolynom
Loading required package: Rmpfr
Loading required package: gmp

Attaching package: 'gmp'

The following objects are masked from 'package:base':

    %*%, apply, crossprod, matrix, tcrossprod

C code of R package 'Rmpfr': GMP using 64 bits per limb


Attaching package: 'Rmpfr'

The following objects are masked from 'package:stats':

    dbinom, dnorm, dpois, pnorm

The following objects are masked from 'package:base':

    cbind, pmax, pmin, rbind

Loading required package: MASS
$alpha
[1] 15.73654

$beta
[1] 0.9561112

$theta
[1] 1.045903

$n.iter
[1] 66

attr(,"class")
[1] "pg.dist"

MixedPoisson documentation built on May 2, 2019, 12:40 p.m.