Lecture 7
Lecture 7
Longitudinal Data
Introduction to continuous
longitudinal data:
Examples
Homeopathy vs. placebo in
treating pain after surgery
Day of surgery
Mean pain
assessments by
visual analogue
scales (VAS)
Davis et al. “Divalproex in the treatment of bipolar depression: A placebo controlled study.” J
Affective Disorders 85 (2005) 259-266.
Randomized trial of in-field
treatments
of acute mountain sickness
Copyright ©1995 BMJ Publishing Group Ltd. Keller, H.-R. et al. BMJ 1995;310:1232-1235
Pint of milk vs. control on
bone acquisition in
adolescent females
Copyright ©1997 BMJ Publishing Group Ltd. Cadogan, J. et al. BMJ 1997;315:1255-1260
Counseling vs. control on
smoking in pregnancy
1 31 29 15 26
2 24 28 20 32
3 14 20 28 30
4 38 34 30 34
5 25 29 25 29
6 30 28 16 34
data long;
set broad;
time=1; score=time1; output;
time=2; score=time2; output;
time=3; score=time3; output;
time=4; score=time4; output;
run;
Profile plots (use long
form)
1 A 31 29 15 26
2 A 24 28 20 32
3 A 14 20 28 30
4 B 38 34 30 34
5 B 25 29 25 29
6 B 30 28 16 34
A
Mean plots by group
A
Possible questions…
Overall, are there significant differences between time
points?
From plots: looks like some differences (time3 and 4 look
different)
Overall, are there significant changes from baseline?
From plots: at time3 or time4 maybe
Do the two groups differ at any time points?
From plots: certainly at baseline; some difference everywhere
Do the two groups differ in their responses over time?**
From plots: their response profile looks similar over time,
though A and B are closer by the end.
Statistical analysis
strategies
Strategy 1: ANCOVA on the final
measurement, adjusting for baseline
differences (end-point analysis) Traditional
Strategy 2: repeated-measures ANOVA approaches:
“Univariate” approach this week
Strategy 3: “Multivariate” ANOVA approach
FROM:
Ralitza Gueorguieva, PhD; John H. Krystal, MD Move Over ANOVA : Progress in Analyzing Repeated-Measures Data and Its Reflection in Papers Published in the Archives
of General Psychiatry. Arch Gen Psychiatry. 2004;61:310-317.
Things to consider:
1. Spacing of time intervals
Repeated-measures ANOVA and MANOVA require that all subjects
measured at same time intervals—our plots above assumed this too!
MANOVA weights all time intervals evenly (as if evenly spaced)
2. Assumptions of the model
ALL strategies assume normally distributed outcome and
homogeneity of variances
But all strategies are robust against this assumption,
especially if data set is >30
**Univariate repeated-measures ANOVA assumes sphericity, or
compound symmetry
3. Missing Data
All traditional analyses require imputation of missing data
(also need to know: does the SAS PROC require long or broad form of
data?)
Compound symmetry
Compound symmetry requires :
1 31 29 15 26
2 24 28 20 32
3 14 20 28 30
4 38 34 30 34
5 25 29 25 29
6 30 28 16 34
Variance: 9.76667
65.60000 20.40000 39.46667
(b) Correlation (covariance)
across time points
time1 time2 time3 time4
time4 0.28445
Certainly do NOT0.26921 0.27844
have equal
1.00000
correlations!
Time1 and time2 are highly correlated,
Compound symmetry would
look like…
A 29.3333333 0.4343
B 32.3333
Strategy 1: End-point
analysis
Sum of
Source DF Squares Mean Square F Value Pr > F
A 29.3333333 0.4343
B 32.3333
From end-point analysis…
Overall, are there significant differences between
time points?
Can’t say
Overall, are there significant changes from
baseline?
Can’t say
Do the two groups differ at any time points?
They don’t differ at time4
Do the two groups differ in their responses over
time?
Can’t say
Strategy 2: univariate
repeated measures ANOVA
(rANOVA)
Just good-old regular ANOVA, but
accounting for between subject differences
BUT first… Naive analysis
Run ANOVA on long form of data,
ignoring correlations within subjects (also
ignoring group for now):
1 31 29 15 26
2 24 28 20 32Between
3 14 20 28 30times
4 38 34 30 34
5 25 29 25 29
6 30 28 16 34
MEAN: 27.00 28.00 22.33 30.83
2 2 2 2
SSB (between t imes)
27.006 x[( 27 27 ) ( 28 27 ) ( 22 . 33 27 ) (30 . 83 27 ) ] 224.79
SSW (within time) (31 27) 2 (24 27) 2 ..... (29 30.83) 2 (34 30.83) 2 676.17
One-way ANOVA results
The ANOVA Procedure
Dependent Variable: score
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 3 224.7916667 74.9305556 2.22 0.1177
Error 20 676.1666667 33.8083333
Corrected Total 23 900.9583333
Adj Pr > F
Source DF Type III SS Mean Square F Value Pr > F G - G H - F
Between time
Unexplained variability
variability
With two groups: Naive
analysis
Run ANOVA on long form of data,
ignoring correlations within subjects:
Sum of
Source DF Squares Mean Square F Value Pr > F
No apparent difference in
Greenhouse-Geisser Epsilon 0.4863
Huynh-Feldt Epsilon 0.885 responses over time
between the groups.
From rANOVA analysis…
Overall, are there significant differences between
time points?
No, Time not statistically significant (p=.1743, G-G)
Overall, are there significant changes from
baseline?
No, Time not statistically significant
Do the two groups differ at any time points?
No, Group not statistically significant (p=.1408)
Do the two groups differ in their responses over
time?**
No, not even close; Group*Time (p-value>.60)
Strategy 3: rMANOVA
Multivariate: More than one
dependent variable
Multivariate Approach to repeated
measures--Treats response
variable as a multivariate response
vector.
Not just for repeated measures,
but appropriate for other situations
with multiple dependent variables.
Analogous to paired t-test
n
Recall: paired t- y 2 y1
Ydiff i 1
test: n
Ydiff
~ Tn 1
SD(Ydiff )
1 A -2 -14 11
2 A 4 -8 12
3 A 6 8 2
4 B -4 -4 4
5 B 4 -4 4
6 B -2 -12 18
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no time*group Effect
Between group
effects; no within
subject effects:
Time is not
significant.
Group*time is not
significant.
Group IS
significant.
Practice: rANOVA and
rMANOVA
Some within-
group effects, no
between-group
effect.
Time is
significant.
Group is not
significant.
Time*group is not
significant.
References
Jos W. R. Twisk. Applied Longitudinal Data Analysis for Epidemiology: A
Practical Guide. Cambridge University Press, 2003.