R: The zero adjusted Inverse Gaussian distribution for fitting a...
ZAIG
R Documentation
The zero adjusted Inverse Gaussian distribution for fitting a GAMLSS model
Description
The function ZAIG() defines the zero adjusted Inverse Gaussian distribution, a three parameter distribution, for a
gamlss.family object to be used in GAMLSS fitting
using the function gamlss(). The zero adjusted Inverse Gaussian distribution is similar to the Inverse Gaussian distribution
but allows zeros as y values. The extra parameter models
the probabilities at zero.
The functions dZAIG, pZAIG, qZAIG and rZAIG define the density, distribution function, quantile function and random
generation for the ZAIG parameterization of the zero adjusted Inverse Gaussian distribution.
plotZAIG can be used to plot the distribution. meanZAIG calculates the expected value of the response for a fitted model.
Usage
ZAIG(mu.link = "log", sigma.link = "log", nu.link = "logit")
dZAIG(x, mu = 1, sigma = 1, nu = 0.1, log = FALSE)
pZAIG(q, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
qZAIG(p, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE, log.p = FALSE,
upper.limit = mu + 10 * sqrt(sigma^2 * mu^3))
rZAIG(n, mu = 1, sigma = 1, nu = 0.1, ...)
plotZAIG(mu = 5, sigma = 1, nu = 0.1, from = 0, to = 10, n = 101, ...)
meanZAIG(obj)
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 nu.link, with "logit" link as the default for the sigma parameter
x,q
vector of quantiles
mu
vector of location parameter values
sigma
vector of scale parameter values
nu
vector of probability at zero parameter values
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]
upper.limit
the argument upper.limit sets the upper limit in the golden section search for q,
the default is 10 time its standard deviation
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is
taken to be the number required
from
where to start plotting the distribution from
to
up to where to plot the distribution
obj
a fitted BEINF object
...
... can be used to pass the uppr.limit argument to qIG
for y=(0,Inf), mu>0, sigma>0 and 0<nu<1.
E(y)=(1-nu)*mu and Var(y)=(1-nu)*mu^2*(nu+mu*sigma^2).
Value
returns a gamlss.family object which can be used to fit a zero adjusted inverse Gaussian distribution in the gamlss() function.
Author(s)
Bob Rigby and Mikis Stasinopoulos
References
Heller, G. Stasinopoulos M and Rigby R.A. (2006)
The zero-adjusted Inverse Gaussian distribution as a model for
insurance claims. in Proceedings of the 21th International
Workshop on Statistial Modelling, eds J. Hinde, J. Einbeck and J.
Newell, pp 226-233, Galway, Ireland.
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.
See Also
gamlss.family, IG
Examples
ZAIG()# gives information about the default links for the ZAIG distribution
# plotting the distribution
plotZAIG( mu =10 , sigma=.5, nu = 0.1, from = 0, to=10, n = 101)
# plotting the cdf
plot(function(y) pZAIG(y, mu=10 ,sigma=.5, nu = 0.1 ), 0, 1)
# plotting the inverse cdf
plot(function(y) qZAIG(y, mu=10 ,sigma=.5, nu = 0.1 ), 0.001, .99)
# generate random numbers
dat <- rZAIG(100,mu=10,sigma=.5, nu=.1)
# fit a model to the data
# library(gamlss)
# m1<-gamlss(dat~1,family=ZAIG)
# meanZAIG(m1)[1]