6
$\begingroup$

Given a gamma distribution with PDF:

$f(x;\alpha;\beta) = \frac{x^{\alpha-1} e^{-\frac{x}{\beta}}}{\Gamma(\alpha) \beta^\alpha}$

with a shape parameter $\alpha > 0$, a scale parameter $\beta > 0$ and $\Gamma(k)$ the gamma function.

The mean is then $\alpha\beta$ and variance $\alpha\beta^2$, hence

$\alpha = \frac{1}{Var(X) \lambda^2},\ \beta = Var(X) \lambda\ $

Samples from this gamma distribution are divided into 2 classes, samples smaller than a certain threshold T, and samples larger than or equal to T.

What is the mean of class 1 and class 2, in this case?

$\endgroup$
1
  • 2
    $\begingroup$ Presumably $f$ is the PDF and $x \gt 0.$ Essentially by definition, the answers must be expressed in terms of the incomplete Gamma function, except when $\alpha$ is a small integer. $\endgroup$
    – whuber
    Commented Aug 20, 2018 at 13:48

2 Answers 2

4
$\begingroup$

Let $\mathscr{C}_1$ and $\mathscr{C}_2$ denote classes 1 and 2 respectively. Since $X \sim \text{Ga}(\alpha, \beta)$ you have:

$$\begin{equation} \begin{aligned} \mathbb{E}(X | X \in \mathscr{C}_1) = \mathbb{E}(X | X < T) &= \frac{\mathbb{E}(X \cdot \mathbb{I}(X < T))}{\mathbb{P}(X < T)} \\[6pt] &= \frac{ \int_0^T x \cdot \text{Ga}(x|\alpha, \beta) dx }{ \int_0^T \text{Ga}(x|\alpha, \beta) dx } \\[6pt] &= \frac{ \int_0^T x^\alpha e^{-x/\beta} dx }{ \int_0^T x^{\alpha-1} e^{-x/\beta} dx } \\[6pt] &= \beta \cdot \frac{ \int_0^T (x/\beta)^\alpha e^{-x/\beta} dx }{ \int_0^T (x/\beta)^{\alpha-1} e^{-x/\beta} dx } \\[6pt] &= \beta \cdot\frac{ \int_0^{T/\beta} y^\alpha e^{-y} dy }{ \int_0^{T/\beta} y^{\alpha-1} e^{-y} dy } \\[6pt] &= \beta \cdot\frac{ \gamma(\alpha+1,T/\beta) }{ \gamma(\alpha,T/\beta) }, \\[6pt] \end{aligned} \end{equation}$$

where $\gamma$ is the lower incomplete gamma function. Similarly, you have:

$$\begin{equation} \begin{aligned} \mathbb{E}(X | X \in \mathscr{C}_2) = \mathbb{E}(X | X \geqslant T) &= \frac{\mathbb{E}(X \cdot \mathbb{I}(X \geqslant T))}{\mathbb{P}(X \geqslant T)} \\[6pt] &= \frac{ \int_T^\infty x \cdot \text{Ga}(x|\alpha, \beta) dx }{ \int_T^\infty \text{Ga}(x|\alpha, \beta) dx } \\[6pt] &= \frac{ \int_T^\infty x^\alpha e^{-x/\beta} dx }{ \int_T^\infty x^{\alpha-1} e^{-x/\beta} dx } \\[6pt] &= \beta \cdot \frac{ \int_T^\infty (x/\beta)^\alpha e^{-x/\beta} dx }{ \int_T^\infty (x/\beta)^{\alpha-1} e^{-x/\beta} dx } \\[6pt] &= \beta \cdot\frac{ \int_{T/\beta}^\infty y^\alpha e^{-y} dy }{ \int_{T/\beta}^\infty y^{\alpha-1} e^{-y} dy } \\[6pt] &= \beta \cdot\frac{ \Gamma(\alpha+1,T/\beta) }{ \Gamma(\alpha,T/\beta) }, \\[6pt] \end{aligned} \end{equation}$$

where $\Gamma$ is the upper incomplete gamma function.

$\endgroup$
3
  • 2
    $\begingroup$ The ratio of the two incomplete gamma functions can be changed into an expression with a single incomplete gamma function using the property $$\gamma(\alpha+1,T) = \alpha\gamma(\alpha,T)-T^\alpha e^{-T}$$ such that we can write $\mathbb{E}f_T(x)$ also like: $$\mathbb{E}f_T(x) = \beta \frac{\gamma(\alpha+1,T)}{\gamma(\alpha,T)} = \beta \left( \alpha - \frac{T^\alpha e^T}{ \gamma(\alpha,T) }\right) $$ $\endgroup$ Commented Aug 21, 2018 at 10:45
  • 1
    $\begingroup$ Fair enough, though I'm not convinced that that form is any simpler. $\endgroup$
    – Ben
    Commented May 13, 2023 at 2:09
  • $\begingroup$ I do not know anymore why I came up with that 'simplification' 5 years ago. Possibly I just saw the ratio with only the small and integer valued difference in the parameters $\alpha$ and $\alpha +1$ and was curious whether that could be simplified. Well that final function has a gamma function less, but it is indeed not particularly simpler. Nowadays I would stress the $\alpha\beta$ term and write it as $$\beta\alpha - \frac{\beta T^\alpha e^T}{ \gamma(\alpha,T)}$$ $\endgroup$ Commented May 13, 2023 at 7:57
6
$\begingroup$

I wanted to comment but I don't have enough reputation to comment. So I hope this will be allowed to stay as an "answer". There's an error in Ben's derivation: when switching variables from $x$ to $y=x/\beta$, the limit of integration $T$ needs to be changed to $T/\beta$ (so scale is taken out). Thus the result (also using Sextus Empiricus's simplification) is $$\mathbb{E}[X\mid X<T]=\beta\cdot\frac{\gamma(\alpha+1,T/\beta)}{\gamma(\alpha,T/\beta)}=\beta\left(\alpha-\frac{(T/\beta)^\alpha e^{-T/\beta}}{\gamma(\alpha,T/\beta)}\right).$$ That is, truncation at $T$ reduces the mean by $\displaystyle\beta\frac{(T/\beta)^\alpha e^{-T/\beta}}{\gamma(\alpha,T/\beta)}$.

Ben, your answer is accepted, so if you see this, could you edit your answer?

EDIT AFTER A FEW DAYS: I just realized that we can also write the truncated mean as $$\mathbb E[X\mid X<T]=\alpha\beta\left[1-\beta\cdot\frac{\text{pdf}(T;\alpha+1,\beta)}{\text{cdf}(T;\alpha,\beta)}\right].$$ This form may be easier for computation using pdf/cdf functions (I am thinking R). It's also intuitive: if we take $T$ to $\infty$, the second term in brackets vanishes, and we recover the Gamma mean $\alpha\beta$.

$\endgroup$
1
  • 2
    $\begingroup$ Thanks for this correction --- I did not see it until today. My answer is now corrected. $\endgroup$
    – Ben
    Commented Sep 1, 2023 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.