# Starting values for MCMC methods

In Stat-JR, although we have known that starting values are clearly an important part of MCMC methods, we have previously not spent much time incorporating options to allow user-specific starting values. Therefore the starting values used have been defaults that were hard to change. In this new release things have been improved with the addition of some new features, and we illustrate these here for a few estimation engines .

## eSTAT engine

The in-built eSTAT engine can be used for many models and with many templates and you will notice that in this version an additional input “Use default starting values” has been added when eSTAT is chosen. If you say “yes”, then default values will be used which are the same for each chain, and so the only differences you see are due to a different random number seed being set for each chain. It is quite hard to illustrate the effect of setting starting values, as for simple examples (or examples that mix well) it is hard to see the impact. We will therefore illustrate this feature using the *rats* dataset that was used in Stat-JR’s Advanced guide to illustrate methods such as blocking and orthogonal parameterisation for improving MCMC mixing.

So, to start with select *Regression1* from the *template* list and *rats* from the *dataset* list and click on **Run** setting the inputs as follows:

Here we are using default starting values but have chosen no burnin (length 0) so that we can observe the chains from the first iteration. Clicking on **Next** and **Run** we can then view the chain for beta_0 by selecting *beta_0.png* in its own tab to get the following:

Interestingly here the first iteration moves the 3 chains apart but then although they are mixing poorly they quickly begin overlapping.

Now we will opt *not *to use the default starting values, by clicking on **Change Estimation settings** and using the same inputs as before, but setting up starting values as follows:

Here you will see that (in the current version of the software) the user has the option of setting starting values for all variables including the deviance and derived quantities, however these particular values will not impact on the algorithm. It is also perfectly acceptable to leave boxes blank in which case the default values for that parameter will be used.

This time clicking on **Next** and **Run** gives the following:

Here we see that the chains are highly spread out – in fact the intercepts get spread very far apart in the first iteration as they are updated first and conditional on the slope parameters, beta_1. It then takes around 700 iterations for the chains to converge together. If we had set a burn-in of 1000 iterations we would not have even noticed the impact of the starting values!

For some of the other estimation engines supported by Stat-JR, changing starting values can be done by a different procedure as we will illustrate next for WinBUGS.

### WinBUGS

We will stick with the *rats* dataset but we will choose *Regression2* as the template, and we will set up the inputs as follows:

When we click on **Next** the input files for WinBUGS will appear in the left-hand list. If you choose *inits1.txt* from this list then the screen will look as follows:

Clicking on **Edit** will allow us to change the file as follows:

Clicking on **Save** will save these changes and hence the initial values for WinBUGS. If we click on **Run **then the model will run with these values. Unfortunately (for the purposes of our example) WinBUGS uses a block-updating step for the beta parameters, and so we do not notice any difference when using these starting values as the mixing is good, as shown below:

This method of changing the starting values in Stat-JR can also be used with OpenBUGS and JAGS. It is, however, a little harder to change starting values in MLwiN and MCMCglmm in R. In MLwiN one could, in theory, alter the macros so that the values stored for beta (in column c1098) were altered after the initial IGLS estimation, but prior to MCMC estimation. In MCMCglmm there is a start command/option to specify starting values but again this requires changing the macro code. Why not experiment yourself with these packages?

Back to New features.