Suppose that the number of defects on a roll of magnetic recording tape has a Poisson distribution for which the mean \(\theta\) is unknown and that the prior distribution of \(\theta\) is a gamma distribution with parameters \(\alpha = 3\) and \(\beta = 1\). When five rolls of this tape are selected at random and inspected, the number of defects found on the rolls are \(2, 2, 6, 0,\) and \(3\). If the squared error loss function is used, what is the Bayes estimate of \(\theta\)?
Let \(Y_1, \ldots, Y_n \mid \theta \stackrel{\text{i.i.d.}}{\sim} \text{Poisson}(\theta)\).
The likelihood function is: \[L(\theta \mid \mathbf{y}) \propto e^{-n\theta} \theta^{\sum_{i=1}^n y_i}\]
The prior distribution is: \[\theta \sim \text{Gamma}(\alpha, \beta)\]
with probability density function: \[f(\theta) \propto \theta^{\alpha - 1} e^{-\beta \theta}, \quad \theta > 0\]
Given: \(\alpha = 3\), \(\beta = 1\)
By Bayes’ theorem:
\[f(\theta \mid \mathbf{y}) \propto f(\theta) \times L(\theta \mid \mathbf{y})\]
\[f(\theta \mid \mathbf{y}) \propto \left[\theta^{\alpha - 1} e^{-\beta \theta}\right] \times \left[e^{-n\theta} \theta^{\sum_{i=1}^n y_i}\right]\]
\[f(\theta \mid \mathbf{y}) \propto \theta^{\alpha + \sum_{i=1}^n y_i - 1} e^{-(\beta + n)\theta}\]
This is the kernel of a Gamma distribution. Therefore:
\[\theta \mid \mathbf{y} \sim \text{Gamma}\left(\alpha + \sum_{i=1}^n y_i,\; \beta + n\right)\]
Under squared error loss, the Bayes estimate is the posterior mean.
For a Gamma\((a, b)\) distribution, the mean is \(a/b\).
Thus: \[\hat{\theta}_B = E[\theta \mid \mathbf{y}] = \frac{\alpha + \sum_{i=1}^n y_i}{\beta + n}\]
Given: - \(\alpha = 3\) - \(\beta = 1\) - \(n = 5\) - \(\sum_{i=1}^5 y_i = 2 + 2 + 6 + 0 + 3 = 13\)
\[\hat{\theta}_B = \frac{3 + 13}{1 + 5} = \frac{16}{6} = \frac{8}{3}\]
# Optional R calculation
alpha <- 3
beta <- 1
n <- 5
sum_y <- sum(c(2, 2, 6, 0, 3))
bayes_estimate <- (alpha + sum_y) / (beta + n)
bayes_estimate
## [1] 2.666667