Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

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

Value

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.

Author(s)

Antony M. Overstall A.M.Overstall@soton.ac.uk.

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

Examples

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 %

conting

Bayesian Analysis of Contingency Tables

v1.7
GPL-2
Authors
Antony M. Overstall
Initial release
2019-04-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.