UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Frequently Asked Questions about MLwiN
How do I graph slopes of a variable?

Let's use an example using MLwiN data file popular.ws from Hox's Multilevel Analysis Techniques and Applications for the illustration. Here is a snapshot of its variables names. There are 100 schools and students are nested in schools.

We have a model as follows.

The result is:

Now we want to plot the 100 school regression slopes for student gender. Based on the model, we will produce predicted values using the Predictions window from Model menu. We are interested in the slopes for variable gender for 100 schools. The predicted values that we want to generate are thus defined as follows. We choose an unused variable c11 and rename it as pred. Now we can click on Calc to store the predicted values in variable pred.

Now we are ready to plot it against variable sex. From Graphs menu, select Cumstomised Graph(s). For y-variable, select variable pred and for x-variable, select variable sex. Finally, we select school to be the group variable.

The plot is shown below.

If we want to know the school that corresponds to a particular line, we can simply click on the line and following window will pop up with the information we need. The line we clicked to get the the information below has the highest value when sex is 1. This line corresponds to school with school id = 3.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


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.