The Markov chain Monte Carlo method (MCMC) is a method for approximating the posterior distribution for parameters of interest in the Bayesian framework. This option is invoked by using the command line option -mcmc N where N is the number of simulations performed. You will proabably also want to include the option -mcscale which dynamically scales the covariance matrix until a reasonable acceptance rate is observed. You may also want to use the -mcmult n option which scales the initial covariances matrix if the initial values are so large that arithmetic errors occur. One advantage of AD Model Builder over some other implementations of MCMC is that the mode of the posterior distribution together with the hessian at the mode is available to use for the MCMC routine. This information is used to implement a version of the Hastings-Metropolis algorithm. Another advantage is that with AD Model Builder it is possible to calculate the profile likelihood for a parameter of interest and compare the distribution to the MCMC distribution for that parameter. A large discrepancy may indicate that one or both estimates are inadequate. If you wish to do more simulations (and to carry on from where the last one ended use the -mcr option. The following figure compares the profile likelihood for the projected biomass to the estimates produced by the MCMC method for different sample sizes (25,000 and 2,500,000 samples) for the catage example.
A report containing the observed distributions is produced in the file root.hst. All objects of type sdreport i.e number, vector or matrix are included. It is possible to save the results of every n'th simulation by using the -mcsave n option. afterwords these values can be used by running the model with the -mceval option which will evaluate the userfunction once for every saved simulation value. At this time the function mceval_phase() will return the value true and can be used as a switch to perform desired calculations.