# Numerical values of parameters of posterior distribution

## Question

Investigators are wishing to perform Bayesian analysis for drug treatment duration that can be described using a exponential distribution with paramater $$\lambda$$ describing drug duration in months.

\begin{align*} f_X(x) = \lambda e^{-\lambda x} \quad x \geq 0, \; \lambda > 0 \end{align*}

With expected value

\begin{align*} \mathbb{E}(X) = \frac{1}{\lambda} \end{align*}

and cumulative distribution function

\begin{align*} F_X(x) = \begin{cases} 1 - e^{-\lambda x} &\; x \geq 0 \\ 0 & \; x < 0 \end{cases} \end{align*} Previously it had been found the median duration of drug was 3 months.

The investigators have chosen a Gamma distribution as a prior distribution of parameter $$\lambda$$

\begin{align*} f(\lambda; \alpha, \beta) = \frac{\beta^{\alpha}\lambda^{\alpha - 1}e^{-\beta \lambda}}{\Gamma(\alpha)} \; \lambda >0 \; \alpha > 0 \; \beta > 0 \end{align*}

With expected value

\begin{align*} \mathbb{E}(X) = \frac{\alpha}{\beta} \end{align*}

The investigators perform a study in n = 17 participants using a new formulation of the drug that they hope will enable longer duration of treatment than the current standard. These participants have a mean duration of 4.9 months. We assume that the prior value of $$\alpha = 3$$.

Given the numerical values of the parameters of the posterior distribution

### My attempt

Using the CDF, the median value of $$x$$ can be shown to be $$\frac{\ln(2)}{\lambda}$$. Using the fact that the median time in months was 3. Therefore, the expected value of $$\lambda$$ in the would be $$\lambda = \frac{\ln2}{3}$$

Calculating the likelihood function for the exponential distribution.

\begin{align} l(x_i | \lambda) = \lambda^{n}e^{-\lambda\sum_{i =1}^{n} x_i} \end{align}

Then to perform the Bayesian analysis, we can examine the proportionality of the numerator with regards to the likelihood function and the prior

\begin{align} \mathrm{Pr}(\lambda | x_i) \propto \mathrm{Pr}(x_i | \lambda) \cdot \mathrm{Pr}(\lambda) \end{align}

This results in the following posterior distribution with omission of terms that do not depend on parameter $$\lambda$$.

\begin{align} \mathrm{Pr}(\lambda | x_i) \propto &= \lambda^{n+\alpha - 1}e^{-\lambda\left(\sum_{i = 1}^{n} x_i + \beta \right)} \end{align}

Therefore, the posterior distribution follows a shape of a Gamma distribution.

\begin{align*} \mathrm{Pr}(\lambda | x_i) \sim \mathrm{Gamma}\left(\alpha + n - 1, \beta + \sum_{i = 1}^{n} x_i\right) \end{align*}

### Concerns

I am unsure where to go with this to give numerical estimates for each parameter. Would I have to use the fact that I know the number of $$n$$ participants now to obtain $$\sum x_i$$ by the mean? Any help would be appreciated.

Thank you!

I am not sure where the $$-1$$ comes from in $$\alpha + n-1$$ if your original prior is $$\mathrm{Gamma}\left(\alpha, \beta \right)$$. I would have thought a posterior $$\mathrm{Gamma}\left(\alpha+n, \beta +\sum x_i\right) = \mathrm{Gamma}\left(\alpha+n, \beta +n\bar x\right)$$ was what you would want.
You have $$\alpha=3$$ for your prior; you also need $$\beta$$. Perhaps you are supposed to deduce it from "Previously it had been found the median duration of drug was $$3$$ months." There does not seem to be an obviously correct way of doing this but you could think about using your "the expected value of $$\lambda$$ in the would be $$\lambda = \frac{\ln 2}{3}$$" and then divide $$\alpha=3$$ by this to suggest using $$\beta\approx 12.984$$.
So I would be tempted to use a $$\mathrm{Gamma}\left(\alpha+n, \beta +n\bar x\right)$$ posterior for the rate $$\lambda$$ where $$\alpha+n = 3+17 = 20$$ and $$\beta +n\bar x = 12.984 +17 \times 4.7 \approx 92.884$$.