Skip to main content
Log in

Density and distribution evaluation for convolution of independent gamma variables

  • Original paper
  • Published:
Computational Statistics Aims and scope Submit manuscript

Abstract

Convolutions of independent gamma variables are encountered in many applications such as insurance, reliability, and network engineering. Accurate and fast evaluations of their density and distribution functions are critical for such applications, but no open source, user-friendly software implementation has been available. We review several numerical evaluations of the density and distribution of convolution of independent gamma variables and compare them with respect to their accuracy and speed. The methods that are based on the Kummer confluent hypergeometric function are computationally most efficient. The benefit of employing the confluent hypergeometric function is further demonstrated by a renewal process application, where the gamma variables in the convolution are Erlang variables. We derive a new computationally efficient formula for the probability mass function of the number of renewals by a given time. An R package coga provides efficient C++ based implementations of the discussed methods and are available in CRAN.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1

Similar content being viewed by others

References

  • Abramowitz M, Stegun IA (1972) Handbook of mathematical functions with formulas, graphs, and mathematical tables, vol 9. Dover, New York

    MATH  Google Scholar 

  • Akkouchi M (2005) On the convolution of gamma distributions. Soochow J Math 31(2):205–211

    MathSciNet  MATH  Google Scholar 

  • Barnabani M (2017) An approximation to the convolution of gamma distributions. Commun Stat Simul Comput 46(1):331–343

    Article  MathSciNet  Google Scholar 

  • Bon JL, Pãltãnea E (1999) Ordering properties of convolutions of exponential random variables. Lifetime Data Anal 5(2):185–192

    Article  MathSciNet  Google Scholar 

  • Crimaldi I, Di Crescenzo A, Iuliano A, Martinucci B (2013) A generalized telegraph process with velocity driven by random trials. Adv Appl Probab 45(4):1111–1136

    Article  MathSciNet  Google Scholar 

  • Di Salvo F (2008) A characterization of the distribution of a weighted sum of gamma variables through multiple hypergeometric functions. Integral Transforms Spec Funct 19(8):563–575. https://doi.org/10.1080/10652460802045258

    Article  MathSciNet  MATH  Google Scholar 

  • Furman E, Landsman Z (2005) Risk capital decomposition for a multivariate dependent gamma portfolio. Insurance Math Econ 37(3):635–649

    Article  MathSciNet  Google Scholar 

  • Galassi M, Davies J, Theiler J, Gough B, Jungman G (2009) GNU Scientific Library: reference manual, 3rd edn. Network Theory Ltd, Bristol

    Google Scholar 

  • Gupta AK, Nagar DK (2018) Matrix variate distributions. Chapman and Hall, London

    Book  Google Scholar 

  • Hu C, Pozdnyakov V, Yan J (2017) coga: convolution of gamma distributions. https://CRAN.R-project.org/package=coga. R package version 0.2.1

  • Iranmanesh A, Arashi M, Nagar D, Tabatabaey S (2013) On inverted matrix variate gamma distribution. Commun Stat Theory Methods 42(1):28–41

    Article  MathSciNet  Google Scholar 

  • Jain GC, Consul PC (1971) A generalized negative binomial distribution. SIAM J Appl Math 21(4):501–513

    Article  MathSciNet  Google Scholar 

  • Jasiulewicz H, Kordecki W (2003) Convolutions of Erlang and of Pascal distributions with applications to reliability. Demonstr Math 36(1):231–238

    MathSciNet  MATH  Google Scholar 

  • Kaas R, Goovaerts M, Dhaene J, Denuit M (2008) Modern actuarial risk theory: using R, vol 128. Springer, Berlin

    Book  Google Scholar 

  • Kadri T, Smaili K, Kadry S (2015) Markov modeling for reliability analysis using hypoexponential distribution. In: Kadry S, El Hami A (eds) Numerical methods for reliability and safety assessment: multiscale and multiphysics systems. Springer, Cham, pp 599–620

    MATH  Google Scholar 

  • Khaledi BE, Kochar S (2013) A review on convolutions of gamma random variables. In: Li H, Li X (eds) Stochastic orders in reliability and risk. Springer, Berlin, pp 199–217

    Chapter  Google Scholar 

  • Mathai AM (1982) Storage capacity of a dam with gamma type inputs. Ann Inst Stat Math 34(1):591–597

    Article  MathSciNet  Google Scholar 

  • Mathai A (2005) A pathway to matrix-variate gamma and normal densities. Linear Algebra Appl 396:317–328

    Article  MathSciNet  Google Scholar 

  • Mathai AM, Saxena RK (1978) The H function with applications in statistics and other disciplines. Wiley, New Delhi. http://cds.cern.ch/record/101905

  • Moschopoulos PG (1985) The distribution of the sum of independent gamma random variables. Ann Inst Stat Math 37(1):541–544

    Article  MathSciNet  Google Scholar 

  • Nadarajah S, Kotz S (2007) On the convolution of pareto and gamma distributions. Comput Netw 51(12):3650–3654

    Article  Google Scholar 

  • Perry D, Stadje W, Zacks S (1999) First-exit times for increasing compound processes. Commun Stat Stoch Models 15(5):977–992

    Article  MathSciNet  Google Scholar 

  • Pozdnyakov V, Hu C, Meyer T, Yan J (2017) On discretely observed Brownian motion governed by a continuous time Markov chain. University of Connecticut, Department of Statistics, Tech. rep

  • R Core Team (2018) R: a language and environment for statistical computing. R Foundation for Statistical Computing, Vienna. https://www.R-project.org/

  • Sen A, Balakrishnan N (1999) Convolution of geometrics and a reliability problem. Stat Probab Lett 43(4):421–426

    Article  MathSciNet  Google Scholar 

  • Sim C (1992) Point processes with correlated gamma interarrival times. Stat Probab Lett 15(2):135–141

    Article  MathSciNet  Google Scholar 

  • Srivastava HM, Karlsson PW (1985) Multiple Gaussian hypergeometric series. Ellis Horwood series in mathematics and its applications. E. Horwood, Billingham

    Google Scholar 

  • Vellaisamy P, Upadhye N (2009) On the sums of compound negative binomial and gamma random variables. J Appl Probab 46(1):272–283

    Article  MathSciNet  Google Scholar 

  • Zacks S (2004) Generalized integrated telegraph processes and the distribution of related stopping times. J Appl Probab 41(2):497–507

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chaoran Hu.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Proofs

1.1 Proof of Proposition 1

First, note that

$$\begin{aligned}&\Pr (N(t) = n) = \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n+1} U_k> t \right) \\&\quad = p \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_1> t\right) \\&\qquad +(1-p) \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_2 > t\right) , \end{aligned}$$

where \(E_1\) and \(E_2\) are independent of \(\{ U_k \}_{k \ge 1}\) with \(\mathcal {E}xp(\beta _1)\) and \(\mathcal {E}xp(\beta _2)\) distributions, respectively. Next, using mixture randomization we get

$$\begin{aligned} \begin{aligned} \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_1 > t \right)&= \Pr \left( \sum _{k=1}^{n} U_k \le t\right) - \Pr \left( \sum _{k=1}^{n} U_k + E_1 \le t\right) \\&= \sum _{k=0}^{n} H(t; (k, \beta _1), (n-k, \beta _2)) {n\atopwithdelims ()k} p^k (1-p)^{n-k}. \end{aligned} \end{aligned}$$

Similarly,

$$\begin{aligned} \begin{aligned} \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_2 > t\right)&= \Pr \left( \sum _{k=1}^{n} U_k \le t\right) - \Pr \left( \sum _{k=1}^{n} U_k + E_2 \le t\right) \\&= \sum _{k=0}^{n} H(t; (n-k, \beta _2), (k, \beta _1)) {n\atopwithdelims ()k} p^k (1-p)^{n-k}. \end{aligned} \end{aligned}$$

That is

$$\begin{aligned} \begin{aligned}&\Pr (N(t) = n)\\&\quad = \sum _{k=0}^{n} \left[ p H(t; (k, \beta _1), (n-k, \beta _2)) + (1-p) H(t; (n-k, \beta _2), (k, \beta _1))\right] {n\atopwithdelims ()k} p^k (1-p)^{n-k} \end{aligned} \end{aligned}$$
(7)

Equation (6) of Lemma 1 completes the proof. \(\square \)

1.2 Proof of Lemma 1

Equation (4) gives us that

$$\begin{aligned} H(y; (\alpha _1, \beta _1),&(\alpha _2, \beta _2)) \\&\quad = \left( \frac{\beta _1}{\beta _2}\right) ^{\alpha _2} \sum _{k = 0}^{\infty } \left( {\begin{array}{c}\alpha _2 + k - 1\\ k\end{array}}\right) \left( 1-\beta _1/\beta _2\right) ^k G(y/\beta _1; k + \alpha _1 + \alpha _2)\\&\qquad \quad - \left( \frac{\beta _1}{\beta _2}\right) ^{\alpha _2} \sum _{k = 0}^{\infty } \left( {\begin{array}{c}\alpha _2 + k - 1\\ k\end{array}}\right) \left( 1-\beta _1/\beta _2\right) ^k G(y/\beta _1; k + \alpha _1 + \alpha _2 + 1)\\&\quad = \left( \frac{\beta _1}{\beta _2}\right) ^{\alpha _2} \sum _{k = 0}^{\infty } \left( {\begin{array}{c}\alpha _2 + k - 1\\ k\end{array}}\right) (1-\beta _1/\beta _2)^k \frac{(y/\beta _1)^{k+\alpha _1+\alpha _2} e^{-y/\beta _1}}{\varGamma (k + \alpha _1 + \alpha _2 + 1)}\\&\quad = \left( \frac{\beta _1}{\beta _2}\right) ^{\alpha _2} \left( \frac{y}{\beta _1}\right) ^{\alpha _1 + \alpha _2} e^{-y/\beta _1} \sum _{k=0}^{\infty } \frac{\left( {\begin{array}{c}\alpha _2 + k - 1\\ k\end{array}}\right) \left[ y(1/\beta _1 - 1/\beta _2)\right] ^k}{\varGamma (k + \alpha _1 + \alpha _2 + 1)}, \end{aligned}$$

where the second equation follows from

$$\begin{aligned} G(y; \alpha ) - G(y; \alpha + 1) = \frac{y^\alpha e^{-y}}{\varGamma (\alpha + 1)}. \end{aligned}$$

Because of the identities

$$\begin{aligned} \left( {\begin{array}{c}\alpha _2 + k + 1\\ k\end{array}}\right) = \frac{(\alpha _2)_k}{k!} \end{aligned}$$

and

$$\begin{aligned} \varGamma (k + \alpha _1 + \alpha _2 + 1) = (\alpha _1 + \alpha _2 + 1)_k \varGamma (\alpha _1 + \alpha _2 + 1), \end{aligned}$$

we obtain that

$$\begin{aligned} \begin{aligned} H(y; (\alpha _1, \beta _1),&(\alpha _2, \beta _2)) \\ =&\frac{y^{\alpha _1 + \alpha _2} e^{-y/\beta _1}}{\beta _1^{\alpha _1} \beta _2^{\alpha _2} \varGamma (\alpha _1 + \alpha _2 + 1)} \sum _{k=0}^{\infty } \frac{(\alpha _2)_k [y(1/\beta _1 - 1/\beta _2)]^k}{(\alpha _1 + \alpha _2 + 1)_k k!}\\ =&\frac{y^{\alpha _1 + \alpha _2} e^{-y/\beta _1}}{\beta _1^{\alpha _1} \beta _2^{\alpha _2} \varGamma (\alpha _1 + \alpha _2 + 1)} {}_1F_1(\alpha _2; \alpha _1 + \alpha _2 + 1; y(1/\beta _1 - 1/\beta _2)). \end{aligned} \end{aligned}$$

\(\square \)

1.3 Proof of Corollary 1

Note first that

$$\begin{aligned} \begin{aligned} \Pr (N(t) = n) =&\Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n+1} U_k> t \right) \\ =&\sum _{s=1}^S p_s \Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_s > t\right) , \end{aligned} \end{aligned}$$

where \(E_s\) are independent of \(\{ U_k \}_{k \ge 1}\) with an \(\mathcal {E}xp(\beta _s)\) distribution. Then we get that

$$\begin{aligned}&\Pr \left( \sum _{k=1}^{n} U_k \le t, \sum _{k=1}^{n} U_k + E_s > t\right) \\&\quad =\Pr \left( \sum _{k=1}^{n} U_k \le t \right) - \Pr \left( \sum _{k=1}^{n} U_k + E_s \le t \right) \\&\qquad = \sum _{k_1=0}^{n} \sum _{k_2=0}^{n-k_1} \dots \sum _{k_{S-1}=0}^{n-k_1- \dots -k_{S-2}} H_s(t, (k_1, \beta _1), \dots , (k_S, \beta _S)) \frac{n!}{k_1!k_2! \dots k_S!} p_1^{k_1} \dots p_S^{k_S}. \end{aligned}$$

\(\square \)

An alternative expression for confluent hypergeometric function

For completeness, we illustrate the derivation given by Di Salvo (2008) here. Equation (2) can be expressed as a multiple integral over \(n-1\)-dimensional standard simplex (Srivastava and Karlsson 1985), that is,

$$\begin{aligned} \begin{aligned} \phi&=\frac{\varGamma (\gamma )}{\prod _{i=1}^n\varGamma (\alpha _i)}\int _{E_{n-1}} \exp \left\{ x\sum _{i=2}^n t_i\left( \frac{1}{\beta _1}-\frac{1}{\beta _i}\right) \right\} \\&\qquad \times \prod _{i=2}^n t_i^{\alpha _i-1}(1-t_2-\dots -t_n)^{\alpha _1-1} \mathrm {d}t_2 \dots \mathrm {d}t_n, \end{aligned} \end{aligned}$$
(8)

where \(E_{n-1}=\{(t_2,\dots ,t_n):t_2>0, \dots , t_n>0, t_2+\dots +t_n\le 1\}\). Di Salvo (2008) demonstrated that, with transformation

$$\begin{aligned} \begin{aligned}&t_2=u_2 \\&t_3=u_3(1-u_2) \\&t_4=u_4(1-u_2)(1-u_3) \\&\dots \\&t_n=u_n(1-u_2)(1-u_3)\dots (1-u_{n-1}), \end{aligned} \end{aligned}$$

Equation (8) can be written as a multiple integral over the standard hypercube, that is,

$$\begin{aligned} \begin{aligned} \phi&=\frac{\varGamma (\gamma )}{\prod _{i=1}^n\varGamma (\alpha _i)}\int _{[0,1]^{n-1}} \exp \{x\sum _{i=2}^n u_i(\frac{1}{\beta _1}-\frac{1}{\beta _i})h_i(\mathbf {u})\}\\&\quad \times \prod _{i=2}^n u_i^{\alpha _i - 1}(1-u_i)^{\bar{\alpha _i}} \mathrm {d}u_2 \dots \mathrm {d}u_n, \end{aligned} \end{aligned}$$
(9)

where \(h_2 = 1\), \(h_i(\mathbf {u})=\prod _{j=2}^{i-1}(1-u_j)\), \(i=3,\dots , n\), and \(\bar{\alpha _i}=\sum _{j=i+1}^n \alpha _j + \alpha _1 - 1\), \(i=2, \dots , n-1\), \(\bar{\alpha _n}=\alpha _1-1\). Because of good analytical properties of integrand in Eq. (9), the multiple integral can be efficiently computed.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Hu, C., Pozdnyakov, V. & Yan, J. Density and distribution evaluation for convolution of independent gamma variables. Comput Stat 35, 327–342 (2020). https://doi.org/10.1007/s00180-019-00924-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00180-019-00924-9

Keywords

Navigation