Learn R Programming

PAWL (version 0.5)

adaptiveMH: Adaptive Metropolis-Hastings

Description

Adaptive Metropolis-Hastings algorithm, with parallel chains. The adaptation is such that it targets an acceptance rate.

Usage

adaptiveMH(target, AP, proposal, verbose)

Arguments

target
Object of class target: specifies the target distribution. See the help of target. If the target is discrete, target must contain the slots dproposal, rproposal and proposalparam that specify the proposal kernel in the Metropolis-Hastings step. Otherwise the default is an adaptive gaussian random walk.
AP
Object of class "tuningparameters": specifies the number of chains, the number of iterations, and what should be stored during along the run. See the help of tuningparameters.
proposal
Object of class "proposal": specifies the proposal distribution to be used to propose new values and to compute the acceptance rate. See the help of proposal. If this is not specified and the target is continuous, then the default is an adaptive gaussian random walk.
verbose
Object of class "logical": if TRUE (default) then prints some indication of progress in the console.

Value

The function returns a list holding various information:
finalchains
The last point of each chain.
acceptrates
The vector of acceptance rates at each step.
sigma
The vector of the standard deviations used by the MH kernel along the iterations. If the proposal was adaptive, this allows to check how the adaptation behaved.
allchains
If asked in the tuning parameters, the chain history.
alllogtarget
If asked in the tuning parameters, the associated log density evaluations.
meanchains
If asked in the tuning parameters, the mean (component-wise) of each chain.

See Also

preexplorationAMH