# Deriving probability distributions

Suppose I had a random variable, X, that followed a Gamma distribution.
A Gamma distribution can be defined as $$\Gamma(\alpha,\beta)$$, where $$\alpha$$ and $$\beta$$ are the 'scale' and 'shape' parameters.
Now suppose if $$\alpha$$ was a random variable, say following a binomial distribution, how would I then represent the distribution of X.

I was thinking that since the parameter $$\alpha$$ now represents a random variable, the distribution of X, would simply be a binomial distribution multiplied by a Gamma distribution???
Would it be correct to do this??

No. That is wrong.

$$X|\alpha$$ is distributed as $$\Gamma(\alpha,\beta)$$ and $$\alpha$$ is distributed as Bin(n,p).

Therefore, $$f(X=x|\alpha)f_\alpha(\alpha)=f_{(x,\alpha)}(x,\alpha)$$.

Now, to get the distribution of x, you just sum over all alpha. That is,

$$f_x(x)=\sum_{i=0}^nf(X=x|\alpha=i)f_\alpha(\alpha=i)$$.

I'm not sure what this distribution is as I haven't calculated it yet. I doubt it will reduce to something familiar.

However! If alpha was distributed as poisson then it becomes an interesting distribution which is a really good exercise.

If you don't understand any of this just say so.

Last edited:
Thanks for the help ZioX, much appreciated!
I had a feeling I wasn't doing it right..... but I'm not too sure I fully understand what you're doing. I think I get the gist of what you're doing, but just getting a bit bogged down with the mathematical notation you're using.

So firstly I presume that
$$X|\alpha$$
means "the random variable X given alpha"?
But what exactly, (in words), do you mean by
$$f(X=x|\alpha)f_\alpha(\alpha)=f_{(x,\alpha)}(x,\alpha)$$

Also, I'm curious as to why you say, it would be interesting if alpha was distributed as Poisson, as this is one of the cases I will also be looking at!
Is there some standard distribution that comes out when you use a Poisson??

I'm slightly confused about the answer that's given here. I needed to find the distribution of $$X|\alpha$$, where $$X|\alpha$$ is distributed as a Gamma, $$\Gamma(\alpha,\beta)$$, and $$\alpha$$ is distributed as Bin(n,p).

The answer was to the (marginal) distribution of X, you sum over to get $$f_x(x)=\sum_{i=0}^nf(X=x|\alpha=i)f_\alpha(\alpha= i)$$

But if X is gamma distributed, and a gamma distribution is a continous distribution, then shouldn't the above formulae be an intregal rather than a summation??