Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

2012 SPSS Linear Mixed Models (LMM) Options in SPSS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Analysing repeated measures with Linear Mixed Models

(Random Effects Models)


(1)
Getting familiar with the Linear Mixed Models (LMM) options in SPSS
Written by: Robin Beaumont e-mail: robin@organplayers.co.uk
Date last updated 6 January 2012
Version: 1

H o w t h is d oc u ment sh ou ld b e u s ed :
This document has been designed to be suitable for both web based and face-to-face teaching. The text has been made
to be as interactive as possible with exercises, Multiple Choice Questions (MCQs) and web based exercises.
If you are using this document as part of a web-based course you are urged to use the online discussion board to discuss
the issues raised in this document and share your solutions with other students.
This document is part of a series see:
http://www.robin-beaumont.co.uk/virtualclassroom/contents.htm
Wh o t h is d oc u men t is a imed at :
This document is aimed at those people who want to learn more about statistics in a practical way and assumes you
have worked through a number documents already.

Any feedback most welcome. Robin Beaumont

Acknowledgment
My sincere thanks go to Claire Nickerson for not only proofreading several drafts but also providing additional material
and technical advice.

Videos to support material


There are a set of Youtube videos to accompany this chapter which can be found at:
http://www.youtube.com/view_play_list?p=05FC4785D24C6E68
Analysing repeated measures with Linear Mixed Models (random effects models) (1)

Contents
1. INTRODUCTION .................................................................................................................................................... 3
2. WIDE AND LONG DATA FORMATS ........................................................................................................................ 4
3. GRAPHING CHANGE IN SPSS ................................................................................................................................. 4
4. GRAPHING CHANGE IN R....................................................................................................................................... 6
5. PARAMETER ESTIMATION ..................................................................................................................................... 8
6. GETTING TO GRIPS WITH THE MIXED MODELS DIALOG BOXES IN SPSS................................................................. 9
7. INDEPENDENT T TEST ............................................................................................................................................ 9
8. TAKING INTO ACCOUNT DEPENDENCY – FIXED AND RANDOM EFFECTS ..............................................................11
9. PAIRED SAMPLES T TEST ......................................................................................................................................12
10. COMPARING MODELS......................................................................................................................................14
11. MODEL COVARIANCE MATRIXES FOR REPEATED MEASURES (LEVEL ONE).......................................................16
12. SUMMARY .......................................................................................................................................................17
13. REFERENCES.....................................................................................................................................................17

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 2 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

1. Introduction
Mixed models are theoretically not new, and as with most statistical concepts Fisher first introduced them at the
beginning of the 20th century. However only very recently, that is in the last two decades, have they been considered
widely as a method of analysing repeated measures data. I will not mention here the many other approaches that have
been offered as a method of analysing such data, instead I will try to start with a blank slate.
Repeated measures are those measures that are repeated on more than one occasion, we met an example in the paired
t statistic chapter. Taking another example, say we have cholesterol levels measured four times (t1, t2, t3, t4) over a year
for each patient following commencement of a new cholesterol lowering drug. So for each patient we have four
measurements which can be depicted thus:

Level
2
Patient 1 Patient 2 Patient 3 ....... Patient n

Observation 1 Observation 1 Observation 1


Observation 1 Observation 1 Level
Observation 2 Observation 2 1
Observation 2 Observation 2 Observation 2
Observation 3 Observation 3
Observation 3 Observation 3 Observation 3
Observation n Observation n
Observation n Observation n Observation n

4 observations clustered within each patient - observations within each cluster may be correlated?

We can say that the observations are the bottom level (level one) while they are clustered within the level two variable
patient.
There are several aspects of this situation we might be interested in investigating:
The difference between the first and last observation for each patient
The trend over time for the observations for each patient taking into account the initial value. Do they follow a
straight line or some type of curved one?
The relationship between the repeated observations, are they correlated or independent, do they become less
correlated as the observations become more distant, that is, is t1 to t2 more strongly correlated than that
between t1 and t4
How spread out are the scores at each time point, and do they become more spread out as time goes on or is
the variance constant.
How much of the variability in the observations is accounted for within the clusters compared to that between
the clusters
All the above questions are common for this type of situation which suggests that an appropriate analysis here is rather
an involved process. It is important to realise that some of the above questions are more valid than others an issue we
will discuss latter. As is usual a largely graphical initial exploratory data analysis (EDA) is always the first stage of any
analysis, both Singer & Willett (2003) and Diggle & Heagerty (2003) devote a whole chapter at the start of their books to
graphical techniques. Unfortunately both SPSS and R do not make life easy when it comes to developing various graphs
for repeated measures, Heck Thomas & Tabata 2010 attempt various graphs in SPSS, while using workarounds, while
Singer & Willett 2003 provide SPSS syntax.
Before we can do anything we need to consider the structure of the data as this affects our ability to analyse it.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 3 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

2. Wide and long data formats


In most of the analyses we have carried out so far we have arranged the data so that a single case (i.e. patient/subject)
represents a row of data, and specifically if we had some repeated measures we would represent each repeated
measure as a separate column. In contrast in a long format structure the data is structured in such a way so that each
observation time represents a row.
Long format = one observation time for a specific case, per row
Wide format = one case (subject) per row

Wide format = one case per row

One case per


row

Long format = one observation (per case) per row

One observation time


for a single case Data from Twisk 2006:
twisk_longitudinal_wide.sav
twisk_longitudinal_long.sav

My Youtube videos at http://www.youtube.com/view_play_list?p=05FC4785D24C6E68 describe how to restructure


data using either SPSS or R. Also my introduction to R chapter describes the various restructure commands in R.

3. Graphing change in SPSS


The simplest way is to produce a scatter plot of the variable you are interested in over time, this is also called a profile
or spaghetti plot.

t_test_paired_long_format.sav

While the above details offer a solution of sorts, see http://www.medicalnerds.com/producing-spaghetti-plots-using-


r/#more-36 for a discussion of the problems in SPSS, it is not ideal as you can see from the final result over the page.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 4 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
We use the add fit line at
subgroups option to obtain the
lines.

Finally the x axis scale needs to be tidied up to make sense.

The final result shows how each individual


behaved; ideally the lines should only go
between the two time periods for which the data
was collected. You can achieve this in SPSS by manipulating the data (see the third chapter concerned with random
effects models). You can also use SPSS syntax. Such Syntax details can be found at
http://www.ats.ucla.edu/stat/spss/examples/alda/ which describes the examples for chapter 2 of Singer & Willett 2003,
the same webpage also provides the equivalent (much shorter) R code.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 5 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

4. Graphing change in R
The data needs to be in long format. To load the data, I'm using the SPSS file into R I use the r commander interface as
shown below.

Notice I have unclicked the convert value labels to factor


levels option, and given the proposed dataset the name
mydata. Click OK then select the required file. Once back in
R commander check to see what you have imported by
clicking on the View Dataset button.

Typing into the script window names(mydata) and then


highlighting it and clicking on the submit button, produces a
list of the variables(i.e vectors/fields) in your current dataset.

Now we have the data in R and also know the names of the
variables we can request the graph we want.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 6 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
To produce the graph we will use a particular library, in R called lattice. I had already downloaded the library before and
installed it in R (if you don't know how to do this see the getting started with R chapter) so all I need to do now is load
the library remember that loading and installing a library in R are two different things.
We can either load the library in the R commander script window or in the R console window directly. By typing the
command, library(lattice).

xyplot(result ~ time, groups = id, type = "b", data = mydata)


The xyplot function in the lattice library provides the graph we so desired in SPSS! The first expression, result ~
time, is just saying model result as a linear function of time (think y x axises) then divide the data into groups, specified
by each value of id in this instance (i.e subject) and finally the data = expression is informing the function of what
dataset to use. You can add embellishments to the basic xyplot as shown below:
xyplot(result ~ time, groups = id, type = "b", data = mydata,
changes over time for experiment x
ylab = "number of curls" ,
xlab = "before - after" ,
30

main = "changes over time for experiment x" ,


scales = list(x = list(at = c(1,2)))) 25
number of curls

20

Obviously we have only demonstrated this on a very small dataset 15

with only two time points. But the same procedure would apply to a
much larger dataset with possibly many time points also we have only 10
barely scrapped the surface of the xyplot function in the lattice package,
there is even a whole book about it (Sarkar 2008)!
5

Exercise 1 2

Repeat the process above for SPSS and R using both the dataset demonstrated before - after

above and also the Twisk health lifestyle dataset (twisk_longitudinal_long.sav) which has four time points. How did you
resolve the problem of 4 times points in SPSS?
Also try running for the Twisk data: xyplot(health ~ time, groups = id, type="l", col= "grey",
alpha = 0.25, data = mydata) . What do you think the col and alpha parameters do?

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 7 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

5. Parameter Estimation
There are two methods available in SPSS for estimating the parameter
values, SPSS defaults to the Restricted Maximum Likelihood (REML)
method. Unfortunately there appears much controversy over which
method is the best to use Twisk presents a table comparing estimates
for a model using both methods and shows there is little difference
(Twisk 2006 p.29), Singer & Willett (2003 p.87-90) provides a fuller
description with references to simulation studies.
A major part of the analysis process involves hypothesis testing and
specifically evaluating alternative models and this is where the
problems arise. ML (also called the Full ML method [FML]) provides a
description of the fit of the full model (both fixed and random
parameters) whereas REML only takes into account the random
parameters.

Model Fixed Random Both


comparison
parameter
estimates:
Either ML
ML REML ML

Given the above it is therefore probably best to stick with ML or at


least run the analysis using both methods for comparison.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 8 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

6. Getting to grips with the Mixed models dialog boxes in SPSS


The dialog boxes for carrying out repeated measures analysis using a mixed models approach are complex to say the
least, therefore I am going to retrace my steps first and demonstrate how you can carry out both the independent and
paired samples t test using these dialog boxes.

7. Independent t test
Referring back to the data we used to demonstrate the paired t test I have restructured
it into long format opposite. Id represents the subject and time represents either a pre
intervention or post intervention observation.
While we know that the pre post observations are not independent we will assume they
are for this demonstration, therefore while this demonstrates how to carry out an
independent t test it is an inappropriate analysis for this dataset. We are just doing this
to demonstrate how you would carry out such an analysis.
The results below are from the usual t test option in SPSS, to allow us to compare them
with those produced from the Mixed models dialog boxes.

Group Statistics
time N Mean Std. Deviation Std. Error Mean
t_test_paired_long_format.sav
1 8 14.2500 10.40261 3.67788
result
2 8 16.8750 10.46678 3.70057

Estimates
Levene's Test for
Equality of t-test for Equality of Means
Variances
95% Confidence Interval of the
Sig. (2- Mean Std. Error
F Sig. t df Difference
tailed) Difference Difference
Lower Upper
Equal variances
.026 .874 -.503 14 .623 -2.62500 5.21737 -13.81515 8.56515
assumed
Equal variances not
-.503 13.999 .623 -2.62500 5.21737 -13.81519 8.56519
assumed

So now lets repeat the above analysis using the t_test_paired_long_format.sav and the Mixed models dialogues which
are accessed from the menu option:
analyse -> Mixed models -> linear.
The first dialog box that appears is for specifying the various levels of data, we can ignore this for our present analysis,
so just click continue.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 9 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
The next dialog box, the Linear Mixed Models dialog asks us to specify the input/output variables, that is the dependent
and independent variables, complete it as shown below.
We also need to specify what statistics we require from the analysis, click on the statistics button and complete the
Linear Mixed Models: Statistics dialog box and complete as shown below.

While we have specified the variables in the above dialog box we also
need to specify for each factor/covariate if it is to be estimated as a
fixed or random variable (i.e. effect), for this analysis we just have one variable which we wish to model as a fixed
effect. Clicking on the fixed effect button above produces the dialog box below. We move the time variable to the
model box by clicking on the add button.
The results from this analysis are shown below.

Descriptive Statistics
result
Standard Coefficient of
time Count Mean
Deviation Variation
1 8 14.2500 10.40261 73.0%
2 8 16.8750 10.46678 62.0%
Total 16 15.5625 10.17165 65.4%

a
Model Dimension
Number of Number of
Levels Parameters
Fixed Intercept 1 1
Effects time 2 1
Residual 1
Total 3 3
a a. Dependent Variable: result.
Information Criteria
-2 Restricted Log Likelihood 109.553
Akaike's Information Criterion
111.553
(AIC)
b
Hurvich and Tsai's Criterion Estimates of Fixed Effects
111.886
(AICC) 95% Confidence Interval
Bozdogan's Criterion (CAIC) 113.192 Parameter Estimate Std. Error df t Sig.
Lower Bound Upper Bound
Schwarz's Bayesian Criterion (BIC) 112.192 Intercept 16.87 3.68 14 4.574 .000 8.962367 24.787633
The information criteria are displayed in smaller- [time=1] -2.62 5.21 14 -.503 .623 -13.815152 8.565152
is-better forms. [time=2] 0
a
0 . . . . .
a. Dependent Variable: result. a. This parameter is set to zero because it is redundant.
b. Dependent Variable: result.

It is interesting to note that we could have extended the above to many independent groups which would have been
equivalent to carrying out an ANOVA.
Comparing the about output with that from the traditional analysis we can see that they are pretty much identical, we
have the same descriptive statistics with the coefficient of variation replacing the sem. The t, p value and confidence

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 10 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
interval values are identical. However in this output there are two additional tables, the information criteria and that
for the model dimension.
The model dimension table provides details of the parameters we are requesting to be estimated, while it is not
important in the above output it is vital when we want to check that we have specified a model correctly and also want
to check the number and type of parameter estimates for a particular model when we wish to compare various models.
The information criteria table offers us several measures of model fit, the most basic measure being the -2log likelihood
this is difficult to interpret and does not take into account the relative complexity (i.e. number of parameter estimates
needed to define it), in contrast Akaikes information criteria is purported to do so, which implies we can theoretically
just compare models looking at the AIC and selecting the one with the smallest value, however there is controversy
about this measure and often people use both the AIC and the -2logLL to hedge their bets, we will be taking this
approach when evaluating our models.

8. Taking into account dependency – Fixed and Random effects


In the above analysis we have ignored the fact that the pre – post test measures for each subject are not independent it
is clear that the post test value is related to the pre test value for the individual subject.

Level
2
Patient 1 Patient 2 Patient 3 ....... Patient n

Observation 1 Observation 1
Observation 1 Observation 1 Observation 1 Level
Observation 2 Observation 2 1
Observation 2 Observation 2 Observation 2

In the above analysis where we did not take into account this dependency we defined our parameter we estimated as a
fixed effect parameter. Basically this means we only estimated a single value (a point estimate). However to define the
degree of dependency between any two of the level 1 repeated measures pairs means that we would need to estimate
a fixed parameter (i.e. the covariance/correlation) value for each pair, this would use up a large number of our degrees
of freedom having to estimate as many parameters as half our sample size!
A solution to this problem is to estimate a Random Effect parameter instead. A random effect parameter specifies a
normal distribution instead of a single value and as we know a normal distribution is defined by its mean and variance
(standard deviation). Ignoring the mean value, this results in us now being able to estimate the (covariance/correlation)
between each of the repeated measures pairs as a normal distribution (assuming they are in reality normally
distributed).
Remembering that we need an estimate of the variance for each of the observations to calculate the
covariance/correlation, we have now reduced the number of parameters we need to estimate from half the sample size
down to just three, and thereby increasing the degrees of freedom substantially.
Another advantage of defining the relationship between the repeated measures as a Random effect parameter is that
we are not now just considering our observed repeated measures pairings but a population of repeated measures from
which they come clearly giving us more generalisability (assuming this is a valid assumption!).
In the following chapters we will look in much more depth at the concept of Random effects.
We will now consider the paired samples t test which does in effect take into account the dependency between the pre
and post test score for each subject.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 11 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

9. Paired samples t test


First of all we carry out the paired samples t test using the usual dialog boxes in SPSS, therefore we have the data in
wide format to allow that.

Paired Samples Statistics


Mean N Std. Deviation Std. Error Mean
pre 14.2500 8 10.40261 3.67788
Pair 1
post 16.8750 8 10.46678 3.70057

Paired Samples Correlations


N Correlation Sig.
Pair 1 pre & post 8 .940 .001

Paired Samples Test


Paired Differences
95% Confidence Interval of the
Pair 1 t df Sig. (2-tailed)
Mean Std. Deviation Std. Error Mean Difference
Lower Upper
pre - post -2.62500 3.62284 1.28087 -5.65377 .40377 -2.049 7 .080

Note from the above that when you square the standard deviations for the pre and post test scores you obtain the
variances of; 108.2 and 109.53 also remember that the correlation is just the standardised covariance, that is by dividing
the covariance by the product of the two standard deviations we obtain the correlation.
So: correlationa.b = covariance/(sda x sdb) = covariance /( √variance a x √variance b) = .94
To carry out the equivalent analysis using the Linear mixed models dialog boxes you need the data in log format using
the t_test_paired_long_format.sav file. Within the Linear mixed models dialog boxes you specify the repeated
measures, by using the first dialog box specifying the subjects and repeated measures variables as shown below.

We also need to change the repeated covariance type to unstructured which informs SPSS
that we wish to allow the pre post measures (i.e. the repeated measures) to be correlated
and have unequal variances in the model.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 12 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
As before we setup the other dialog boxes, ensuring we use Restricted Maximum likelihood estimation (usually we
would not select this option):

The results are shown below.


a
Model Dimension
Number of Levels Covariance Structure Number of Parameters Subject Variables Number of Subjects
Intercept 1 1
Fixed Effects
time 2 1
Repeated Effects time 2 Unstructured 3 id 8
Total 5 5
a. Dependent Variable: result.

a a
Information Criteria Type III Tests of Fixed Effects
-2 Restricted Log Source Numerator df Denominator df F Sig.
94.526
Likelihood Intercept 1 7 18.347 .004
Akaike's time 1 7 4.200 .080
Information 100.526 a. Dependent Variable: result.
Criterion (AIC)
Hurvich and Tsai's
102.926
Criterion (AICC) Estimates of Fixed Effects
b

Bozdogan's 95% Confidence Interval


105.443 Parameter Estimate Std. Error df t Sig.
Criterion (CAIC) Lower Bound Upper Bound
Schwarz's Bayesian Intercept 16.87 3.70 7 4.560 .003 8.12 25.62
102.443
Criterion (BIC) [time=1] -2.62 1.28 7 -2.049 .080 -5.65 .403
The information criteria are [time=2] 0
a
0 . . . . .
displayed in smaller-is-better forms. a. This parameter is set to zero because it is redundant.
a. Dependent Variable: result. b. Dependent Variable: result.

a
Estimates of Covariance Parameters Ignoring for now much of the above you will notice
Parameter Estimate Std. Error
UN (1,1) 108.214286 57.842969
that we obtained exactly the same t and p values as
Repeated that obtained by the traditional paired t test.
UN (2,1) 102.321429 56.473681
Measures
UN (2,2) 109.553571 58.558847
Referring back to the original SPSS paired t test
a. Dependent Variable: result. (using restricted ML if we had used ML we would
have got smaller values) output and noting that the variances are; 108.2 and
109.53 and also the correlation we have equivalent values in the estimates of covariance table.
variance
2
Diagonals = Variance = sd ; Off diagonals = Covariance
T1 = pre T2 = post
Remembering that the correlation is just the standardised covariance, that T1 = pre 108.214286
is if we divide the covariance by the product of the two standard deviations T2 = post 102.321429 109.553571
(= square roots of the variances) we obtain the correlation coefficient.
covariance variance
correlationa.b = covariance/(sda x sdb) = covariance /( √variance a x √variance b)
correlationpre.post = 102.3214 / ( √108.214 x √109.5535) = .939 0

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 13 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

10. Comparing models


a
Information Criteria a
Estimates of Covariance Parameters using ML estimation
using ML estimation
Parameter Estimate Std. Error
-2 Log Likelihood 101.140
UN (1,1) 94.687500 47.343750
Akaike's
Repeated Measures UN (2,1) 89.531250 46.223005
Information 111.141
UN (2,2) 95.859375 47.929687
Criterion (AIC)
Hurvich and Tsai's a. Dependent Variable: result.
117.141
Criterion (AICC)
Bozdogan's From the above analysis you may have noticed that I used the restricted maximum
120.004
Criterion (CAIC)
Schwarz's Bayesian likelihood estimation option if I have used (full) maximum likelihood I would have
115.004
Criterion (BIC) obtained the table opposite. Interestingly while the fixed parameter (and p value)
The information criteria are estimate would have been identical the estimate of the covariance parameters table
displayed in smaller-is-better forms.
a. Dependent Variable: result. would have had contained smaller values and I would not have been able to carry out
the comparison between the traditional and Linear mixed models variances and
correlation.
Regardless of the estimation method, you may have noticed that the variances of both repeated measures, that is the
pre and post test scores are almost identical. Additionally from the dimension table you notice that we used up three
degrees of freedom to estimate the unstructured covariance matrix for the repeated measures, one for the pre test
variance, one for the post test variance and one for the covariance, because we specified a unstructured covariance
matrix.
One of the basic ideas concerning model development is to find the model that uses the least number of parameters
(freeing up the largest number of data items = degrees of freedom) along with the best fit.
Is this instance we can reduce the number of parameters needed to be estimated by using the Compound symmetry
covariance matrix which assumes constant variance and co variation so in this instance means the same variance for the
repeated measures (i.e. pre post test scores).
As mentioned previously we can compare the models by taking the -2LL and the carrying out a Likelihood ratio test. As
well as comparing the various other information criteria measures.
The important thing to realise here is that you usually need to use ML estimation of the -2LL value if you plan to
compare models rather than the restricted maximum likelihood estimate.
To re-run the analysis we just need to edit the first box, and make sure we have the estimation method to be maximum
likelihood.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 14 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

a a
Model Dimension Information Criteria
Number -2 Log Likelihood 101.143
Number Covariance Number of Subject
of Akaike's Information Criterion
of Levels Structure Parameters Variables 109.143
Subjects (AIC)
Fixed Intercept 1 1 Hurvich and Tsai's Criterion
Effects time 2 1 112.780
(AICC)
Repeated Compound Bozdogan's Criterion (CAIC) 116.234
time 2 2 id 8
Effects Symmetry Schwarz's Bayesian Criterion (BIC) 112.234
Total 5 4 The information criteria are displayed in smaller-
a. Dependent Variable: result. is-better forms.
a. Dependent Variable: result.

b
Estimates of Fixed Effects
95% Confidence Interval
Parameter Estimate Std. Error df t Sig.Lower Upper
Bound Bound
Intercept 16.87 3.45 8.497 4.890 .001 8.99 24.75
[time=1] -2.62 1.19 8 -2.191 .060 -5.38 .137
a
[time=2] 0 0 . . . . .
a. This parameter is set to zero because it is redundant.
b. Dependent Variable: result.

a
Estimates of Covariance Parameters
Parameter Estimate Std. Error
CS diagonal offset 5.742187 2.871094
Repeated Measures
CS covariance 89.531250 46.223469
a. Dependent Variable: result.

Comparing the two models we have a -2 LL of 101.140 (corrected to 3 d.p) (df=5) for the more complex model and
101.143 (df=4) for the less complex one. Subtracting the value of the less complex model from that of the other gives a
value of 0.003 which if both models as equivalent, that is the difference is due to random sampling, then the value
follows a chi square distribution with degrees of freedom equal to the difference in degrees of freedom between the
models. Looking at the model dimension tables we see that the df difference is 5-4=1 and using r commander in r, we
can obtain a graphical interpretation of the P value this being the area under the curve to right of the chi square value.
Finally in R we can use the 1-pchisq(0.003,1) expression to obtain the numerical p value, that is the proportion of the
area under the curve highlighted below.

Chi-Squared Distribution: df = 1

1.
0
We can conclude that we would obtain two models displaying a
0.
similar degree of fit or one less similar 96 times in a hundred
8
given that they come from the same population. Considering the
hypothesis testing approach as this is greater than the traditional 0.
Density

level of 1 in 20 (0.05) we accept it and conclude there is no 6


difference in the degree of fit between the two models,
0.
However because one is less complex i.e. uses less parameters 4
we would probably use the simpler one. chisq of 0.003 (df=1) p=.956
0.
2
0.
0
0 2 4 6 8 10 12

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 15 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

11. Model Covariance matrixes for repeated measures (level one)


The first Dialog box in the Linear Mixed Models menu provides an option for specifying how you want the repeated
measures to be modelled, we have used two options so far, unstructured and compound symmetry. However there are
several more and a particularly interesting one is scaled identity. Scaled Identity covariance structure matrix allows us to
model a set of repeated measures that we feel may be independent and all of equal variance. If we repeat the analysis
described in the previous page with this covariance structure we would have got back to square one, that is the
independent t test? So within these dialog boxes there are many different ways of obtaining the same model and one
needs to be very specific about specifying the model and understanding what the results mean.

Estimates of Fixed Effectsb


95% Confidence Interval
Parameter Estimate Std. Error df t Sig. Lower
Upper Bound
Bound
Intercept 16.87 3.68 14 4.574 .000 8.96 24.78
[time=1] -2.62 5.21 14 -.503 .623 -13.81 8.56
[time=2] 0a 0 . . . . .
a. This parameter is set to zero because it is redundant.
b. Dependent Variable: result.

I have produced a table below of the common covariance matrixes


along with a screen dump of the options available from SPSS for
the repeated measures covariance types.

name Variance at each time point Correlation (covariance) between measurement times
Scaled identity constant No correlation (i.e. independent)
Compound
constant constant
symmetry
Diagonal different at each time No correlation (i.e. independent)
Unstructured different at each time Different for each time pairing
AR(1) Correlation gets less as time points get further apart
constant
=Autoregressive (i.e. t1, t2 = ρ but t1, t3 = ρ2 )

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 16 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)

12. Summary
This chapter has provided a short introduction into the Linear Mixed models dialog boxes in SPSS and has demonstrated
how you can obtain the equivalent to an independent sample t test (one way ANOVA) and also a paired t test. The
concepts of Maximum likelihood estimation and partial maximum likelihood estimation were introduced as well as
Fixed and Random effects. The ability to compare models was demonstrated by looking at the difference in the -2LL
and degrees of freedom between them where the value follows a chi square distribution (df= difference in the df's) and
also mention was make of Akaikes Information Criterion .
I have tried to emphasis the importance of visualising the data and this aspect, although can be difficult is an important
first step in the analysis.
This was very much an introduction which we will develop in the next few chapters.
I have deliberately not considered the R equivalents here – they are so much easier than the baroque dialog boxes of
SPSS. A YouTube video demonstrates this.

13. References
Bickel R 2007 Multilevel Analysis for Applied Research: It’s Just Regression! The Guilford Press.
Bollen K A, Curran P J. 2006 Latent Curve Models: A Structural Equation Perspective. Wiley
Bollen K. A. 1989 Structural Equations with Latent Variables. Wiley.
Brown H, Prescott R 2006 (2nd ed.) Applied Mixed models in Medicine. Wiley.
Campbell 2006 (2nd ed.) Statistics at square 2. BMJ books.
Crawley M J 2005 Statistics: An introduction using R. Wiley
Crowder M J.Hand D J. 1990 Analysis of repeated measures. London: Chapman and Hall.
Diggle P J Hegaerty P Liang K-Y. Zeger S. 2002 (2nd ed.) Analysis of Longitudinal Data. Oxford Science publications.
Duncan T E, Duncan S C, Strycker L A. 2006 (2nd ed.) An Introduction to Latent Variable Growth Curve Modeling:
Concepts, Issues, and Applications: Lawrence Erlbaum.
Everitt B S, Hothorn T 2006 (1st ed) A handbook of statistical analyses using R. Chapman & Hall.
Everitt B S, Hothorn T 2010 (2st ed) A handbook of statistical analyses using R. Chapman & Hall.
Field A 2009 Discovering Statistics Using SPSS. Sage [Chapter nineteen describes multilevel modelling including
restructuring data].
Fitzmaurice G M, Laird N M, Ware J M, 2004 Applied Longitudinal Analysis. Wiley
th
Goldstein H. 2011 (4 ed.) Multilevel statistical models. Wiley.
Hand D, Crowder M 1996 Practical Longitudinal data analysis. Chapman & hall
Heck R H, Thomas S L & Tabata L N. 2010 Multilevel and Longitudinal modelling with IBM SPSS. Routledge.
Hedeker, D., and R. D. Gibbons. 2006. Longitudinal Data Analysis. Wiley. Website: tigger.uic.edu/~hedeker/ml.html
Hox J 2010 (2nd ed) Multilevel analysis: Techniques and applications. Lawrence Erlbaum
Landau S, Everitt B S 2004 A handbook of statistical analyses using SPSS. Chapman & Hall.
Leeuw J D,·Meijer E 2008 (eds.) Handbook of Multilevel Analysis. Springer.
Matthews J N S, Altman D G, Campbell M J, Royston J P 1990 Analysis of serial measurements in medical research. B M J
300 230 – 235
rd
Norman G R, Streiner D L. 2008 (3 ed) Biostatistics: The bare Essentials.
Sarkar D 2008 Lattice: Multivariate Data Visualization with R. Springer.
Sheather S J 2009 A Modern approach to regression with R. Springer. Website, includes R tutorials and datasets:
http://www.stat.tamu.edu/~sheather/book/
Singer, J. D., and J. B. Willett. 2003. Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence. Oxford
University Press Inc, USA. gseacademic.harvard.edu/alda/
Twisk J W R 2003 Applied Longitudinal analysis for Epidemiology: A practical Approach. Cambridge University Press.

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 17 of 18


Analysing repeated measures with Linear Mixed Models (random effects models) (1)
Twisk J W R 2006 Applied multilevel analysis. Cambridge University Press.
Weiss R 2005 Modeling Longitudinal Data. Springer.
West B T, Welch K B, Galecki A T. 2007 Linear Mixed Models: A Practical Guide Using Statistical Software. Chapman &
Hall. Book website: http://www.umich.edu/~bwest/almmussp.html
Wu L 2010 Mixed Effects Models for Complex Data. Chapman & Hall.
Zuur A F, ·Ieno E N, · Walker N J, Saveliev A A·Smith G M 2009 Mixed Effects Models and Extensions in Ecology with R.
Springer

Robin Beaumont robin@organplayers.co.uk D:\web_sites_mine\HIcourseweb new\stats\statistics2\repeated_measures_1_spss_lmm_intro.docx page 18 of 18

You might also like