In the RW Metropolis, we must choose the increment covariance matrix $Sigma$ and the scaling factor $s$ . We often simply choose $Sigma$ to be either $I$ or the asymptotic covariance matrix. Thereby, the scaling of the RW Metropolis is critical to its successful use. In practice, we can choose the initial scaling factor as a function of the dimension $s_{0} = 2.93 / sqrt{d}$ according to the Roberts and Rosenthal guidelines. For more details, please refer to the Chapter 3 in Rossi et al. (2012).
R Implementation
We consider a simple example:
$$
y = alpha + beta x + epsilon, epsilon sim N(0, sigma^{2}),
$$
and test the RW Metropolis algorithm by simulated data. We set $alpha = -2$, $beta = 4$ and $sigma = 1$. We choose scaling factor $s = 2.93/sqrt{3}$ and start with (0,0,2). With 20,000 draws in total for each chain and regarding the first 5,000 draws as the burn-in period, we plotted the posterior probability distribution.
1 |
|
We can compare these distributions with the true values $alpha = -2$, $beta = 4$ and $sigma = 1$.
Scaling Factor
We can try different scaling factors and choose the best one.
1 |
|
An efficient scaling factor around $s_{0} = 1.69$ is $s^{*} = 1.86$.
References
Rossi, P. E., Allenby, G. M., & McCulloch, R. (2012). Bayesian statistics and marketing. John Wiley & Sons.
近期评论