ggamma: Generalized Gamma distribution

ggammaR Documentation

Generalized Gamma distribution

Description

Probability density function (PDF), cumulative density function (CDF), quantile function and random generation for the Generalized Gamma (GG) distribution with 3 or 4 parameters: alpha, scale, mu, and psi. The function is reduced to GGamma distribution with 3 parameters by setting mu = 0.

Usage

dggamma(q, alpha = 1, scale = 1, mu = 0, psi = 1, log.p = FALSE)

pggamma(
  q,
  alpha = 1,
  scale = 1,
  mu = 0,
  psi = 1,
  lower.tail = TRUE,
  log.p = FALSE
)

qggamma(
  p,
  alpha = 1,
  scale = 1,
  mu = 0,
  psi = 1,
  lower.tail = TRUE,
  log.p = FALSE
)

rggamma(n, alpha = 1, scale = 1, mu = 0, psi = 1)

Arguments

q

numeric vector.

alpha

numerical parameter, strictly positive (default 1). The generalized gamma becomes the gamma distribution for alpha = 1.

scale, psi

the same real positive parameters as is used for the Gamma distribution. These are numerical and strictly positives; default 1. (see ?pgamma).

mu

location parameter (numerical, default 0).

log.p

logical; if TRUE, probabilities/densities p are returned as log(p).

lower.tail

logical; if TRUE (default), probabilities are P(X \leq x), otherwise, P(X > x)

p

vector of probabilities.

n

number of observations.

Details

Details about these function can be found in references 1 to 3. You may also see section Note at ?pgamma or ?rgamma. Herein, we are using Stacy' s formula (references 2 to 3) with the parametrization given in reference 4 (equation 6, page 12). As in the case of gamma distribution function, the cumulative distribution function (as given in equation 12, page 13 from reference 4) is expressed in terms of the lower incomplete gamma function (see ?pgamma).

The GG distribution with parameters \alpha, \beta (scale), \psi, and \mu has density:

f(x | \alpha, \beta, \mu, \psi) = \alpha exp(-((x-\mu)/ \beta)^\alpha) ((x-\mu)/\beta)^(\alpha * \psi - 1)/(\beta Gamma(\psi))

Value

GG PDF values (3-parameters or 4-parameters) for dggamma, GG probability for pggamma, quantiles or GG random generated values for rggamma.

References

  1. Handbook on STATISTICAL DISTRIBUTIONS for experimentalists (p. 73) by Christian Walck. Particle Physics Group Fysikum. University of Stockholm (e-mail: walck@physto.se )

  2. Stacy, E. W. A Generalization of the Gamma Distribution. Ann. Math. Stat. 33, 1187–1192 (1962).

  3. Stacy E, Mihram G (1965) Parameter estimation for a generalized gamma distribution. Technometrics 7: 349-358.

  4. Sanchez, R. & Mackenzie, S. A. Information Thermodynamics of Cytosine DNA Methylation. PLoS One 11, e0150427 (2016).

Examples

q <- (1:9)/10
pggamma(q, alpha = 1, scale = 1, mu = 0,
        psi = 1, lower.tail = TRUE, log.p = FALSE)

## To fit random generated numbers
set.seed(123)
x <- rggamma(2000, alpha = 1.03, psi = 0.75, scale = 2.1)
fitGGammaDist(x)


genomaths/MethylIT documentation built on Feb. 3, 2024, 1:24 a.m.