Wednesday, August 24, 2005

Longitudinal multilevel models in SPSS

In Version 11, SPSS added a multilevel modelling (they call it mixed models) procedure. I find the menus completely incomprehensible - I've tried intelligently selecting the appropriate options, and I've tried randomly guessing, and neither gives me the right answer.
Instead, you have to use syntax - and so here, to get you (and me) started, is the syntax for longitudinal multilevel models in SPSS.
I'm assuming you've a variable called time, which represents, well, time. A variable called outcome, which represents the outcome, and a variable called subject, this is (you've guessed it) the subjects.

Your data will look something like:

Time Outcome Subject

1 10 1
2 12 1
3 15 1
1 11 2
2 15 2
2 14 3
3 17 3

...

3 18 200


If you only want random intercepts:

MIXED
outcome with time
/random = intercept | subject (id)
/print = solution.

For random intercepts and slopes, with a zero correlation between slope and intercept):

MIXED
outcome with time
/fixed = time
/random = intercept time | subject (id)
/print = solution.


(Note that the (id) specifies the form of the correlation matrix - id is short for identity.

And for random slope, random intercepts, and correlation between slope and intercept:

MIXED
outcome with time
/fixed = time
/random = intercept time | subject (id) covtype (un)
/print = solution.


The covtype (un) is unstructured.

A much more detailed and useful guide to mixed models in SPSS, written by Alastair Leyland, can be found here.

0 Comments:

Post a Comment

<< Home