UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

MLwiN Textbook Examples
Multilevel Analysis Techniques and Applications by Joop Hox
Chapter 5: Analyzing Longitudinal Data

Table 5.1 on page 78, Table 5.2 on page 79 using data file gpa.sav. These tables are produced using SPSS.
GLM
  gpa1 gpa2 gpa3 gpa4 gpa5 gpa6 BY sex  WITH highgpa
  /WSFACTOR = gpa 6 Polynomial
  /METHOD = SSTYPE(3)
  /PLOT = PROFILE( gpa*sex )
  /PRINT = DESCRIPTIVE
  /CRITERIA = ALPHA(.05)
  /WSDESIGN = gpa
  /DESIGN = highgpa sex .
Table 5.2:
Figure 5.3 on page 80 using data file gpaflat.sav.
GET FILE='E:\hox\spss\gpaflat.sav'.

GRAPH
  /HISTOGRAM(NORMAL)=gpa .
Table 5.3 on page 81 using data file gpa4chp5.ws. Notice that the results for Part 3 and Part 4 are a little off from the book.
Part 1: Null model.
The result is:
Part 2: With the additional variable time which is created as follows.
->CALCulate "time"="occas"-1
The result is:
Part 3: The variable job is added.
The result is:
Part 4: The variables highgpa and sex are added to the model.
The result is:
Table 5.4 on page 83.
Part 1: The variable time is included as a random effect.
Then result is:
Part 2: Cross level interaction of variable time and sex is included. We first created the interaction term.
->CALCulate "txsex"="time"*"sex"
The result is:
Figure 5.4 on page 84.
Table 5.5 on page 85.
Part 1: 1st occasion = 0, same as the first part of Table 5.4. We only show the result here.
Part 2: The variable time has been recoded as -5, ...,-1, 0, ...with the last occasion coded as zero. We first recode variable time into time1.
->CALCulate "time1"="time"-5
The result is:
Part 3: The variable time is recoded centered around its mean and is included as a fixed effect.
->CALCulate "timec"="time"-2.5
The result is:
Table 5.6 using data file vocagrwt.ws.
 
The result is:
->TABUlate 0 "age"
                   12         13         14         15         16
       N           22          0          5          0         22

                   17         18         19         20         21
       N            0         11          0         22          0

                   22         23         24         25         26     TOTALS
       N           11          0         22          0         11        126
Table 5.7 on page 89. First we need to create a variable cons of constant 1. Then we have to recode the variable study as follows.
->CALCulate "sdummy"="study"-.5
We are ready to set up the model now. The hierarchical structure is shown below and variable sdummy is included as a fixed effect.
Part 1: Intercept only model.
The result is:
Part 2: The variable age is grand mean centered and is included as a fixed effect.
->AVERage 1 "age"
                 N     Missing    Mean         s.d.
age            126         0     18.889        4.5786 
->CALCulate "agec"="age"-18.889
The result is:
Part 3: The squared term of agec is included as a fixed effect.
->CALCulate "agec2"="agec"*"agec"
The result is:
Part 4: Centered variable agec is included as a random effect. We noticed that it took many more iterations for this model to converge.
The result is:
Table 5.8 on page 91.
Part 1: Intercept only model.
The result is:
Part 2: The variable age is centered on 12 months and is included as a fixed effect.
The result is:
Part 3: The variable age12sq is included as a fixed effect.
The result is:
Part 4: The variable age12 is a random effect. The estimation method is RIGLS.
The result is:
Table 5.9 on page 92 is created using HLM. We omit it here.
Table 5.10 on page 101 using data file gpa4chp5.ws.
Part 1: The variable time is a fixed effect. We have built the model at the beginning of this chapter. We will use it here.
The result is:
Part 2: The variable time is included as random effect.
The result is:
Part 3: The variable time is a fixed effect, MANOVA.
The first step is to create dummy variables for categorical variable occas. If occas is not set up to be a categorical variable, you can change it to be so. From Data Manipulation select Names. Highlight variable occas and click on Categories and then click on Apply. This will set up variable occas to be a categorical variable. Now from Model menu, select Main Effects and Interactions. Choose variable occas in the Categorical column and then click on Main Effects. After checking the entire column for occas to be included, click on Build. Now the Equations window has been modified. There are six new variables named as 1 to 6 appear in the Equations window. For each of these variables, we set up it to be random at level 2. The intercept is estimated only as a fixed effect.
The result is:

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