lAccept.ratio: Acceptance probability in the MCMC algorithm.

View source: R/lAccept.ratio.r

lAccept.ratioR Documentation

Acceptance probability in the MCMC algorithm.

Description

Logarithm of the acceptance probability

Usage

lAccept.ratio(
  cur.par,
  prop.par,
  llh.cur,
  lprior.cur,
  dat,
  likelihood,
  proposal,
  prior,
  Hpar,
  MCpar
)

Arguments

cur.par

The current parameter in the Markov chain

prop.par

The candidate parameter

dat

An angular data set, e.g., constructed by cons.angular.dat: A matrix which rows are the Cartesian coordinates of points on the unit simplex (summing to one).

likelihood

The likelihood function. Should be of type
function(x, par, log, vectorial), where log and vectorial are logical flags indicating respectively if the result is to be returned on the log-scale, and if the value is a vector of length nrow(x) or a single number (the likelihood, or the log-likelihood, for the data set x). See dpairbeta or dnestlog for templates.

proposal

The proposal function: of type
function(type = c("r","d"), cur.par, prop.par, MCpar, log) . Should return the (logarithm of) the proposal density for the move cur.par --> prop.par if type == "d". If type =="r", proposal must return a candidate parameter, depending on cur.par, as a vector. See proposal.pb or proposal.nl for templates.

prior

The prior distribution: of type
function(type=c("r","d"), n ,par, Hpar, log, dimData ), where dimData is the dimension of the sample space (e.g., for the two-dimensional simplex (triangle), dimData=3. Should return either a matrix with n rows containing a random parameter sample generated under the prior (if type == "d"), or the density of the parameter par (the logarithm of the density if log==TRUE. See prior.pb and prior.nl for templates.

Hpar

A list containing Hyper-parameters to be passed to prior.

MCpar

A list containing MCMC tuning parameters to be passed to proposal.

Details

lAccept.ratio is a functional: likelihood,proposal,prior are user defined functions. Should not be called directly, but through the MCMC sampler posteriorMCMC generating the posterior.

Value

The log-acceptance probability.


lbelzile/BMAmevt documentation built on April 28, 2023, 2:29 p.m.