ZAGA | R Documentation |
The function ZAGA()
defines the zero adjusted Gamma distribution, a three parameter distribution, for a
gamlss.family
object to be used in GAMLSS fitting using the function gamlss()
.
The zero adjusted Gamma distribution is similar to the Gamma distribution
but allows zeros as y values. The extra parameter nu
models
the probabilities at zero.
The functions dZAGA
, pZAGA
, qZAGA
and rZAGA
define the density, distribution function,
quartile function and random
generation for the ZAGA
parameterization of the zero adjusted Gamma distribution.
plotZAGA
can be used to plot the distribution. meanZAGA
calculates the expected value of the response for a fitted model.
ZAGA(mu.link = "log", sigma.link = "log", nu.link = "logit")
dZAGA(x, mu = 1, sigma = 1, nu = 0.1, log = FALSE)
pZAGA(q, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE,
log.p = FALSE)
qZAGA(p, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE,
log.p = FALSE)
rZAGA(n, mu = 1, sigma = 1, nu = 0.1, ...)
plotZAGA(mu = 5, sigma = 1, nu = 0.1, from = 0, to = 10,
n = 101, main=NULL, ...)
meanZAGA(obj)
mu.link |
Defines the |
sigma.link |
Defines the |
nu.link |
Defines the |
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] |
p |
vector of probabilities. |
n |
number of observations. If |
from |
where to start plotting the distribution from |
to |
up to where to plot the distribution |
obj |
a fitted |
main |
for title in the plot |
... |
|
The Zero adjusted GA distribution is given as
f(y|\mu,\sigma\,\nu)=\nu
if (y=0)
f(y|\mu,\sigma,\nu)=(1-\nu)\left[\frac{1}{(\sigma^2 \mu)^{1/\sigma^2}}\hspace{1mm}\frac{y^{\frac{1}{\sigma^2}-1}\hspace{1mm} e^{-y/(\sigma^2 \mu)}}{\Gamma{(1/\sigma^2)}} \right]
otherwise
for y=(0,\infty)
, \mu>0
, \sigma>0
and 0< \nu< 1
.
E(y)=(1-\nu)\mu
and Var(y)=(1-\nu)\mu^2(\nu+\sigma^2)
.
The function ZAGA
returns a gamlss.family
object which can be used to fit a
zero adjusted Gamma distribution in the gamlss()
function.
Bob Rigby, Mikis Stasinopoulos and Almond Stocker
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.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/9780429298547")}. An older version can be found in https://www.gamlss.com/.
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 https://www.gamlss.com/).
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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v023.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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/b21973")}
(see also https://www.gamlss.com/).
gamlss.family
, GA
, ZAIG
ZAGA()# gives information about the default links for the ZAGA distribution
# plotting the function
PPP <- par(mfrow=c(2,2))
plotZAGA(mu=1, sigma=.5, nu=.2, from=0,to=3)
#curve(dZAGA(x,mu=1, sigma=.5, nu=.2), 0,3) # pdf
curve(pZAGA(x,mu=1, sigma=.5, nu=.2), 0,3, ylim=c(0,1)) # cdf
curve(qZAGA(x,mu=1, sigma=.5, nu=.2), 0,.99) # inverse cdf
y<-rZAGA(100, mu=1, sigma=.5, nu=.2) # randomly generated values
hist(y)
par(PPP)
# check that the positive part sums up to .8 (since nu=0.2)
integrate(function(x) dZAGA(x,mu=1, sigma=.5, nu=.2), 0,Inf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.