Rev Language Reference


mcmcmc - Metropolis-Coupled MCMC analysis object

The Mcmcmc analysis object keeps a model and the associated moves and monitors. The object is used to run Metropolis Couped Markov chain Monte Carlo (Mcmcmc) simulation on the model, using the provided moves, to obtain a sample of the posterior probability distribution. During the analysis, the monitors are responsible for sampling model parameters of interest.

Usage

mcmcmc(Model model, Monitor[] monitors, Move[] moves, String moveschedule, Natural nruns, String combine, Natural ntries, Natural nchains, Natural swapInterval, RealPos deltaHeat, Probability[] heats, Bool tuneHeat, Probability tuneHeatTarget, String swapMethod, Natural swapInterval2, String swapMode)

Arguments

model : Model (pass by value)
The model graph.
monitors : Monitor[] (pass by value)
The monitors used for this analysis.
moves : Move[] (pass by value)
The moves used for this analysis.
moveschedule : String (pass by value)
The strategy how the moves are used.
Default : random
Options : sequential|random|single
nruns : Natural (pass by value)
The number of replicate analyses.
Default : 1
combine : String (pass by value)
How should we combine the traces once the simulation is finished.
Default : none
Options : sequential|mixed|none
ntries : Natural (pass by value)
The number of initialization attempts.
Default : 1000
nchains : Natural (pass by value)
The number of chains to run.
Default : 4
swapInterval : Natural (pass by value)
The interval at which swaps (between neighbor chains if the swapMethod is neighbor or both, or between chains chosen randomly if the swapMethod is random) will be attempted.
Default : 10
deltaHeat : RealPos (pass by value)
The delta parameter for the heat function.
Default : 0.2
heats : Probability[] (pass by value)
The heats of chains, starting from the cold chain to hotter chains so the first value must be 1.0. If heats are specified directly then the delta parameter would be ignored.
Default : NULL
tuneHeat : Bool (pass by value)
Should we tune the heats during burnin?
Default : FALSE
tuneHeatTarget : Probability (pass by value)
The acceptance probability of adjacent chain swaps targeted by heats auto-tuning.
Default : 0.23
swapMethod : String (pass by value)
The method used to swap chains.
Default : neighbor
Options : neighbor|random|both
swapInterval2 : Natural (pass by value)
The interval at which swaps between randomly chosen chains will be attempted (if the swapMethod is specified as both; otherwise it would be the same as swapInterval if not provided).
Default : NULL
swapMode : String (pass by value)
Whether make a single attempt per swap interval or attempt multiple (= nchains-1 or choose(nchains,2) for neighbor or random swaps, respectively) times.
Default : single
Options : single|multiple

Details

The Mcmcmc analysis object produced by a call to this function keeps copies of the model and the associated moves and monitors. The Mcmcmc analysis object is used to run Markov chain Monte Carlo (Mcmcmc) simulation on the model, using the provided moves, to obtain a sample of the posterior probability distribution. During the analysis, the monitors are responsible for sampling model parameters of interest.

Example

# Create a simple model (unclamped)
a ~ exponential(1)
mymodel = model(a)

# Create a move vector and a monitor vector
moves[1] = mvScale(a, lambda=1.0, weight=1.0)
monitors[1] = mnFile(a,"output/out.log")

# Create an mcmcmc object
myMcmcmcObject = mcmcmc( mymodel, monitors, moves, nchains=4, deltaHeat=5)

# Run a short analysis
myMcmcmcObject.burnin( generations = 400, tuningInterval = 100)
myMcmcmcObject.run( generations = 400)

# print the summary of the operators (now tuned)
myMcmcmcObject.operatorSummary()

Methods

See Also