The survival times, in days, of patients diagnosed with a severe form of a terminal illness are thought to be well modelled by an exponential($\theta$) distribution. We observe the survival times of n such patients. Our prior distribution for $\theta$ is a gamma(a, b) distribution.

$$L(x|\theta) = \theta^ne^{-\theta\sum_\limits{i=1}^{n}x_i}, \quad 0 \le x < \infty$$

Let $T = \sum_\limits{i=1}^{n}x_i$

Using a Gamma distribution as the prior for the exponential distribution likelihood.

$$p(\theta) = \frac{\beta^{\alpha}\theta^{\alpha - 1}e^{-\theta\beta}}{\Gamma(\alpha)}, \quad 0\le \theta < \infty$$

$$p(\theta|x) \propto L(T|\theta)p(\theta) =e^{-T\theta}\theta^{n} \theta^{\alpha - 1}e^{-\theta\beta}$$ $$\propto \theta^{\alpha + n - 1}e^{-\theta\big(T+\beta\big)}$$

$$p(\theta|T)\propto \text{ Gamma}\bigg(\text{ Shape }= \alpha + n, \text{ Rate } = \beta + T\bigg)$$

Where i'm getting confused is between rate and scale and the how to choose the hyperparameters.

Say if I had data for a year and the mean survival time for 100 patients was 50 days, I know that my T would be 5000. Also I know that my n would be 50.

I would have to develop the prior from other knowledge say, some database from a different state with similar study. So say my prior mean was 80 days, with standard deviation say of 15 days, I cannot seem to get my alpha and beta right such that when I put this model in R I get a reasonable looking posterior.

From the examples I see on the internet, I see that the exponential models the time between events, but I want to model the time of the event possibly? The only way I can get a reasonable looking distribution is if I use an invgamma function. Is this what I need to do? The inverse of the time between events is the time of the event?

Do I use $E[X] = \alpha \beta$ or do I use $E[X] = \frac{\alpha}{\beta}$ for example? A similar question would be life time of light bulbs I suppose. Has anybody got anything to share on this kind of problem?


  • $\begingroup$ The source of your confusion might be that for if $Y\sim Exp(\theta)$ then $E[Y]=\frac1\theta$. So you want the prior for $\theta$ to be concentrated around $\frac{1}{80}$, not around 80. $\endgroup$ Commented Oct 13, 2018 at 16:22
  • $\begingroup$ Thanks @RobinRyder I think you're right. However I have tried many things and maybe I'm thinking I have got it wrong when it's not. It was for an assignment that I have just handed in. I really couldn't get the question out because of this sticking point. Thank for your help. $\endgroup$
    – Bucephalus
    Commented Oct 14, 2018 at 7:43

1 Answer 1


Based on your comment, it sounds like you are interested in $\lambda=\frac1\theta$, ie $X\sim Exp(\frac1\lambda)$. For $\theta$, the conjugate prior is Gamma, so you are right that for $\lambda$, the conjugate prior is Inverse-Gamma.

I won't give all the details since this is homework, but you should be able to find the parameters of the inverse gamma that give you the appropriate prior mean and variance, and use the formula you gave to verify that the posterior mean is close to 50.


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.