mgamma {extrememix} | R Documentation |
The Gamma Mixture Distribution
Description
Density, distribution function, quantile function and random generation for the mixture of Gamma distribution.
Usage
dmgamma(x, mu, eta, w, log = FALSE)
pmgamma(q, mu, eta, w, lower.tail = TRUE)
qmgamma(p, mu, eta, w, lower.tail = TRUE)
rmgamma(N, mu, eta, w)
Arguments
x , q |
vector of quantiles. |
mu |
means of the gamma mixture components (vector). |
eta |
shapes of the gamma mixture components (vector). |
w |
weights of the gamma mixture components (vector). Must sum to one. |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities. |
N |
number of observations. |
Details
The Gamma distribution has density
f_{GA}(x|\mu,\eta)= \frac{(\eta/\mu)^\eta}{\Gamma(\eta)}x^{\eta-1}\exp(-(\eta/\mu)x), \hspace{1cm} x>0,
where \mu>0
is the mean of the distribution and \eta>0
is its shape.
The density of a mixture of Gamma distributions with k
components is defined as
f_{MG}(x|\mu,\eta,w)=\sum_{i=1}^k w_if_{GA}(x|\mu_i,\eta_i),
where w_i,\mu_i,\eta_i >0
, for i=1,\dots,k
, w_1+\cdots+w_k=1
, \mu=(\mu_1,\dots,\mu_k)
, \eta = (\eta_1,\dots,\eta_k)
and w=(w_1,\dots,w_k)
.
Value
dmgamma
gives the density, pmgamma
gives the distribution function, qmgamma
gives the quantile function, and rmgamma
generates random deviates.
The length of the result is determined by N
for rmgamma
and by the length of x
, q
or p
otherwise.
References
Wiper, Michael, David Rios Insua, and Fabrizio Ruggeri. "Mixtures of gamma distributions with applications." Journal of Computational and Graphical Statistics 10.3 (2001): 440-454.
Examples
dmgamma(3, mu = c(2,3), eta = c(1,2), w = c(0.3,0.7))