Multigam | R Documentation |
The multivariate gamma distribution is a multivariate absolute continuous
probability distribution, defined as the cumulative sum of independent
gamma random variables with possibly different shape parameters
\alpha_i > 0, i\in\{1, \dots, k\}
and the same scale \beta > 0
.
Multigam(shape = 1, scale = 1)
dmultigam(x, shape, scale, log = FALSE)
rmultigam(n, shape, scale)
## S4 method for signature 'Multigam,numeric'
d(distr, x, log = FALSE)
## S4 method for signature 'Multigam,matrix'
d(distr, x, log = FALSE)
## S4 method for signature 'Multigam,numeric'
r(distr, n)
## S4 method for signature 'Multigam'
mean(x)
## S4 method for signature 'Multigam'
var(x)
## S4 method for signature 'Multigam'
finf(x)
llmultigam(x, shape, scale)
## S4 method for signature 'Multigam,matrix'
ll(distr, x)
emultigam(x, type = "mle", ...)
## S4 method for signature 'Multigam,matrix'
mle(
distr,
x,
par0 = "same",
method = "L-BFGS-B",
lower = 1e-05,
upper = Inf,
na.rm = FALSE
)
## S4 method for signature 'Multigam,matrix'
me(distr, x, na.rm = FALSE)
## S4 method for signature 'Multigam,matrix'
same(distr, x, na.rm = FALSE)
vmultigam(shape, scale, type = "mle")
## S4 method for signature 'Multigam'
avar_mle(distr)
## S4 method for signature 'Multigam'
avar_me(distr)
## S4 method for signature 'Multigam'
avar_same(distr)
shape , scale |
numeric. The non-negative distribution parameters. |
x |
For the density function, |
log |
logical. Should the logarithm of the probability be returned? |
n |
number of observations. If |
distr |
an object of class |
type |
character, case ignored. The estimator type (mle, me, or same). |
... |
extra arguments. |
par0 , method , lower , upper |
arguments passed to optim for the mle optimization. See Details. |
na.rm |
logical. Should the |
The probability density function (PDF) of the multivariate gamma distribution is given by:
f(x; \alpha, \beta) =
\frac{\beta^{-\alpha_0}}{\prod_{i=1}^k\Gamma(\alpha_i)}, e^{-x_k/\beta}
x_1^{\alpha_1-1}\prod_{i=1}^k (x_i - x_{i-1})^{(\alpha_i-1)} \quad x > 0.
The MLE of the multigamma distribution parameters is not available in closed
form and has to be approximated numerically. This is done with optim()
.
Specifically, instead of solving a (k+1)
optimization problem w.r.t
\alpha, \beta
, the optimization can be performed on the shape parameter
sum \alpha_0:=\sum_{i=1}^k\alpha \in(0,+\infty)^k
. The default method
used is the L-BFGS-B method with lower bound 1e-5
and upper bound Inf
.
The par0
argument can either be a numeric (satisfying
lower <= par0 <= upper
) or a character specifying the closed-form estimator
to be used as initialization for the algorithm ("me"
or "same"
- the
default value).
Each type of function returns a different type of object:
Distribution Functions: When supplied with one argument (distr
), the
d()
, p()
, q()
, r()
, ll()
functions return the density, cumulative
probability, quantile, random sample generator, and log-likelihood functions,
respectively. When supplied with both arguments (distr
and x
), they
evaluate the aforementioned functions directly.
Moments: Returns a numeric, either vector or matrix depending on the moment
and the distribution. The moments()
function returns a list with all the
available methods.
Estimation: Returns a list, the estimators of the unknown parameters. Note that in distribution families like the binomial, multinomial, and negative binomial, the size is not returned, since it is considered known.
Variance: Returns a named matrix. The asymptotic covariance matrix of the estimator.
Mathal, A. M., & Moschopoulos, P. G. (1992). A form of multivariate gamma distribution. Annals of the Institute of Statistical Mathematics, 44, 97-106.
Oikonomidis, I. & Trevezas, S. (2025), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
# -----------------------------------------------------
# Multivariate Gamma Distribution Example
# -----------------------------------------------------
# Create the distribution
a <- c(0.5, 3, 5) ; b <- 5
D <- Multigam(a, b)
# ------------------
# dpqr Functions
# ------------------
d(D, c(0.3, 2, 10)) # density function
# alternative way to use the function
df <- d(D) ; df(c(0.3, 2, 10)) # df is a function itself
x <- r(D, 100) # random generator function
# ------------------
# Moments
# ------------------
mean(D) # Expectation
var(D) # Variance
finf(D) # Fisher Information Matrix
# List of all available moments
mom <- moments(D)
mom$mean # expectation
# ------------------
# Point Estimation
# ------------------
ll(D, x)
llmultigam(x, a, b)
emultigam(x, type = "mle")
emultigam(x, type = "me")
emultigam(x, type = "same")
mle(D, x)
me(D, x)
same(D, x)
e(D, x, type = "mle")
mle("multigam", x) # the distr argument can be a character
# ------------------
# Estimator Variance
# ------------------
vmultigam(a, b, type = "mle")
vmultigam(a, b, type = "me")
vmultigam(a, b, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
v(D, type = "mle")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.