variance components and lmms

19
university of copenhagen department of biostatistics Faculty of Health Sciences Variance components and LMMs Analysis of repeated measurements, 4th December 2014 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen 1 / 74 university of copenhagen department of biostatistics Topics for today Leftover from 28/11: Rest of random regression example. New concepts for today: random effects multi-level models linear mixed models (LMMs) for clustered data and repeated measurements in general Suggested reading: Fitzmaurice et al. (2011): chapters 8, 21, 22. Paper by Bland and Altman (see section on comparison of measurement methods) 2 / 74 university of copenhagen department of biostatistics Outline Random regression General repeated measurements Random effects ANOVA (the two-level model) Variance components in general Zero estimates of variance components Linear mixed models (LMMs) Comparing measurement methods 3 / 74 university of copenhagen department of biostatistics Example: Calcium supplements Bone mineral density ( g cm 2 ) in 112 11-year old girls, randomized to either calcium or placebo. Follow-up: every 6 months, 5 visits in total including baseline 4 / 74

Upload: others

Post on 01-Jun-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Faculty of Health Sciences

Variance components and LMMsAnalysis of repeated measurements, 4th December 2014

Julie Lyng Forman & Lene Theil SkovgaardDepartment of Biostatistics, University of Copenhagen

1 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Topics for today

Leftover from 28/11:I Rest of random regression example.

New concepts for today:I random effectsI multi-level modelsI linear mixed models (LMMs)

for clustered data and repeated measurements in general

Suggested reading:I Fitzmaurice et al. (2011): chapters 8, 21, 22.I Paper by Bland and Altman

(see section on comparison of measurement methods)2 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

3 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Example: Calcium supplementsBone mineral density ( g

cm2 ) in 112 11-year old girls,randomized to either calcium or placebo.

Follow-up: every 6 months, 5 visits in total including baseline4 / 74

Page 2: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Random regression

We let each girl have her own level Ai and her own slope Bi

We assume these individual ’parameters’, Ai and Bi ,I So-called random effects

follow a bivariate normal distribution in the population(

AiBi

)∼ N2

((αg(i)βg(i)

),

(τ2

a ωabωab τ2

b

))

The covariance is the so-called G-matrix:I it describes the population variance of the lines,

i.e. the inter-individual variation.

5 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

PROC MIXED: random regression

PROC MIXED DATA=calcium;CLASS grp girl;MODEL bmd=grp visit grp*visit / SOLUTION DDFM=SATTERTHWAITE;RANDOM intercept visit / TYPE=UN SUBJECT=girl(grp) G;RUN;

Individual intercepts and slopes must be specified in therandom-statement.

I Here visit is used as a continuous covariate, and theintercept refers to visit=0.

I Note that type=un refers to a unstructured specification ofthe G-matrix. If it is omitted, we may experience convergenceproblems and sometimes totally incomprehensible results.

I Option g asks that the estimated G-matrix be printed.6 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Output from random regressionEstimated G Matrix

Row Effect grp girl Col1 Col2

1 Intercept C 101 0.004105 3.733E-62 visit C 101 3.733E-6 0.000048

Solution for Fixed Effects

StandardEffect grp Estimate Error DF t Value Pr > |t|Intercept 0.8471 0.008645 110 97.98 <.0001grp C 0.007058 0.01234 110 0.57 0.5685grp P 0 . . . .visit 0.02242 0.001098 95.8 20.42 <.0001visit*grp C 0.004494 0.001571 96.4 2.86 0.0052visit*grp P 0 . . . .

Type 3 Tests of Fixed Effects

Num DenEffect DF DF F Value Pr > Fgrp 1 110 0.33 0.5685visit 1 96.4 985.55 <.0001visit*grp 1 96.4 8.18 0.0052

We find an extra increase in BMD of 0.0045 (0.0016) g/cm3

per half year, when giving calcium supplement.7 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Nonequidistant time points

I The girls are only seen approximately twice a year.I Perhaps we get better estimates of the slopes when

replacing visit with the actual age of the girl.8 / 74

Page 3: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Random regression, using actual age

Estimated G Matrix

Row Effect grp girl Col1 Col2

1 Intercept C 101 0.004215 0.0000952 age11 C 101 0.000095 0.000180

Solution for Fixed Effects

StandardEffect grp Estimate Error DF t Value Pr > |t|

Intercept 0.8667 0.008688 110 99.75 <.0001grp C 0.01113 0.01240 110 0.90 0.3715grp P 0 . . . .age11 0.04529 0.002152 96 21.05 <.0001age11*grp C 0.008891 0.003076 96.6 2.89 0.0048age11*grp P 0 . . . .

In this model, we quantify the effect of a calcium supplement to0.0089 (0.0031) g/cm3 per year.9 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Results from random regression

Group Level at age 11 SlopeP 0.8667 (0.0087) 0.0453 (0.0022)C 0.8778 (0.0088) 0.0542 (0.0022)

Difference 0.0111 (0.0124) 0.0089 (0.0031)P 0.37 0.0048

I.e. steeper slopes than when visit was used as thetime-variable.

I Due to quantificantion (per year vs per 1/2 year)I Due to bias reduction (visit is a proxy for age, and measurement

error in the independent variable causes bias towards the null)

10 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Modeling the covariance

Random regression implies a particular covariance pattern.I Does this fit the data well?

No benchmark for model comparisons:I An unstructured covariance cannot be esimated from

non-equidistant data!

Instead, non-nested models can be compared using Akaikesinformation criterion (AIC) which balances goodness of fit againstmodel complexity.

I Smaller values of AIC indicates a better model fit.

11 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Non-equidistant covariance patterns

In case subject are measured at individual or otherwise non-equallyspaced time points only a limited number of stationary covariancepattern models are available:

I The variance is constant over time.I The correlation depend only on the time-distance between

the observations.

proc mixed Cov(Yij ,Yik) no.type= paramCS σ2[I{j = k}+ ρ · I{j 6= k}] 2SP(POW)(ctime) σ2ρ|tij−tik | 2SP(GAU)(ctime) σ2e−|tij−tik |2/γ2 2SP(LIN)(ctime) σ2(1− ρ|tik − tij |) · I{ρ|tik − tij | ≤ 1}] 2

The ctime-variable must be a numerical variable in SAS.12 / 74

Page 4: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Tests of treatment effect

Comparison of estimates for different covariance structures:

Covariance AIC Cov.par. Differencestructure in slopes P

Independence ?? 1 0.0094 (0.0086) 0.27

Power ?? 2 0.0094 (0.0032) 0.0038(Autoregressive)

Random ?? 4 0.0089 (0.0031) 0.0048Regression

I Confidence intervals and tests depend on the covariance!

13 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

14 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

What are repeated measurents?

Repeated measurements refer to data where the same outcome hasbeen measured in different situations (or at different spots) on thesame individuals.

I Special case: longitudinal means repeatedly over time.

15 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

What is clustered data?

Repeated measurements are termed clustered data when the sameoutcome is measured on groups of individuals from the samefamilies/workplaces/school classes/villages/etc.

16 / 74

Page 5: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Analysis of repeated measurements

Many applications:I Longitudinal dataI Treatments applied to multiple limbs, teeth, etc

within the same person.I Cross-over trials.I Cluster randomized trials / multi-center studies.I Comparisons / reliability of measurement methods.

ATT: Measurements belonging to the same subject/cluster arecorrelated. If we fail to take this correlation into account we willexperience:

I p-values that are too small or too large.I confidence intervals that are too wide or too narrow.

17 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Sources of variation / correlation

Measurements belonging to the same subject/cluster tend to becorrelated (look alike) due to e.g.

I Environmental variation.I Between regions, hospitals or countries.

I Biological variation.I Between individuals, families or animals.

Today: Use random effects (variance components) to modelvarious sources of variation in a linear mixed model framework.

18 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

19 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

One-way analysis of variance – with random variation

Comparison of k groups or clusters, satisfying:

I The groups are of no individual interest and it is of norelevance to test whether they have identical means.

I The groups may be thought of as representatives from apopulation, that we want to describe.

20 / 74

Page 6: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Example: Rabbit data

I R = 6 rabbits vaccinated.I In S = 6 spots on the back.

Response: swelling in cm2

Research question:How much swelling can beexpected in reaction to thevaccine?

21 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Random effects anova (the two-level model)We let each rabbit have its own level of swelling described as

Yrs = Ar + εrs

, I We assume that these individual levels are randomly sampledfrom a normally distributed population,

Ar ∼ N (µ, ω2B)

I The error terms are considered to be independent normal,

εrs ∼ N (0, σ2W )

The rabbit levels are so-called random effects and the variancesω2

B and σ2W are so-called variance components describing the

variance between rabbits and within rabbits, respectively.22 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Implications of random effects anovaAll observations are considered as randomly sampled measurementsfrom the same population. Thus, the model implies that allmeasurements follow the same normal distribution:

Yrs ∼ N (µ, ω2B + σ2

W )

I Population mean µ, the grand mean.I Population variance ω2

B + σ2W , the total variation.

But: Measurements made on the same rabbit are correlated withthe so-called intra-class correlation

Corr(yr1, yr2) = ρ = ω2B

ω2B + σ2

W23 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Compound symmetry

The implied covariance of the repeated measurements has acompound symmetry-structure:

ω2B + σ2

W ω2B . . . ω2

Bω2

B ω2B + σ2

W . . . ω2B... ... ...

ω2B ω2

B . . . ω2B + σ2

W

In particular all pairs of spots on the same rabbit are assumed tobe equally correlated (with the intra-class correlation).

I We say that the spots are exchangeable.

Note: If this is not the case, an unstructured covariance migth fit the databetter. Say, if some spots are expected to respond more similarly than others.

24 / 74

Page 7: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Random effects ANOVA in PROC MIXED

PROC MIXED DATA=rabbit;CLASS rabbit;MODEL swelling = / SOLUTION;RANDOM rabbit;

RUN;

Covariance Parameter Estimates

Cov Parm Estimate

rabbit 0.3304Residual 0.5842

Solution for Fixed Effects

StandardEffect Estimate Error DF t Value Pr > |t|Intercept 7.3667 0.2670 5 27.59 <.0001

25 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Estimation of variance components

Level Variation Variance component Estimate %of variation1 Between ω2

B 0.3304 36%2 Within ω2

W 0.5842 64%Total ω2

B + σ2W 0.9146 100%

We can use the covtest-option in

PROC MIXED COVTEST DATA=rabbit; . . .

to get standard errors for the variance components:I 95%CI for Intra-rabbit variation σ2

W : (0.37 – 1.04).I 95%CI for Inter-rabbit variation ω2

B : (0.06 – 2.48).Beware not to overinterpret the estimates in a small dataset!26 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Computing variance components

In balanced data (same number of observations per cluster):

Explicit solution:

σ2W = MSW and ω2

B = MSB −MSWN

I N is the number of clustersI MSW and MSB are Mean Squares within and between

clusters, defined as in one-way ANOVA.

This is deduced from E(MSB) = Nω2B + σ2

W and E(MSW ) = σ2W ·

27 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Typical differencesDifference between spots on the same rabbit:

yrs1 − yrs2 = εrs1 − εrs2

∼ N (0, 2ω2W )

I Normal region: ± 2√

2ω2W = ± 2.16 cm2

Difference between spots on different rabbits:

yr1s1 − yr2s2 = αr1 − αr2 + εr1s1 − εr2s2

∼ N (0, 2σ2B + 2ω2

W )

I Normal region: ± 2√

2σ2B + 2ω2

W = ± 2.70 cm2

28 / 74

Page 8: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Why not use traditional one-way anova?

Focus on rabbit means: and test H0 : µ1 = . . . = µ6.

One-way anova table:SS df MS=SS/df F

Between rabbits 12.8333 R − 1 = 5 2.5667 4.39Within rabbit 17.5266 R(S − 1) = 30 0.5842Total 30.3599 RS − 1 = 35 0.8674

Test for identical rabbits means: F = 4.39 ∼ F(5, 30), P = 0.004.

But: We are not interested in these particular 6 rabbits,only in rabbits in general, as a species! Presumably these 6 rabbitshave been randomly sampled from the species.

29 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

One-way anova with and without random variation

Classical one-way anovaI The rabbit means µr are fixed parameters,

- supposedly of an interest of their own.I We say that the rabbit factor is a fixed effect.

Random effects one-way anovaI The rabbit levels Ar are considered random and their

population mean µ and variance ω2B + σ2

W is the majorinterest.

I We say that the rabbit factor is a random effect.I (If data is from a pilot study used in the planning of some

trial, the intra-class correlation will also be of interest).

30 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comparison of modeling strategies

Quantifying overall swelling

Four strategies for estimating thegrand mean(i.e. of the rabbit population).

method estimate (s.e.)1: forget rabbit 7.367 (0.155)2: fixed rabbit 7.367 (0.127)3: rabbit averages 7.367 (0.267)4: random rabbit 7.367 (0.267)

1. We assume independencebetween all 36 measurements

2. We estimate the mean swellingof exactly these 6 rabbits byclassical one-way anova

3. We analyse the sample ofaverages for the six rabbits(summary statistics).

4. We estimate the mean swellingof rabbits as a species in therandom effects anova model(the correct approach)

31 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comments on the strategies:

1. Ignoring the clustering is wrong!I leads to systematic underestimation of the standard error.

2. In the fixed effect one-way anova the grand mean has adifferent interpretation!

I leads to systematic underestimation of the standard error.

3. Looking at the sample of averages may be OK.I At least in balanced designs (otherwise the individual averages

have unequal variances and the standard error may be affected)I But we loose all information on within subject variation.

(E.g. not possible to test for systematic spot-differences.)

32 / 74

Page 9: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comparison of modeling strategies

When the 3 smallest measurements from rabbit 2 (largest level)are omitted, the results become:

method estimate (s.e.)1: forget rabbit 7.291 (0.163)2: fixed rabbit 7.291 (0.136)3a: rabbit averages 7.291 (0.265)

(weighted)3b: rabbit averages 7.436 (0.333)

(unweighted)4: random rabbit 7.390 (0.298)Full sample 7.367 (0.267)

1 we have omitted some ofthe largest observations

2+3a rabbit 2 has a lowerweight in the average(only 3 observations)

3b average for rabbit 2 hasincreased

4 rabbit 2 has a lowerweight in the average dueto a larger standard error

33 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Estimation of individual rabbit means

Sometimes estimates of individual random effects are used for e.g.prediction of future disease status.

How do we estimate them?I Simple averages yr . of the individual measurements.I Best unbiased linear predictors (BLUPs) are weightedaverages of the individual and the population mean:

ω2B

ω2B + σ2

WS

yr . +σ2

WS

ω2B + σ2

WS

y..

They have been shrinked towards the grand mean, y...

34 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

BLUPs vs averagesFull data

11

2

2

33

44

55

66

Reduced data

11

2

2

33

44

55

66

Note: We see larger shrinkage for rabbit no. 2 when the 3 smallestmeasurements from this rabbit have been removed (i.e. we areborrowing strenght from the neighbours).35 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

36 / 74

Page 10: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

General variance component models

Generalisations of ANOVA and GLM models involving severalsources of random variation, so-called variance components.

Examples of sources of random variation:I Environmental variation.

I Between regions, hospitals or countries.I Biological variation.

I Between individuals, families or animals.I Within-individual variation.

I Between arms, teeth, days.I Variation due to uncontrollable circumstances.

I E.g. time of day, temperature, observer.I Measurement error.

37 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Multilevel models

Variance component models are also called multilevel models.

I Levels are most often hierarchical.I We have variation, i.e. a variance component, on each level.I And possibly systematic effects (covariates) on each level.

individual → context/cluster → context/clusterlevel 1 → level 2 → level 3students → classes → schoolspatient → clinic → regionsvisit → girl →spot → rabbit →

38 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Example: A three-level model

Outcome: Number of nuclei per cell in the rat pancreas(used for the evaluation of cytostatica)

I R = 4 rats.I S = 3 sections for each rat.I F = 5 randomly chosen fields from each section.

level 1 → level 2 → level 3fields → sections → ratsσ2 τ2 ω2

Reference: Henrik Winther Nielsen, Inst. Med. Anat.

39 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Three-level variations

1

1

11

1

1

1

11

1

11

1

11

1

1

1

1

1

2

2

22

2

2

2

2

2

2 2

2

2

2

2 2

2

2

2

23

3

33

3

3

3

33

3

3

3

3

33

3

3

3

3

3

Variation EstimateRats (ω2) 0.0179 (8.2%)Sections (τ2) 0.0029 (1.3%)Fields (σ2) 0.1968 (90.4%)Total 0.2176 (100%)

40 / 74

Page 11: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Typical differences (normal regions)

I For sections on different rats:

± 2×√

2× (0.0179 + 0.0029 + 0.1968) = ± 1.319

I For different sections on the same rat:

± 2×√

2× (0.0029 + 0.1968) = ± 1.264

I For different fields on the same section:

± 2×√

2× 0.1968 = ± 1.255

41 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Correlation

Estimated correlations between two measurements on the same rat:

I If they are measured on the same section:

Corr(yrs1, yrs2) = ω2 + τ2

ω2 + τ2 + σ2 = 0.096.

I If they are measured on different sections:

Corr(yr11, yr22) = ω2

ω2 + τ2 + σ2 = 0.082.

42 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Merits of multilevel models

We get a better understanding of the various sources of variation.

Effects within may be estimated more precisely (higher power),since some sources of variation are eliminated, e.g. by makingcomparisons within a family. This is analogous to the pairedcomparison situation.

When planning investigations, estimates of the variancecomponents are needed in order to compare the power of variousdesigns, and help us decide

I How many replicates do we need at each level?I Should we randomize entire clusters or randomize within the

clusters?

43 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Design considerations

(Note in analogy with cluster-randomized trials.)

Plan an experiment with:I R rabbits.I S spots for each rabbit.I R × S measurements.

Std. error of grand mean,

var(y) = ω2B

R + σ2W

RS ,

decreases with R and S .

5 10 15 20

0.15

0.20

0.25

0.30

0.35

0.40

0.45

rabbits

stan

dard

err

or

The different curves correspondto S varying from 1 to 10.

44 / 74

Page 12: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Effective sample sizeHow many rabbits would we need to obtain the same precision inestimating the grand mean if we had only one measurement oneach of R1 rabbits?

Solve an equation to get:

R1 = R × S1 + ρ(S − 1)

where ρ is the within rabbit correlation.

I Estimate: ρ = ω2B

ω2B+σ2

W= 0.3304

0.3304+0.5842 = 0.361⇒ R1 = 12.8

I.e. one measurement on each of thirteen rabbits gives the sameprecision as six measurements on each of six rabbits.45 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Drawbacks of multilevel models

Their statistical analysis is more difficult.I When making inference (estimation and testing), it is

important to take all sources of variation into account, andeffects have to be evaluated against the relevant variation.

If we fail to take the correlation into account, we will experience:I Possible bias in the mean value estimates.I Too small standard errors (type 1 error) for estimates of level

2 covariates (between-cluster effects).I Too large standard errors (type 2 error) for estimates of level

1 covariates (within-cluster effects)

46 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Fixed or random effect?

How do we decide whether a factor should be modeled as fixed orrandom?

FixedI The specific values of the factor have been predetermined

when planning the study.I Allows inference for these particular values only.I Demands a decent number of observations in each group.

RandomI A representative sample of values of the factor is present.I Allows inference to be extended beyond the values in the

experiment and to the population they were sampled from.47 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

48 / 74

Page 13: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Example: Cortisol

Outcome: Concentration of cortisol in blood samples takenmorning and evening in workers in Aarhus amt andkommune in 2007 (3536 participants) with similarfollow-up in 2009 (2408 participants)

Interest: effect of stressors: lifeevents, Effort Reward Index

level variation covariates3 between persons gender, age2 within person: between days bmi, stressors1 within person: within days time (of day)

49 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Sample dataFrom 8 randomly selected men:

NOTE: concentrations on logarithmic scale.50 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Multi-level analysis

PROC MIXED DATA=prism COVTEST; WHERE sex EQ ’male’;CLASS id year time;MODEL logcortisol = time / SOLUTION CL DDFM=SATTERTH;RANDOM id id*year;

RUN;

Covariance Parameter Estimates

Cov Parm Estimate Std.Error Z Value Pr > Zid 0.05993 0.01266 4.73 <.0001id*year 0 . . .Residual 0.5385 0.01794 30.01 <.0001

Type 3 Tests of Fixed Effects

Num DenEffect DF DF F Value Pr > Ftime 1 1305 4916.89 <.0001

One of the variance component estimates is a zero!51 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Negative variance componentsIn case on of the variance component estimates becomes negative,SAS repports a zero.

What does it mean?I The zero-estimate may be a chance finding due to statistical

uncertainty.I Or it might be the result of truly negative correlation within

clusters - e.g. from competition (plants grown in same pot).

What can we do about it?I Re-fit the model without the problematic random effect.I Use a covariance pattern model which allows for negative

correlationI Include more covariates at the lower levels.

52 / 74

Page 14: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Estimated variance components

Level Variation Estimate3 between persons (ω2) 0.0599 (10.0%)2 between days (τ2) 0.0000 (0.0%)1 within days (σ2) 0.5385 (90.0%)

Total 0.5984 (100%)

Level 2 covariates (stressors) can only have very little impacton individual cortisol koncentrations!

53 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Systematic effects

Solution for Fixed Effects

StandardEffect time Estimate Error DF t Value Pr > |t| Alpha Lower UpperIntercept 0.4106 0.02209 448 18.59 <.0001 0.05 0.3672 0.4540time morn 2.0137 0.02872 1305 70.12 <.0001 0.05 1.9573 2.0700time even 0 . . . . . . .

Cortisol is measured on log-scale. Backtransformationexp(2.0137) ' 7.49 yields that median levels of kortisol is anestimated 7.5 times higher in the morning than in the evening.

Exact time of measurement should be taken into account!!!

54 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

55 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Specification of linear mixed models (LMMs)

(the "M"in the middle refers to mixed fixed and random effects)

Systematic variationI covariates: time, treatment, gender, age, etc.,

describing population parameters.

Random variation:I Random effects,

describing subject specific parameters.I Serial correlationI Measurement error

Note: Interactions between systematic and random effects are alwaysrandom effects.56 / 74

Page 15: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Technical model description for LMMs(the surrounding "L-M"refers to a linear model specification)

Model repeated outcomes on subject/cluster i as:

Yi = Xiβ + Zibi + εi

using vector- and matrix-notation . . . sorry!I Systematic effects β with designmatrices Xi .I Random effects bi with designmatrices Zi .I Possibly dependent resiudal error terms εi

We assume that the bi ’s and εi ’s are independent normallydistributed with mean zero and covariance matrices given by:

I The G-matrix: Var(bi) = G.I The R-matrix: Var(εi) = R.

57 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Implied covariance for LMMs

The covariance of the repeated measurements on subject/cluster iis given by the general formula:

Vi = ZTi GZi + Ri

. . . using matrix-multiplication (sorry again!)

Note:I This is the so-called V-matrix.I Print with option vcorr in proc mixed.

58 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

SAS: PROC MIXED

model: describes the mean value structure(i.e. covariates / fixed effects)

random: describes the random effectsrepeated: describes the residual covariance.

Very flexible modeling framework!

Example: It is possible to modelI longitudinal series of measurements (level 1) . . .I with repeated series on each subject and with

different treatments along the way (level 2) . . .I and subjects belonging to different clusters (level 3).

59 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Nonidentifiability

Warning: Make sure you understand your model!I Modeling random effects together with a residual error

covariance may result in unidentifiable covariance parameters,i.e. nonconvergence, unless done with some care.

Example: Compound symmetry can be specified as either of:I random intercept / subject=id;I repeated time / subject=id type=cs;

in case both lines are included in the same program, it will notconverge.

60 / 74

Page 16: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Outline

Random regression

General repeated measurements

Random effects ANOVA (the two-level model)

Variance components in general

Zero estimates of variance components

Linear mixed models (LMMs)

Comparing measurement methods

61 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comparing measurement devicesReference: Bland and Altman, The Lancet (1986).

Example: Peak expiratory flow rate, l/min:I 17 subjects, 2 measurement devices,I each measured twice

subject Wright mini Wrightid Y1p1 Y1p2 Y2p1 Y2p21 494 490 512 5252 395 397 430 4153 516 512 520 508. . . . .. . . . .. . . . .

15 178 165 259 26816 423 372 350 37017 427 421 451 443

Average 450.35 445.41 452.47 455.35SD 116.31 119.61 113.12 111.32

62 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Illustration of all data

63 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Aim of investigation

Quantify the precision of each measuring deviceI Variability.I Reproducibility.

Quantify the agreement between the two devicesI Bias of one method compared to the other.I Variance of one method compared to the other.

Can the devices be used interchangably in clinic?

64 / 74

Page 17: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Simple approaches

For reliabilityI Compare the replicate measuements in Bland-Altman plots?.I Each method separately.

For method comparisonI Compare averages in a Bland-Altman plot?I Not good - unless you also do averages in clinic!

? See: Bland & Altman (1986) for further explanation.

65 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Variance component model

level variation covariates3 between subjects (ω2)2 between methods (τ2) method1 within methods (σ2)

Specified as:Yijk = µj + Ai + Bij + εijk

I Ai ∼ N (0, ω2) for subjects i = 1, . . . , 17,I Bij ∼ N (0, τ2) for methods j = 1, 2,I εijk ∼ N (0, σ2) for replicate k = 1, 2.

Assuming same residual variance for both methods . . .

66 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Covariance structure

I We have 4 measurements on each subject

Covariance matrix with ordering (wright1, wright2, mini1, mini2):

ω2 + τ2 + σ2 ω2 + τ2 ω2 ω2

ω2 + τ2 ω2 + τ2 + σ2 ω2 ω2

ω2 ω2 ω2 + τ2 + σ2 ω2 + τ2

ω2 ω2 ω2 + τ2 ω2 + τ2 + σ2

I We expect stronger correlation between measurements madewith the same method than with different methods.

67 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Analysis

PROC MIXED DATA=wright;CLASS method id;MODEL flow=method / SOLUTION CL;RANDOM intercept method / SUBJECT=id;

RUN;

Solution for Fixed Effects

StandardEffect method Estimate Error DF t Value Pr > |t|

Intercept 447.88 27.7519 16 16.14 <.0001method mini 6.0294 8.0532 16 0.75 0.4649method wright 0 . . . .

No evidence of systematic differences between the measurementmethods.

68 / 74

Page 18: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Estimated variance components

Covariance Parameter EstimatesCov Parm Subject EstimateIntercept id 12542method id 393.57Residual 315.37

Fit Statistics-2 Res Log Likelihood 676.0AIC (smaller is better) 681.6

What does this tell us about the precision of the measurements?

69 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Typical differences

Between replicate measuremnts using the same method:

Yijk1 −Yijk2 = εijk1 − εijk2

∼ N (0, 2σ2)

Limits-of-agreement: ±2√

2σ2 ' ±50.23.

Between measuremnts using the different methods:

Yij1k1 −Yij2k1 = µj1 − µj2 + Bij1 − Bij2 + εij1k1 − εij2k1

∼ N (µj1 − µj2 , 2τ2 + 2σ2)

Limits-of-agreement: µ1 − µ2 ± 2√

2τ2 + 2σ2 ' 6.03± 75.31.

(where we include the non-significant systematic difference).70 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comparing precisions

We need a slightly more general model:

Yijk = µj + Ai + Bij + εijk

I Ai ∼ N (0, ω2) for subjects i = 1, . . . , 17,I Bij ∼ N (0, τ2) for methods j = 1, 2,I εijk ∼ N (0, σ2

j ) for replicate k = 1, 2.

Now: method-dependent residual variance-

71 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Analysis

PROC MIXED DATA=wright;CLASS method id;MODEL flow=method / SOLUTION CL DDFM=SATTERTHWAITE;RANDOM intercept method / SUBJECT=id;REPEATED / GROUP=method type=SIMPLE SUBJECT=id*method;

RUN;

Covariance Parameter Estimates

Cov Parm Subject Group EstimateIntercept id 12542method id 393.57Residual method*id method mini 396.44Residual method*id method wright 234.29

Fit Statistics-2 Res Log Likelihood 474.8AIC (smaller is better) 480.8

72 / 74

Page 19: Variance components and LMMs

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Comparing precisions

Estimated precisions:Wright: σ2

1 = 234.29 → ±2√

2σ21 ' XXXX

mini: σ21 = 396.44 → ±2

√2σ2

2 ' XXXX

Seemingly Wright is more precise, but is the difference significant?

−2 log Q = 676.0− 674.8 = 1.2∼ χ2(1)→ P = 0.27

Don’t form too firm a conclusion with too small data.

73 / 74

u n i v e r s i t y o f c o p e n h a g e n d e p a r t m e n t o f b i o s t a t i s t i c s

Overall comparisonSolution for Fixed Effects

StandardEffect method Estimate Error DF t Value Pr > |t|Intercept 447.88 27.7519 16 16.14 <.0001method mini 6.0294 8.0532 16 0.75 0.4649method wright 0 . . . .

No evidence of systematic differences between the measurementmethods.

Typical differnces between the two methods:

Yij1k1 −Yij2k1 = µj1 − µj2 + Bij1 − Bij2 + εij1k1 − εij2k1

∼ N (µj1 − µj2 , 2τ2 + σ21 + σ2

2)

Limits-of-agreement:µ1 − µ2 ± 2

√2τ2 + σ2

1 + σ22 ' 6.03±XXXX .74 / 74