Learn R Programming

HelpersMG (version 5.1)

dggamma: Generalized gamma distribution.

Description

Generalized gamma distribution

Usage

dggamma(x, theta, kappa, delta, log = FALSE)

pggamma(q, theta, kappa, delta, lower.tail = TRUE, log.p = FALSE)

qggamma(p, theta, kappa, delta, lower.tail = TRUE, log.p = FALSE)

rggamma(n, theta, kappa, delta)

Arguments

x, q

vector of quantiles.

theta

scale parameter.

kappa

shape parameter.

delta

shape parameter.

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.

Value

dggamma gives the density, pggamma gives the distribution function, qggamma gives the quantile function, and rggamma generates random deviates.

Functions

  • dggamma: Density of the generalized gamma.

  • pggamma: Distribution function of the generalized gamma.

  • qggamma: Quantile of the generalized gamma.

  • rggamma: Random of the generalized gamma.

More details here

The generalized gamma is described here https://en.wikipedia.org/wiki/Generalized_gamma_distribution. With a being theta, b being kappa, and p being delta. theta, kappa and delta must be all > 0.

Details

pggamma, qggamma, dggamma, and rggamma are used to model the generalized gamma distribution.

The code is modified from https://rpubs.com/FJRubio/GG.

See Also

Other Distributions: cutter(), dbeta_new(), dcutter(), logLik.cutter(), plot.cutter(), print.cutter(), rcutter()

Examples

Run this code
# NOT RUN {
# To reproduce the wikipedia page graphic
x <- seq(from=0, to=8, by=0.1)
plot(x, dggamma(x, theta=2, kappa=0.5, delta=0.5), lty=1, col="blue", 
     type="l", lwd=2, xlab="x", ylab="PDF")
lines(x, dggamma(x, theta=1, kappa=1, delta=0.5), lty=1, col="green", lwd=2)
lines(x, dggamma(x, theta=2, kappa=1, delta=2), lty=1, col="red", lwd=2)
lines(x, dggamma(x, theta=5, kappa=1, delta=5), lty=1, col="yellow", lwd=2)
lines(x, dggamma(x, theta=7, kappa=1, delta=7), lty=1, col="grey", lwd=2)
legend("topright", legend=c("a=2, d=0.5, p=0.5", "a=1, d=1, p=0.5", 
                            "a=2, d=1, p=2", "a=5, d=1, p=5", "a=7, d=1, p=7"), 
                            col=c("blue", "green", "red", "yellow", "grey"), 
                            lty=1, lwd=2, bty="n")
# }

Run the code above in your browser using DataLab