IRIS Toolbox Reference Manual

## arwm

Adaptive random-walk Metropolis posterior simulator

#### Syntax

    [Theta,LogPost,AR,Scale,FinalCov] = arwm(Pos,NDraw,...)

#### Input arguments

- `Pos` [ poster ] - Initialised posterior simulator object.

- `NDraw` [ numeric ] - Length of the chain not including burn-in.

#### Output arguments

- `Theta` [ numeric ] - MCMC chain with individual parameters in rows.

- `LogPost` [ numeric ] - Vector of log posterior density (up to a constant) in each draw.

- `AR` [ numeric ] - Vector of cumulative acceptance ratios in each draw.

- `Scale` [ 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.

#### Options

- `'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.

#### Description

Use the `poster/stats` function to process the simulated chain of parameters, and calculate selected statistics.

##### Parallelised ARWM

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

#### References

1. Brockwell, A.E., 2005. "Parallel Markov Chain Monte Carlo Simulation by Pre-Fetching," CMU Statistics Dept. Tech. Report 802.

2. Strid, I., 2009. "Efficient parallelisation of Metropolis-Hastings algorithms using a prefetching approach," SSE/EFI Working Paper Series in Economics and Finance No. 706.

#### Example

IRIS Toolbox. Copyright © 2007—2013 Jaromir Benes.