Learn R Programming

conting (version 1.4)

accept_rate: Compute Acceptance Rates for Metropolis-Hastings and Reversible Jump Algorithms

Description

This function computes the acceptance rates of the Metropolis-Hastings and reversible jump algorithms from the MCMC output of bcct and bict objects.

Usage

accept_rate(object)

Arguments

object
An object of class "bcct" or "bict".

Value

  • This function will return an object of class "acceptrate" which is a list with the following components.
  • rj_arAcceptance rate (as a %) of the reversible jump algorithm.
  • mh_arAcceptance rate (as a %) of the Metropolis-Hastings algorithm.

Details

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).

References

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.

See Also

print.acceptrate, bcct, bict.

Examples

Run this code
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 %

Run the code above in your browser using DataLab