감마 랜덤 변수의 총합


35

동일한 스케일 매개 변수를 가진 감마 랜덤 변수의 합이 다른 감마 랜덤 변수 라는 것을 읽었습니다 . 또한 Moschopoulos 의 논문 에서 일반적인 감마 랜덤 변수 세트를 요약하는 방법을 설명했습니다. Moschopoulos의 방법을 구현하려고 시도 했지만 아직 성공하지 못했습니다.

일반적인 감마 랜덤 변수 세트의 요약은 어떤 모양입니까? 이 질문을 구체적으로 만들기 위해 다음과 같은 모습은 무엇입니까?

감마(,1)+감마(4,2)+감마(5,1)

위의 매개 변수가 특별히 공개되지 않은 경우 다른 것을 제안하십시오.


4
두 가지 감마 분포 의 합에 대한 명시 적 솔루션이 stats.stackexchange.com/a/252192 에 게시되었습니다 .
whuber

모든 감마 분포가 모양 모수 1 (즉, 지수)을 갖는 특별한 예를 저 지수 분포 (패밀리) 라고합니다 . 지수 분포가 두 개인 경우 stats.stackexchange.com/questions/412849에 명시 적 공식이 있습니다 .
whuber

답변:


37

먼저, 같은 스케일 팩터를 가진 모든 합을 합합니다 : a + Γ ( m , β ) 변이체 a ΓΓ(n,β)Γ(m,β) 변이체를 형성합니다.Γ(n+m,β)

다음에, 특성 함수 (CF) 관찰 ( 1 - I β t ) - N ,이 분포의 합계의 CF는 제품 어디서Γ(n,β)(1iβt)n

j1(1iβjt)nj.

모두 정수, 본 제품은 부분적으로 팽창 분획 (A) 내로 선형 조합( 1 - I β J t ) - ν 를 Where ν이 사이의 정수이다 (1)N , j는 . β 1 = 1 예에서 , n 1 = 8 ( Γ ( 3 , 1 ) 의 합으로부터 ) 및 β 2 = 2 ,nj (1iβjt)νν1njβ1=1,n1=8 Γ ( 5 , 1의 합에서)Γ(3,1)Γ(5,1) 우리는 발견β2=2,n2=4

1(1it)81(12it)4=1(x+i)88i(x+i)740(x+i)6+160i(x+i)5+560(x+i)41792i(x+i)35376(x+i)2+15360ix+i+256(2x+i)4+2048i(2x+i)39216(2x+i)230720i2x+i.

The inverse of taking the cf is the inverse Fourier Transform, which is linear: that means we may apply it term by term. Each term is recognizable as a multiple of the cf of a Gamma distribution and so is readily inverted to yield the PDF. In the example we obtain

ett75040+190ett6+13ett5+203ett4+83et2t3+2803ett3128et2t2+896ett2+2304et2t+5376ett15360et2+15360et

for the PDF of the sum.

This is a finite mixture of Gamma distributions having scale factors equal to those within the sum and shape factors less than or equal to those within the sum. Except in special cases (where some cancellation might occur), the number of terms is given by the total shape parameter n1+n2+ (assuming all the nj are different).


104Γ(8,1)Γ(4,2) distributions. On it is superimposed the graph of 104 times the preceding function. The fit is very good.

Figure


Moschopoulos carries this idea one step further by expanding the cf of the sum into an infinite series of Gamma characteristic functions whenever one or more of the ni is non-integral, and then terminates the infinite series at a point where it is reasonably well approximated.


2
f(x)=i=1naifi(x)
ai>0iai=1, that is, the ai are probabilities and the pdf can be interpreted as the (law of total probability) weighted sum of conditional pdfs given various conditions that occur with probabilities ai. However, in the sum above, some of the coefficients are negative and thus the standard interpretation of the mixture does not apply.
Dilip Sarwate

@Dilip That's a good point. What makes this case interesting is that although some of the coefficients may be negative, nevertheless this combination is still a valid distribution (by its very construction).
whuber

Can this approach be extended to account for addition of dependent variables? In particular, I want to add up 6 distributions with each having some correlation with the others.
masher

11

I will show another possible solution, that is quite widely applicable, and with todays R software, quite easy to implement. That is the saddlepoint density approximation, which ought to be wider known!

For terminology about the gamma distribution, I will follow https://en.wikipedia.org/wiki/Gamma_distribution with the shape/scale parametrization, k is shape parameter and θ is scale. For the saddlepoint approximation I will follow Ronald W Butler: "Saddlepoint approximations with applications" (Cambridge UP). The saddlepoint approximation is explained here: How does saddlepoint approximation work? here I will show how it is used in this application.

Let X be a random variable with existing momentgenerating function

M(s)=EesX
which must exist for s in some open interval that contains zero. Then define the cumulant generating function by
K(s)=logM(s)
It is known that EX=K(0),Var(X)=K(0). The saddlepoint equation is
K(s^)=x
which implicitely defines s as a function of x (which must be in the range of X). We write this implicitely defined function as s^(x). Note that the saddlepoint equation always has exactly one solution, because the cumulant function is convex.

Then the saddlepoint approximation to the density f of X is given by

f^(x)=12πK(s^)exp(K(s^)s^x)
This approximate density function is not guaranteed to integrate to 1, so is the unnormalized saddlepoint approximation. We could integrate it numerically and the renormalize to get a better approximation. But this approximation is guaranteed to be non-negative.

Now let X1,X2,,Xn be independent gamma random variables, where Xi has the distribution with parameters (ki,θi). Then the cumulant generating function is

K(s)=i=1nkiln(1θis)
defined for s<1/max(θ1,θ2,,θn). The first derivative is
K(s)=i=1nkiθi1θis
and the second derivative is
K(s)=i=1nkiθi2(1θis)2.
In the following I will give some R code calculating this, and will use the parameter values n=3, k=(1,2,3), θ=(1,2,3). Note that the following R code uses a new argument in the uniroot function introduced in R 3.1, so will not run in older R's.
shape <- 1:3 #ki
scale <- 1:3 # thetai
# For this case,  we get expectation=14,  variance=36
make_cumgenfun  <-  function(shape, scale) {
      # we return list(shape, scale, K, K', K'')
      n  <-  length(shape)
      m <-   length(scale)
      stopifnot( n == m, shape > 0, scale > 0 )
      return( list( shape=shape,  scale=scale, 
                    Vectorize(function(s) {-sum(shape * log(1-scale * s) ) }),
                    Vectorize(function(s) {sum((shape*scale)/(1-s*scale))}) ,
                    Vectorize(function(s) { sum(shape*scale*scale/(1-s*scale)) }))    )
}

solve_speq  <-  function(x, cumgenfun) {
          # Returns saddle point!
          shape <- cumgenfun[[1]]
          scale <- cumgenfun[[2]]
          Kd  <-   cumgenfun[[4]]
          uniroot(function(s) Kd(s)-x,lower=-100,
                  upper = 0.3333, 
                  extendInt = "upX")$root
}

make_fhat <-  function(shape,  scale) {
    cgf1  <-  make_cumgenfun(shape, scale)
    K  <-  cgf1[[3]]
    Kd <-  cgf1[[4]]
    Kdd <- cgf1[[5]]
    # Function finding fhat for one specific x:
    fhat0  <- function(x) {
        # Solve saddlepoint equation:
        s  <-  solve_speq(x, cgf1)
        # Calculating saddlepoint density value:
        (1/sqrt(2*pi*Kdd(s)))*exp(K(s)-s*x)
    }
    # Returning a vectorized version:
    return(Vectorize(fhat0))
} #end make_fhat

 fhat  <-  make_fhat(shape, scale)
plot(fhat, from=0.01,  to=40, col="red", main="unnormalized saddlepoint approximation\nto sum of three gamma variables")

resulting in the following plot: enter image description here

I will leave the normalized saddlepoint approximation as an exercise.


1
This is interesting, but I cannot make your R code work to compare the approximation to the exact answer. Any attempt to invoke fhat generates errors, apparently in the use of uniroot.
whuber

3
What is your R version? The codes uses a new argument to uniroot, extendInt, which was introduces in R version 3.1 If your R is older, you might try to remove that, (and extend the interval given to uniroot). But that will make the code less robust!
kjetil b halvorsen

10

The Welch–Satterthwaite equation could be used to give an approximate answer in the form of a gamma distribution. This has the nice property of letting us treat gamma distributions as being (approximately) closed under addition. This is the approximation in the commonly used Welch's t-test.

(The gamma distribution is can be viewed as a scaled chi-square distribution, and allowing non-integer shape parameter.)

I've adapted the approximation to the k,θ parametrization of the gamma distriubtion:

ksum=(iθiki)2iθi2ki

θsum=θikiksum

Let k=(3,4,5), θ=(1,2,1)

So we get approximately Gamma(10.666... ,1.5)

We see the shape parameter k has been more or less totalled, but slightly less because the input scale parameters θi differ. θ is such that the sum has the correct mean value.


6

An exact solution to the convolution (i.e., sum) of n gamma distributions is given as Eq. (1) in the linked pdf by DiSalvo. As this is a bit long, it will take some time to copy it over here. For only two gamma distributions, their exact sum in closed form is specified by Eq. (2) of DiSalvo and without weights by Eq. (5) of Wesolowski et al., which also appears on the CV site as an answer to that question. That is,

GDC(a,b,α,β;τ)={baβαΓ(a+α)ebττa+α11F1[α,a+α,(bβ)τ],τ>00,τ0,
where the notation in the questions above; Gamma(a,b)Γ(a,1/b), here. That is, b and β are rate constants here and not time scalars.
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.