Repeated measurements

Transcription

Repeated measurements
Repeated measurements
Bo Markussen
[email protected]
Department of Mathematical Sciences
June 4, 2014
LAST (MATH)
Statistical methods for the Biosciences
Day 7
1 / 27
Outline
Introduction to SmB-II.
Analysis of repeated measurements.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
2 / 27
Statistical data analysis project
Product:
I
I
I
I
Article style project (10–15 pages, say) with biological background and
objective. Presentation of statistical method and results. Preferably
written such that it easily may be altered into a submission paper.
Oral project presentation on June 18–19 in form of 20 minutes “Power
Point”. Again with both biological and statistical content.
Project handed in by email, preferably in Word, possibly in pdf.
Deadline June 16.
If neither June 18 nor 19 are possible for you, we may find an
alternative dates for handing in project and doing the presentation.
Supervision:
I
I
I
I
You receive comments and suggestions on your project synopsis.
You are entitled to 2 supervisions meetings (≈ 45 minutes) during the
3 weeks project period.
I’ll answer methodological and technical questions by email.
I’ll also act as a “statistical reviewer” on the written report.
Software: May be chosen freely.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
3 / 27
Repeated measurements models: Why?
Example from course day 6: Color of pork meat.
10 pigs from both old and new breed: 7 chops from each pig.
Storage
Dark
Light
0 days
chop 1: data
not used
Time
1 days 4 days
chop 2 chop 3
chop 5 chop 6
6 days
chop 4
chop 7
Random effect model for chops 2 to 7 (in total 2*10*6=120 observations):
rednessi = α(storagei , timei , breedi ) + A(pigi ) + i
|{z}
| {z }
∼N (0,σA2 )
∼N (0,σ 2 )
But what if the experimental design has been like this?
Storage
Dark
Light
LAST (MATH)
0 days
chop 1
chop 2
Time
1 days 4 days
chop 1 chop 1
chop 2 chop 2
Statistical methods for the Biosciences
6 days
chop 1
chop 2
Day 7
4 / 27
example continued. . .
Alternative design has 4 measurements for each pork chop
Storage
Dark
Light
0 days
chop 1
chop 2
Time
1 days 4 days
chop 1 chop 1
chop 2 chop 2
6 days
chop 1
chop 2
Random effect model for the alternative design:
rednessi = α(storagei , timei , breedi ) + A(pigi ) + B(pigi , chopi ) + i
|{z}
{z
}
| {z } |
∼N (0,σA2 )
∼N (0,σB2 )
∼N (0,σ 2 )
Here the 4 measurements on the same pork chop (from the same pig)
share an additional random effect B(pig,chop).
But perhaps measurements taken close in time are more correlated
than measurements taken fare apart in time! How to model that?
LAST (MATH)
Statistical methods for the Biosciences
Day 7
5 / 27
General remarks on repeated measurements
Repeated measurements originate from study designs where the
experimental units have been measured several times (typically at
different time points or at different spatial positions):
I
I
I
I
“Economic” necessity, e.g. when experimental units are expensive.
Experimental units may serve as their own controls.
Response profile (i.e. response over time) is of scientific interest.
Repeated measurements are analysed either to gain power or to
investigate the response profile.
A summary measure is a single number capturing the important
feature of the response profile.
I
I
I
Examples: AUC (area under the curve), mean, maximum, minimum,
range between max and min, time under a pre-specified level, slope,
curvature, halving time, slope after the minimum, . . .
Summary measure preferably suggested from the scientific study, not
from the statistical analysis.
Summary measures reduce the repeated measurements to a single
observation =⇒ statistical analysis without repeated measurements.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
6 / 27
Which method to use?
Summary measures vs. Random effects vs. Repeated measurements
Summary measures is always an option.
I
Unless you have particular interest in the response profile I recommend
analysis of summary measures (if it has sufficient power).
With few repeated measurements per subject, say 4 or less, it does
not make sense to estimate the serial correlation structure.
I
Simply use a random effect model.
With many repeated measurements per subject, say 5 or more, you
have enough information to estimate the serial correlation structure.
I
This is necessary to have trustworthy p-values and confidence intervals.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
7 / 27
Case study: Growth of Baobab trees under water stress
Data kindly provided by Henri-Noël Bouda
Baobab seeds from 3 countries and 7 provenances sown in the
beginning of 2009.
Plants grown under 3 water regimes (100%, 75% and 50% field
capacity).
Diameter and height of plants measured monthly.
To measure root weight etc. some plants were harvested in August
2009, some plants in February 2010.
Purpose of experiment:
I
I
How does water drought effect growth of trees.
Is there an interaction with country and/or provenance?
Some plants die (12%). Should this be incorporated in the analysis?
LAST (MATH)
Statistical methods for the Biosciences
Day 7
8 / 27
Individual response profiles (subject profiles)
For 362 different baobab trees
A good plot to make. Gives overview of the data and provides an
impression of the “typical” time-response relationship.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
9 / 27
Average response profiles
Response profiles averaged within the 9 combinations of treatments and countries
A good plot to make. Gives overview of the treatment effects.
We will analyse profiles from the harvested trees (plot to the right).
In particular we ignore trees that died – possibly from water drought.
I
Any comments on this?
LAST (MATH)
Statistical methods for the Biosciences
Day 7
10 / 27
Data organization in Excel sheet
Wide form (also called “horizontal organization”) of responses: diameter, height
Variable
Country
Provenance
Levels
3 (Burkina,Mali,Tanzanie)
7 (Kolangal,. . . ,Samé)
Plant
Block
Treatment
HarvestDate
Dia0209
..
.
362 (BKol-04,. . . ,TNku-76)
3 (1,2,3)
3 (1,2,3)
3 (aug-09,feb-10,missing)
continuous (or missing)
..
.
Description
Country
3 provenances from Burkina,
3 from Mali, 1 from Tanzanie
Plant id
Field blocks
Water regime
Day of harvest
Diameter, February 2009
..
.
Dia0110
Hei0209
..
.
continuous (or missing)
continuous (or missing)
..
.
Diameter, January 2010
Height, February 2009
..
.
Hei0110
continuous (or missing)
Height, January 2010
LAST (MATH)
Statistical methods for the Biosciences
Day 7
11 / 27
Long form: diameter, height for each month
The “long form” is also referred to as the “vertical organization”
Variable
Country
Provenance
Levels
3 (Burkina,Mali,Tanzanie)
7 (Kolangal,. . . ,Samé)
Plant
Block
Treatment
HarvestDate
month
diameter
height
362 (BKol-04,. . . ,TNku-76)
3 (1,2,3)
3 (1,2,3)
3 (aug-09,feb-10,missing)
12 (2,3,. . . ,13)
continuous (or missing)
continuous (or missing)
LAST (MATH)
Description
Country
3 provenances from Burkina,
3 from Mali, 1 from Tanzanie
Plant id
Field blocks
Water regime
Day of harvest
February’09 — January’10
Diameter
Height
Statistical methods for the Biosciences
Day 7
12 / 27
Long form as needed for the statistical analysis
Obs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
...
...
Country Provenance Plant
Block
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-11
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
Burkina Kolangal BKol-78
1
LAST (MATH)
Treat
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
HarvestDate
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
01AUG2009
Statistical methods for the Biosciences
month diameter height
2
4.33
33.0
3
4.33
33.0
4
5.62
40.0
5
5.65
42.0
6
7.10
52.0
7
10.00
54.0
8
13.35
69.0
9
NA
NA
10
NA
NA
11
NA
NA
12
NA
NA
13
NA
NA
2
4.65
39.0
3
4.65
39.0
4
6.43
39.0
5
6.50
43.0
6
8.00
49.0
7
8.60
62.0
8
13.73
75.0
Day 7
13 / 27
Table of variables
Variable
Country
Provenance
Plant
Type
Nominal
Nominal
Remark:
Nominal
Block
Treatment
month
Nominal (3 levels: 1,2,3)
Nominal (3 levels: 1,2,3)
Nominal (12 levels: 2,. . . , 12,13)
diameter
height
continuous
continuous
(3 levels: Burkina, Mali, Tanzania)
(7 levels: Kolangal,. . . ,Samé)
nested in Country
(362 levels: BKol-04,. . . ,TNku-76)
Usage
fixed effect
fixed effect
random effect
subject id
fixed effect
fixed effect
fixed effect
correlation effect
response
response
The two responses (diameter, height) analysed separately.
R code via lme() in nlme-package:
I
I
I
fixed effects are specified in model formula.
random effects are specified inrandom option.
correlations are specified in corr option.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
14 / 27
Diagram of fixed and random factors
3/
362
7
[plant]335
(
3412
'
/
21
6
[I]2819
/ block32
9
treat*block4
7
treat*provenance12
'
252
treat*month*provenance132
/
'
36
< E 01
1
7
7
provenance6
treat*month22
(
"/
3
treat2
84
month*provenance66
/
'
12
month11
In the model reduction provenance is nested within country.
Are the residuals i , i = 1, . . . , 3412, independent?
LAST (MATH)
Statistical methods for the Biosciences
Day 7
15 / 27
Repeated measurements model
diameteri = α(treati , monthi , provenancei , blocki )
+ A(planti ) + B(planti , monthi ) + i
|{z}
{z
}
| {z } |
∼N (0,σA2 )
∼N (0,σ 2 )
∼N (0,σB2 )
|
{z
[I]-term in the factor diagram
}
Random effect A: Some plants are bigger than others.
Correlated effect B: Correlated within plants (∼ subject id).
Correlation typically decreases with increasing time distance.
Uncorrelated between plants.
I
Possible interpretation is variation between time position of growth
period.
Error term : Possible interpretation is measurement error.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
16 / 27
Three examples of correlation structures for B
diameteri = α(treati , monthi , provenancei , blocki ) + A(planti ) + B(planti , monthi ) + i
(A) The model without the serial correlated effect B.
I
In this case we have a random effect model as treated on Day 6. This
model is also referred to as the random intercept model or the
compound symmetry model.
|monthi −monthj |
d
|monthi −monthj |2
ρ2
(B) Var B(plant, monthi ), B(plant, monthj ) = σB2 exp −
I
Correlation has exponential decrease.
(C) Var B(plant, monthi ), B(plant, monthj ) = σB2 exp −
I
I
Correlation has Gaussian decrease.
When a random effect A and an error term are present, this model is
sometimes referred to as the Diggle model after Peter Diggle.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
17 / 27
R code
# In the data frame ’baobab’ we have the factors:
#
Plant, Block, Treatment, Provenance, Country
long <- reshape(baobab,
varying=list(c("Dia0209","Dia0309","Dia0409","
c("Hei0209","Hei0309","Hei0409","
v.names=c("diameter","height"),
timevar="month",
idvar="Plant",
direction="long")
# Diggle model: two other models in R script
mGauss <-lme(diameter~Treatment*Block+
Treatment*factor(month)*Provenance,
random=~1|Plant,
corr=corGaus(form=~month|Plant,nugget=TRUE),
data=long,na.action=na.omit)
LAST (MATH)
Statistical methods for the Biosciences
Day 7
18 / 27
Which repeated measurements model to use?
There exists many other models than those listed on slide 17
Is the model valid?
I
I
I
Residual plot: Non-random scatter suggests that the explanatory
variables have not been used appropriately, e.g. an interaction or a
quadratic term might be missing.
Normal quantile plots: Residuals not on a straight line suggests that
the response variable perhaps should be transformed.
Semi-variogram: Compares empirical correlation structure (the dots) to
the fitted theoretical correlation structure (the line).
Interpretation?
I
Random effects have a simple interpretation, which speak in favour of
the compound symmetry model. The exponential decrease and the
Diggle model have similar interpretations.
Akaikes Information Criterion (AIC): “The smaller the better”.
I
For the Baobab dataset the compound symmetry model is clearly
rejected by the AIC.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
19 / 27
Exponential vs. Gaussian decrease: Residual plot
Exponential decrease model
Diggle model
4
Standardized residuals
Standardized residuals
4
2
0
−2
−4
2
0
−2
−4
5
10
15
0
Fitted values
5
10
15
Fitted values
plot(mExp,main="Exponential decrease model")
plot(mGauss,main="Diggle model")
LAST (MATH)
Statistical methods for the Biosciences
Day 7
20 / 27
Exponential vs. Gaussian decrease: Normal quantile plot
Note that the axes are interchanged relative to the usual qqnorm()
Diggle model
Quantiles of standard normal
Quantiles of standard normal
Exponential decrease model
2
0
−2
−4
−2
0
2
4
2
0
−2
−4
Standardized residuals
−2
0
2
4
Standardized residuals
qqnorm(mExp,main="Exponential decrease model")
qqnorm(mGauss,main="Diggle model")
LAST (MATH)
Statistical methods for the Biosciences
Day 7
21 / 27
Semi-variogram: γ(h) = 12 var X (t + h) − X (t)
An alternative is to use Chapter 9.4 in the R guide
Exponential decrease model
Diggle model
1.0
0.6
0.8
Semivariogram
Semivariogram
0.5
0.4
0.3
0.6
0.4
0.2
0.2
0.1
2
4
6
8
10
2
Distance
4
6
8
10
Distance
plot(Variogram(mExp),ylim=c(0,0.7))
plot(Variogram(mGauss),ylim=c(0,1.1))
LAST (MATH)
Statistical methods for the Biosciences
Day 7
22 / 27
Choice of repeated measurements model
Residual and normal quantile plots acceptable for all models
Model
AIC
Compound symmetry
10534.887
Exponential decrease
8710.159
Diggle
8806.953
Akaikes Information Criterion (AIC) prefers the exponential decrease
model. However, the semi-variogram suggests that the correlation
structure is better modelled by the Diggle model.
We choose the Diggle model, which we describe as:
“An ANOVA with random effect of plant and residual errors
correlated within plants. The errors consist of an independent
component and a component with Gaussian decreasing
correlation. For the fixed effects we used the concatenation of
the full factorial design of (tretment,month,provenance) and the
full factorial design of (treatment,block)”.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
23 / 27
Overview of steps in a repeated measurements analysis
List and classify the factors and covariates in the design.
I
Done (see slide 14).
Make plots of individual, and perhaps averaged, response profiles.
I
Done (see slides 9 and 10).
Choose and validate a correlation structure.
I
Done (see slides 20 to 23).
Test for reduction of fixed effects: interactions, main effects,
covariates etc. (as usual for ANOVA and ANCOVA models).
I
I
I
Remember to refit models using maximum likelihood (method="ML").
Unfortunately the drop1() function does not work for lme-objects. So
this has to be done by hand (see Chapter 9.5.3 in the R guide).
Automatic model selection based on AIC may be done using
stepAIC() from the MASS-package.
Report estimates and conclusions from the final model (as usual, e.g.
using lsmeans and the multcomp-package).
LAST (MATH)
Statistical methods for the Biosciences
Day 7
24 / 27
Analysis of Summary measures
An alternative to the repeated measurements analysis discussed above
Idea:
I
I
Reduce the curve for each subject to a single value.
Analyze this summary measure as usual (ANOVA, regression, . . . ).
As summary measures we could for example use:
I
I
I
I
I
I
I
Average response over time.
Area under curve (AUC, often used in medicine).
Slope of curve (rate of increase).
Maximal response.
Position (e.g. time) of maximal response.
Halving time since maximal response.
Curvature: fit α + β ∗ time + γ ∗ time2 for each individual and use γ̂.
Note: The summary measures should be computed for each subject — not
on the average profiles!
LAST (MATH)
Statistical methods for the Biosciences
Day 7
25 / 27
Principles for choosing summary measures
Select a measure that addresses the problem under investigation.
Do not choose summary measures on the basis of visual inspection of
the treatment differences — this is cheating.
I
But it is OK to plot all profiles in one graph and select “typical
features” of the curves for further investigation.
You may analyze more than one summary measure. If so, then choose
some that reflect different aspects of the curves. For example:
I
I
AUC and average response is NOT a good combination.
AUC and rate of increase might be a good combination.
But be aware of the associated multiple testing problem.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
26 / 27
Analysis of summary measures: Pros and Cons
Advantages:
I
I
I
Simple analysis, which is more easily communicated.
Often powerful analysis if the summary measure is chosen appropriately.
Model validation more easy and transparent.
Disadvantages:
I
I
I
Each curve is reduced to a single value — loss of information?
Which summary measure should be choose?
No investigation of the “temporal” structure, which might be
important for the problem under investigation.
LAST (MATH)
Statistical methods for the Biosciences
Day 7
27 / 27