[Theta,LogPost,ArVec,PosUpd] = arwm(Pos,NDraw,...)
[Theta,LogPost,ArVec,PosUpd,SgmVec,FinalCov] = arwm(Pos,NDraw,...)
Pos
[ poster ] - Initialised posterior simulator object.
NDraw
[ numeric ] - Length of the chain not including burn-in.
Theta
[ numeric ] - MCMC chain with individual parameters in rows.
LogPost
[ numeric ] - Vector of log posterior density (up to a constant) in each draw.
ArVec
[ numeric ] - Vector of cumulative acceptance ratios.
PosUpd
[ poster ] - Posterior simulator object with its properties updated so to capture the final state of the simulation.
SgmVec
[ numeric ] - Vector of proposal scale factors in each draw.
FinalCov
[ numeric ] - Final proposal covariance matrix; the final covariance matrix of the random walk step is Scale(end)^2*FinalCov.
'adaptProposalCov='
[ numeric | 0.5
] - Speed of adaptation of the Cholesky factor of the proposal covariance matrix towards the target acceptanace ratio, targetAR
; zero means no adaptation.
'adaptScale='
[ numeric | 1
] - Speed of adaptation of the scale factor to deviations of acceptance ratios from the target ratio, targetAR
.
'burnin='
[ numeric | 0.10
] - Number of burn-in draws entered either as a percentage of total draws (between 0 and 1) or directly as a number (integer greater that one). Burn-in draws will be added to the requested number of draws ndraw
and discarded after the posterior simulation.
'estTime='
[ true
| false
] - Display and update the estimated time to go in the command window.
'firstPrefetch='
[ numeric | Inf
] - First draw where parallelised pre-fetching will be used; Inf
means no pre-fetching.
'gamma='
[ numeric | 0.8
] - The rate of decay at which the scale and/or the proposal covariance will be adapted with each new draw.
'initScale='
[ numeric | 1/3
] - Initial scale factor by which the initial proposal covariance will be multiplied; the initial value will be adapted to achieve the target acceptance ratio.
'lastAdapt='
[ numeric | Inf
] - Last point at which the proposal covariance will be adapted; Inf
means adaptation will continue until the last draw. Can also be entered as a percentage of total draws (a number strictly between 0 and 1).
'nStep='
[ numeric | *1
] - Number of pre-fetched steps computed in parallel; only works with firstPrefetch=
smaller than NDraw
.
'progress='
[ true
| false
] - Display progress bar in the command window.
'saveAs='
[ char | empty ] - File name where results will be saved when the option 'saveEvery='
is used.
'saveEvery='
[ numeric | Inf
] - Every N draws will be saved to an HDF5 file, and removed from workspace immediately; no values will be returned in the output arguments Theta
, LogPost
, AR
, Scale
; the option 'saveAs='
must be used to specify the file name; Inf
means a normal run with no saving.
'targetAR='
[ numeric | 0.234
] - Target acceptance ratio.
The function poster/arwm
returns the simulated chain of parameters and the corresponding value of the log posterior density. To obtain simulated sample statistics for each parameter (such as posterior mean, median, percentiles, etc.) use the function poster/stats
to process the simulated chain and calculate the statistics.
The properties of the posterior object returned as the 4th output argument are updated so that they capture the final state of the posterior simulations. This can be used to initialize a next simulation at the point where the previous ended.
Set 'nStep='
greater than 1
, and 'firstPrefetch='
smaller than NDraw
to start a pre-fetching parallelised algorithm (pre-fetched will be all draws starting from 'firstPrefetch='
); to that end, a pool of parallel workers (using e.g. matlabpool
from the Parallel Computing Toolbox) must be opened before calling arwm
.
With pre-fetching, all possible paths 'nStep='
steps ahead (i.e. all possible combinations of reject/accept) are pre-evaluated in parallel, and then the resulting path is selected. Adapation then occurs only every 'nStep='
steps, and hence the results will always somewhat differ from a serial run. Identical results can be obtained by turning down adaptation before pre-fetching starts, i.e. by setting 'lastAdapt='
smaller than 'firstPrefetch='
(and, obviously, by re-setting the random number generator).
Brockwell, A.E., 2005. "Parallel Markov Chain Monte Carlo Simulation by Pre-Fetching," CMU Statistics Dept. Tech. Report 802.
Strid, I., 2009. "Efficient parallelisation of Metropolis-Hastings algorithms using a prefetching approach," SSE/EFI Working Paper Series in Economics and Finance No. 706.