Compute Acceptance Rates for Metropolis-Hastings and Reversible Jump Algorithms
This function computes the acceptance rates of the Metropolis-Hastings and reversible
jump algorithms from the MCMC output of bcct
and bict
objects.
accept_rate(object)
object |
An object of class |
Acceptance rates can be used to assess the performance of MCMC methods (in particular the peformance of the reversible jump method, Brooks et al, 2003).
This function will return an object of class "acceptrate"
which is a list with the
following components.
rj_ar |
Acceptance rate (as a %) of the reversible jump algorithm. |
mh_ar |
Acceptance rate (as a %) of the Metropolis-Hastings algorithm. |
Antony M. Overstall A.M.Overstall@soton.ac.uk.
Brooks, S.P., Giudici, P., & Roberts, G.O. (2003) Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions. Journal of the Royal Statistical Society, Series B, 65 (1), 3–55.
set.seed(1) ## set a seed for reproducibility data(AOH) test1<-bcct(formula=y~(alc+hyp+obe)^3,data=AOH,n.sample=500,prior="UIP") ## Create a bcct object for the AOH dataset for a very small number of ## iterations (500). accept_rate(test1) ## Calculate accept rates. Will get: #Acceptance rate of reversible jump proposals = 32.5581 % #Acceptance rate of Metropolis-Hastings proposals = 76.8595 %
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.