R: The Poisson-inverse Gaussian distribution for fitting a...

PIG {gamlss.dist} | R Documentation

## The Poisson-inverse Gaussian distribution for fitting a GAMLSS model

### Description

The `PIG()` function defines the Poisson-inverse Gaussian distribution, a two parameter distribution, for a `gamlss.family` object to be used in GAMLSS fitting using the function `gamlss()`. The functions `dPIG`, `pPIG`, `qPIG` and `rPIG` define the density, distribution function, quantile function and random generation for the Poisson-inverse Gaussian `PIG()`, distribution.

The functions `ZAPIG()` and `ZIPIG()` are the zero adjusted (hurdle) and zero inflated versions of the Poisson-inverse Gaussian distribution, respectively. That is three parameter distributions.

The functions `dZAPIG`, `dZIPIG`, `pZAPIG`,`pZIPIG`, `qZAPIG` `qZIPIG` `rZAPIG` and `rZIPIG` define the probability, cumulative, quantile and random generation functions for the zero adjusted and zero inflated beta negative binomial distributions, `ZAPIG()`, `ZIPIG()`, respectively.

### Usage

    PIG(mu.link = "log", sigma.link = "log")
    dPIG(x, mu = 1, sigma = 1, log = FALSE)
    pPIG(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
    qPIG(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE,
         max.value = 10000)
    rPIG(n, mu = 1, sigma = 1, max.value = 10000)

    ZIPIG(mu.link = "log", sigma.link = "log", nu.link = "logit")
    dZIPIG(x, mu = 1, sigma = 1, nu = 0.3, log = FALSE)
    pZIPIG(q, mu = 1, sigma = 1, nu = 0.3, lower.tail = TRUE, log.p = FALSE)
    qZIPIG(p, mu = 1, sigma = 1, nu = 0.3, lower.tail = TRUE, log.p = FALSE,
           max.value = 10000)
    rZIPIG(n, mu = 1, sigma = 1, nu = 0.3, max.value = 10000)

    ZAPIG(mu.link = "log", sigma.link = "log", nu.link = "logit")
    dZAPIG(x, mu = 1, sigma = 1, nu = 0.3, log = FALSE)
    pZAPIG(q, mu = 1, sigma = 1, nu = 0.3, lower.tail = TRUE, log.p = FALSE)
    qZAPIG(p, mu = 1, sigma = 1, nu = 0.3, lower.tail = TRUE, log.p = FALSE,
          max.value = 10000)
    rZAPIG(n, mu = 1, sigma = 1, nu = 0.3, max.value = 10000)

### Arguments

`mu.link` | Defines the `mu.link`, with "log" link as the default for the mu parameter
`sigma.link` | Defines the `sigma.link`, with "log" link as the default for the sigma parameter
`nu.link` | Defines the `mu.link`, with "logit" link as the default for the nu parameter
`x` | vector of (non-negative integer) quantiles
`mu` | vector of positive means
`sigma` | vector of positive despersion parameter
`nu` | vector of zero probability parameter
`p` | vector of probabilities
`q` | vector of quantiles
`n` | number of random values to return
`log, log.p` | logical; if TRUE, probabilities p are given as log(p)
`lower.tail` | logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
`max.value` | a constant, set to the default value of 10000 for how far the algorithm should look for q

### Details

The probability function of the Poisson-inverse Gaussian distribution, is given by

f(y|mu,sigma)=(2*alpha/pi)^.5 mu^y e^(1/sigma) K(alpha)/(alpha*sigma)^y y!

where α^2=\frac{1}{σ^2}+\frac{2μ}{σ}, for y=0,1,2,...,∞ where μ>0 and σ>0 and K_{λ}(t)=\frac{1}{2}\int_0^{∞} x^{λ-1} \exp\{-\frac{1}{2}t(x+x^{-1})\}dx is the modified Bessel function of the third kind. [Note that the above parameterization was used by Dean, Lawless and Willmot(1989). It is also a special case of the Sichel distribution `SI()` when ν=-\frac{1}{2}.]

### Value

Returns a `gamlss.family` object which can be used to fit a Poisson-inverse Gaussian distribution in the `gamlss()` function.

### Author(s)

Mikis Stasinopoulos, Bob Rigby and Marco Enea

### References

Dean, C., Lawless, J. F. and Willmot, G. E., A mixed poisson-inverse-Gaussian regression model, Canadian J. Statist., 17, 2, pp 171-181

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

### See Also

`gamlss.family`, `NBI`, `NBII`, `SI`, `SICHEL`

### Examples

    PIG()# gives information about the default links for the  Poisson-inverse Gaussian distribution
    #plot the pdf using plot
    plot(function(y) dPIG(y, mu=10, sigma = 1 ), from=0, to=50, n=50+1, type="h") # pdf
    # plot the cdf
    plot(seq(from=0,to=50),pPIG(seq(from=0,to=50), mu=10, sigma=1), type="h")   # cdf
    # generate random sample
    tN <- table(Ni <- rPIG(100, mu=5, sigma=1))
    r <- barplot(tN, col='lightblue')
    # fit a model to the data
    # library(gamlss)
    # gamlss(Ni~1,family=PIG)
    ZIPIG()
    ZAPIG()

[Package gamlss.dist version 5.0-2 Index]