### MLwiN Textbook Examples Multilevel Analysis Techniques and Applications by Joop Hox Chapter 11: Advanced Methods for Estimation and Testing

Table 11.1 on page 198 using data file estronex.ws. As usual, we have to create a variable cons of constant 1. We will use cons as an indicator variable for level 1 and variable person for level 2. Add variable cons to the model as fixed parameter and random at each level as shown below. We now are ready to run our model. The estimation method we use will be RIGIS since we want to use Restricted Maximal Likelihood estimate.

The result is:
Result of Section 11.1 on page 199.
The model will be the same as the model before, we need to constrain the person level variance component to zero. This is done through Parameter constraints from Model menu. Notice that we select the constraint to be random since the constraint is on the variance.
Now after selecting an unused column to store the constraint we just created and clicking on attach random constraints button, we run the model again and here is the result.
Figure 11.1 and Table 11.1 on page 203 using data file popular.ws. As before, we first created a variable cons of constant 1. The model is:
and the result with asymptotic standard errors is:
In order to obtain the robust standard errors for fixed parameters, we need to issue a command manually through the Command interface. From Data Manipulation, select Command interface. Type "fsde 2" at the command line and hit Enter. In the output window, we see the following message:
->fsde 2
robust standard errors for fixed parameters
Similarly, we can also set up robust standard errors for random parameters by typing "rsde 2". Now if we run the model again, we obtain the following result:
From the Model menu, select Residuals. Choose level 2 from Settings and choose a sequence of unused columns to store the residuals that MLwiN will create. Then click on Calc to have the residuals computed. Now click on Plots and then select the second plot and click on Apply. This creates Figure 11.1 shown below.
Section 11.3.1 on page 203, a simple example of bootstrapping using data file good89.ws.
Table 11.3 on page 209 using data file popular.ws. The hierarchical structure is:
and the model is
Part 1: Asymptotic results:
Part 2: Bootstrap results
We use parametric method this time. The following is the setup for the bootstrap method.
The result is:
Table 11.4 on page 210.
Part 1: Asymptotic results. This is same as Part 1of Table 11.3 shown in previous example.
Part 2: Bootstrap results using nonparametric bootstrap approach. Here is the setup.
The result is:
Figure 11.2 on page 210. After the above analysis, select Trajectories from Model. Change current set to series and we will see the following window. Right click on the plot (left lower corner one) and window of Graph Control will come up. Through Graph Control, we can change the background and other related features of the plot and copy and paste it to other applications, such as Microsoft Word.
Figure 11.3 on page 214 using data file estrflat.ws.
The model is as follows.
We first have to run it using IGLS estimation method. For MCMC setup, because we want to see the first 500 iterations, we set the burn-in length to 0 and the monitoring chain length to 500 in the Estimation control window.

After running the estimation using MCMC sampler, we will open Trajectories window as shown below.

Right click on the plot (lower left corner), we will see the Graph Control window. From the option System, we choose to save the plot to clipboard using bmp format. The background color can be modified using the Background option.
Figure 11.4 on page 215.
Now, let's left click the plot again, we will be asked if we want to calculate MCMC diagnostics and we will click on Yes. The MCMC diagnostics window will show up and the left middle plot is Figure 11.4.
Figure 11.5 on page 216.
Same as generating Figure 11.3, we only change the monitoring chain length to 5000. Open Trajectories window from Model menu, and enter 5000 to view, we will have the right plots. It takes exactly the same steps as before to copy the single plot and paste it somewhere else.
Figure 11.6 on page 216. As instructed in the book, we use burn-in length to 5000, monitoring chain length to 500000 and thinning to 100 as shown in the Estimation control window below.
After running the MCMC sampler, we open the Trajectories window shown below using Model menu. Right click on the left bottom plot and the Graph Control window will pop up. Through Graph Control window, we can change the background color or other features related to the layout of the plot and copy and paste it to some places.
Figure 11.7 on page 217 and page 218.
Left click on the previous plot from the Trajectories window, we will request MCMC diagnostics and here is window that shows all the diagnostics including Figure 11.7.
Figure 11.8 on page 218.
From the same Trajectories window as above, we see our plot (right upper corner). To copy the single plot to somewhere else, right click on the plot and the Graph Control window will pop up. The Graph Control window will allow us to modify the plot and copy and paste it.
Figure 11.9 on page 218.
Left click on the right upper plot from Trajectories window, we request to have MCMC diagnostics and this is Figure 11.9.
Figure 11.10 on page 220 using data file popular.ws.
Recall the model that was built earlier.
After running the model using IGLS, we will have to run MCMC sampler using the default set up for MCMC. Open Trajectories window from Model menu, click on the Select button and unselect the plot for likelihood. Choose one graph per row setting and we will see the following window.
Figure 11.11 on page 221.
Right click on the plot corresponding to β2 to request MCMC diagnostics and the window shown below is Figure 11.11.
Figure 11.12 on page 222 using particular starting values.
MLwiN stores the parameter estimates in column c96(variance at each level) and c98(parameters). For example, we can use View or edit data from Data manipulation menu to view them. The window below shows the result after running IGLS estimation.
We will enter our new initial values directly into the data editor.
Now switch to MCMC sampler method and set the burn-in length to 0 and the monitoring chain length to 500.
Now after running the model, open the Trajectories window and change it to use running mean instead of raw data. To delete the plot for log likelihood, we can click on Select and unselect likelihood plot and use 2 graphs per row.
Table 11.5 on page 222.
Part 1: The model has been built before and we simply run it using IGLS estimation method.
The result is:
Part 2: Same model using MCMC sampler.
After running IGLS estimation, we switch to MCMC method. Here is the set up for MCMC.
The result is:

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.