Title: Introduction* to Mixed Effects and Repeated Measures Models
1Introduction to Mixed Effects and Repeated
Measures Models
- Presented by Peter Westfall, Professor of
Statistics, Texas Tech - Warning There will be a quiz
Some material is adapted from Brown and
Prescott, Applied Mixed Models in Medicine,
Wiley New York (1999) Some from Littell et al.
The SAS System For Mixed Models, SAS Institute
Inc.1996
2Mixed Models are Useful For
- Crossover trials
- Multicenter trials
- Unbalanced data, missing data
- Comparing means when sample sizes vary
- Repeated observations on a patient
- Over time
- Concurrently, but in different body locations
(e.g. left and right eye)
3Introductory Example (EX1)
Treatment A eye 1, Treatment B in eye 2
(randomized) Treatment
Difference Patient Patient A B
A-B Mean 1 20 12 8
16.0 2 26 24 2
25.0 3 16 17 -1
16.5 4 29 21 8
25.0 5 22 21 1 21.5
6 24 17 7 20.5 Mean
22.83 18.67 4.17 20.75
4Model A (bad) Independence
- yij m tj eij , where
- yij observation j on patient i
- jA or B (treatment)
- m overall mean
- tj effect of treatment j
- eij error term
- Assumptions
- m, ti are fixed
- the eij are random, mean zero, and (gasp)
independent, - with common variance s2.
5SAS File for model A (ind.)
Title "model A bad" Data ex1 input sub y
trt _at__at_ cards 1 20 A 1 12 B 2 26 A 2 24
B 3 16 A 3 17 B 4 29 A 4 21 B 5 22 A 5 21
B 6 24 A 6 17 B proc glm class trt
model y trt estimate "Mean A" intercept 1
trt 1 0 estimate "Mean B" intercept 1 trt 0
1 run quit
6Results from Model A
Dependent Variable y
Sum of Source DF
Squares Mean Square F Value Pr gt F Model
1 52.0833333 52.0833333
2.68 0.1325 Error 10
194.1666667 19.4166667 Corrected Total
11 246.2500000
Standard Parameter Estimate
Error t Value Pr gt t Mean A
22.8333333 1.79891943 12.69
lt.0001 Mean B 18.6666667
1.79891943 10.38 lt.0001
7Model B Fixed Patient Effects
- yij m pi tj eij , where
- yij observation j on patient i
- jA or B (treatment)
- m overall mean
- pj effect of patient i
- tj effect of treatment j
- eij error term
- Assumptions
- m, pi, and ti are fixed
- the eij are independent mean zero random
variables with - common variance s2.
8SAS File for model B (fixed effects.)
Title "model B fixed" proc glm dataex1
class trt sub model y trt sub estimate
"Mean A" intercept 1 trt 1 0 estimate "Mean
B" intercept 1 trt 0 1 estimate "Mean A,
sub 2" intercept 1 trt 1 0 sub 0 1 0 0 0 0
estimate "Mean B, sub 6" intercept 1 trt 0 1 sub
0 0 0 0 0 1 run quit
9Results from Model B
Sum of
Source DF Squares Mean
Square F Value Pr gt F Model
6 206.8333333 34.4722222 4.37
0.0634 Error 5
39.4166667 7.8833333 Corrected Total
11 246.2500000 Source
DF Type III SS Mean Square F Value Pr gt F
trt 1 52.0833333
52.0833333 6.61 0.0500 sub
5 154.7500000 30.9500000 3.93
0.0798
Standard Parameter Estimate
Error t Value Pr gt t Mean A
22.8333333 1.14624992 19.92
lt.0001 Mean B 18.6666667
1.14624992 16.28 lt.0001 Mean A, sub
2 27.0833333 2.14443725
12.63 lt.0001 Mean B, sub 6
18.4166667 2.14443725 8.59 0.0004
10Model C-1 Random effects
- yij m pi tj eij , where
- yij observation j on patient i
- jA or B (treatment)
- m overall mean
- pj effect of patient i
- tj effect of treatment j
- eij error term
- Assumptions
- m and the ti are fixed
- the pj and the eij are random, mean zero, and
independent, - with mean 0, and with Var(pj) and
Var(eij) s2.
11SAS File for model C-1 (random effects)
Title "model C-1 random" proc mixed dataex1
class trt sub model y trt random
sub estimate "Mean A" intercept 1 trt 1 0
estimate "Mean B" intercept 1 trt 0 1
estimate "Mean A, sub 2" intercept 1 trt 1 0
sub 0 1 0 0 0 0 estimate "Mean B, sub 6"
intercept 1 trt 0 1 sub 0 0 0 0 0 1 run
quit
12Results from Model C-1
-2 Res Log Likelihood 59.4
Covariance Parameter
Estimates Cov Parm
Estimate sub
11.5333 Residual
7.8833
Type 3 Tests of Fixed
Effects Num Den
Effect DF DF F
Value Pr gt F trt 1
5 6.61 0.0500
Standard
Label Estimate Error DF
t Value Pr gt t Mean A
22.8333 1.7989 5 12.69
lt.0001 Mean B 18.6667 1.7989
5 10.38 0.0001 Mean A, sub 2
26.0008 1.9396 5 13.41
lt.0001 Mean B, sub 6 18.4803 1.9396
5 9.53 0.0002
13Model C-2 Mean Covariance Form of C-1
- yij m tj eij , where
- yij observation j on patient i
- jA or B (treatment)
- m overall mean
- tj effect of treatment j
- eij error term
- Assumptions
- m and the ti are fixed
- the (eiA,eiB) are random, mean zero, and
independent vectors, - with Cov(eiA,eiB)
14SAS File for model C-2
Title "model C-2 mean-cov form" proc mixed
dataex1 class trt sub model y trt
repeated trt / subject sub typecs
estimate "Mean A" intercept 1 trt 1 0
estimate "Mean B" intercept 1 trt 0 1 run
quit
15Results from Model C-2
-2 Res Log Likelihood 59.4
Covariance Parameter
Estimates Cov Parm
Subject Estimate CS
sub 11.5333
Residual 7.8833
Type 3 Tests of Fixed
Effects Num Den
Effect DF DF F
Value Pr gt F trt 1
5 6.61 0.0500
Estimates Standard
Label Estimate Error DF t
Value Pr gt t Mean A 22.8333
1.7989 5 12.69 lt.0001 Mean
B 18.6667 1.7989 5 10.38
0.0001
16Variance, Covariance notes Var(X)
E(X-E(X))2 Var(aXb) a2Var(X), if a and b
are constants Var(XY) Var(X) Var(Y)
2Cov(X,Y) Cov(X,Y) E(X-E(X))(Y-E(Y)) Cov(aXb
, cYd) acCov(X,Y), if a,b,c,d are
constants Covariance matrix S Cov(X1,,Xk)
Covariance matrix Of a vector of linear
combinations Cov(AX) ASA
17Exercise 1 Show that model C-1 implies model
C-2Exercise 2 Find the variance of the
difference between treatment averages using A,
C-1, and C-2.
18Model D Unstructured Covariance Matrix
Identical to model C-2 except that Cov(eiA,eiB)
Exercise 3 Show that Model C-2 Implies Model D,
but not vice versa.
19SAS File for model D
Title "model D unstructured" proc mixed
dataex1 class trt sub model y trt
repeated trt / subject sub typeun
estimate "Mean A" intercept 1 trt 1 0
estimate "Mean B" intercept 1 trt 0 1 run
quit
20Results from Model D
-2 Res Log Likelihood 59.4
Covariance Parameter
Estimates Cov Parm
Subject Estimate
UN(1,1) sub 20.9667
UN(2,1) sub 11.5333
UN(2,2) sub 17.8667
Type 3 Tests of Fixed
Effects Num Den
Effect DF DF F
Value Pr gt F trt 1
5 6.61 0.0500
Estimates
Standard Label
Estimate Error DF t Value Pr
gt t Mean A 22.8333 1.8693
5 12.21 lt.0001 Mean B
18.6667 1.7256 5 10.82 0.0001
21More exercises
Exercise 4 Show how to get the standard error
for the mean of treatment A in the unstructured
model Exercise 5 Find the standard error for
the difference between sample means using the
unstructured model.
22Model E Multivariate Analysis representation of
model D
Title "standard multivariate" Data ex1_mv
input yA yB diff yA-yB cards 20 12
26 24 16 17 29 21 22 21 24 17
proc univariate var diff run proc corr
cov var ya yb run
23Output from multivariate analysis
Tests for Location Mu00
Test -Statistic- -----p
Value------ Student's t t
2.570363 Pr gt t 0.0500
Covariance Matrix, DF 5
yA
yB yA 20.96666667
11.53333333 yB
11.53333333 17.86666667
Pearson Correlation Coefficients, N
6 Prob gt r under H0
Rho0 yA
yB yA 1.00000
0.59589
0.2120 yB
0.59589 1.00000
0.2120
24Linear models
Univariate Y X b
e (nx1) (nxp)
(px1) (nx1) Multivariate Y
X b e
(nxm) (nxp) (pxm) (nxm) Comment With
mixed linear models, we always use the
univariate form. But it is helpful to know the
correspondence. Exercise 6 Write model D in
the univariate form. Write model E in the
multivariate form. Exercise 7 Suppose that
there is a covariate Xi, for each patient.
Write model D in univariate form, allowing
(covariate x treatment) interaction. Repeat
for model E.
25Example 2 Randomized placebo/control trial
Patients are randomized to treatment goups.
Measurements are taken from both eyes. Data is
in http//members.tripod.com/PWestfall/ex2.txt Pat
ient Trt Eye Response 1 A
L 20.1 1 A R 17.6 2
A L 17.1 2 A R 22.3
51 P L
12.4 51 P R 13.5 52 P L
12.3 52 P R 13.5
26Random Effects Model for Example 2
- yijk m pi tk eijk , where
- yijk observation j on patient i in treatment
group k - jL or R (eye)
- k A or P (Treatment or Placebo)
- m overall mean
- pj effect of patient i
- tk effect of treatment k
- eijk error term
- Assumptions
- m and the tk are fixed
- the pj and the eijk are random, mean zero, and
independent, - with mean 0, and with Var(pj) and
Var(eijk) s2.
27SAS File for Example 2 Random Effects
data ex2 infile "c\research\ex2.txt"
input patid trt eye resp run proc mixed
dataex2 class trt eye patid model resp
trt/s random patid run quit
28Output from random effects model, Example 2
Covariance Parameter
Estimates
Cov Parm Estimate
patid 5.1586
Residual 7.4941
-2 Res Log Likelihood
1054.7 Solution for
Fixed Effects
Standard Effect trt Estimate
Error DF t Value Pr gt t Intercept
15.0030 0.4220 98
35.55 lt.0001 trt A
1.1340 0.5968 100 1.90
0.0603 trt P 0
. . . .
Type 3 Tests of Fixed Effects
Num Den Effect
DF DF F Value Pr gt F
trt 1 100 3.61 0.0603
29Mean-Covariance form for Ex. 2
- yijk m tk eijk , where
- yijk observation j on patient i in treatment
group k - jL or R (eye)
- k A or P (Treatment or Placebo)
- m overall mean
- tk effect of treatment k
- eijk error term
- Assumptions
- m and the tk are fixed
- the (eiLk, eiRk) are random, mean zero, and
independent vectors, - with Cov(eiLk, eiRk)
30SAS File for Mean-Covariance form of Example 2
proc mixed dataex2 class trt eye patid
model resp trt/s repeated eye/subjectpatid
typecs run quit
Exercise 8 Would the typeun covariance
matrix make any sense here? Exercise 9 Write
the data for this study as Y X b e
(use notation as needed) Exercise 10 Find
the standard error of the difference between
Sample treatment means
31Fitting heteroscedastic covariance matrices
Model Same as the mean-covariance form for ex.
2, but with Cov(eiLA, eiRA) And Cov(eiLP,
eiRP)
32SAS File for heteroscedastic covariances in
Example 2
proc mixed dataex2 class trt eye patid
model resp trt/s repeated eye/subjectpatid
typecs grouptrt run quit
Exercise 11 Write the model as Y X b
e. What is different from Exercise 9?
33Comparing Models
Nested Models Chi-square test c2 -2LnL0 -
(-2LnL1) with df difference in number of
parameters Any models Penalized Likelihood
AIC -2LnL 2q
(smaller-is-better) BIC -2LnL 2qLog(N)
(smaller-is-better) q number of cov
parameters N approx. number of independent
sampling units
34Output from heteroscedastic model, Example 2
Covariance Parameter Estimates
Cov Parm Subject Group
Estimate Variance patid
trt A 8.4105 CS
patid trt A 2.5618
Variance patid trt P 6.5777
CS patid trt P
7.7555 -2 Res Log Likelihood
1051.1
Solution for Fixed Effects
Standard Effect trt
Estimate Error DF t Value Pr gt
t Intercept 15.0030 0.4700
98 31.92 lt.0001 trt A
1.1340 0.5968 98 1.90
0.0604 trt P 0
. . . .
no evidence of het.
LRT 1054.7 - 1051.1 3.6
35Mixed Models Theory
General form of a mixed model Y X b Zu
e Where X b denotes the fixed effects part X
is the fixed design matrix b is the fixed
unknown parameter vector Zu denotes the
random effects part Z is a fixed design
matrix u is a random unobservable vector of
random effects with E(u) 0 and Cov(u) G e
denotes the random unobservable vector of errors,
with E(e) 0 and Cov(e) R. u and e are
assumed uncorrelated (and ideally, normal).
36More exercises!!!
Exercise 12 Write models C-1, C-2, and D of
exercise 1 in the form of the mixed model.
Identify all model terms, including the
covariance matrices G and R. Exercise 13
Write down the heteroscedastic covariance
model from example 2 in the form of the mixed
model, identifying all terms, including G and R.
Use as needed.
37Modeling with PROC MIXED
- MODEL Statement Û X and b
- RANDOM Statement Û Z, u, and G
- REPEATED Statement Û R
- Different (often equivalent) ways to model
covariance - Ignore Z and u and model all within-subject
covariance using R - Model within-subject covariance using Z and u
38Notes on PROC MIXED Syntax
You can have more than one RANDOM statement. You
can have only one REPEATED statement SUBJECT
class variable name indicates a
collection of observations that are correlated
within the levels of the SUBJECT variable and
are uncorrelated between levels GROUP
class variable name indicates a collection
of observations that have common
covariance parameters within a level of the GROUP
variable, but different covariance
parameters between levels
39The Covariance Matrix of Y
Cov(Y) V Z G Z R Exercise 14
Prove it! Exercise 15 Write down V for model
C-1 of exercise 1, and use it to find the
correlation between y3A and y3B.
40Estimation and Testing of b
GLS
Where
EGLS
Parameters in
and
are estimated using ML methods
Standard errors if cb is estimable, then
Exercise 16 Derive standard error formula.
41Why GLS?????
You could use OLS, so why not? Estimates, s.e.s
where
Problems with OLS - Inefficient estimates
- Incorrect s.e.s
42Estimation of G and R
Maximize ll (log likelihood) with respect to the
parameters in G and R to get estimates. Note
REML (the default) provides the usual unbiased
estimates In simple cases eg, SSE/(n-p) in OLS,
rather than SSE/n (the MLE).
43Modeling a Multi-Center Clinical Trial
Data Baseline Diastolic Blood Pressure (dbp) on
each patient Nine-week dbp measure
(LOCF) Treatments A,B, and C Data come from 35
centers (1 40 patients per center)
44A Quiz
Exercise 17 Write down a model of the form
yabc with appropriate subscripts. State and
defend the assumptions of your model.
Exercise 18 Sketch a graph showing how the
regression lines (for y 9 week dbp, x
baseline dbp) might look for treatments A, B and
C in center 1 draw another graph showing the
same for center 2. Exercise 19 Write down your
model for the multicenter clinical trial in the
form of the general mixed model, identifying all
terms, including G and R. Use as
needed. Exercise 20 Write down V for your
multi-center model use as needed.
45PROC MIXED syntax for Multi-Center Model
(Data and SAS files for the Brown and Prescott
book available at http//www.ed.ac.uk/phs/mixed/ht
ml/Download.html )
DATA a INFILE 'c\research\bp.dat' INPUT
patient visit center treat dbp dbp1 cf
cf1 run DATA a SET a BY patient IF
last.patient run PROC MIXED covtest CLASS
center treat TITLE 'MODEL 1' MODEL dbp
dbp1 treat/ SOLUTION random intercept treat/
subjectcenter LSMEANS treat/ DIFF PDIFF
CL run quit
46Subscript-based model
DBPijk m b(pre)ijk (trt)k (center)j
(centertrt)jk eijk i patient id
(distinct) j center id (distinct) k
treatment (A, B or C) Assumes m, b, trtA, trtB,
trtC are fixed the (center)i, (centertrt)jk,
and eijk are random, independent mean 0, with
Var((center)i) , Var((centertrt)jk)
, and Var(eijk)
47Equivalent Model using SUBJECT
Replace random center treatcenter with
random intercept treat/ subjectcenter
This creates several independent models and
stacks them Model 1 (Center1) DBPik m
b(pre)ik (trt)k m (rtrt)k eik m, b and
trtk are fixed m, rtrtk and eik are independent,
mean 0, with Var(m) , Var((rtrt)k)
, and Var(eijk) Model 2 (Center2) DBPik m
b(pre)ik (trt)k m (rtrt)k eik Random
effects differ from model 1 (they are
independent) but fixed effects and variance
components are identical Model 3, Model 4
similar story
48 Printing the V, G and R matrices
With RANDOM statement - use the G option (very
big matrix)
- with SUBJECT option, use
V ltlist of
subject valuesgt
to see blocks of V
With REPEATED
statement - Use R to see whole thing
- with
SUBJECT option, use
R ltlist of subject valuesgt
to
see blocks of R
49Example Covariance Structures
Compound Symmetry CS First-Order
Autoregressive AR(1) Toeplitz with Two
Bands TOEP(2) First-Order Autoregressive
Moving-Average ARMA(1,1)
50Repeated Measures ExamplesFirst example - One
Subject only
Plot of lproflgnp. Legend A 1 obs, B 2
obs, etc. lprof 5.5 ˆ
A AA
A A
A A 5.0 ˆ
A A A
A A A
A
A A 4.5 ˆ
A A
A
A 4.0 ˆ A
A AA A A A
A A 3.5 ˆ
A AA
3.0 ˆ Šˆƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒ
ƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒˆ
6.0 6.5 7.0 7.5
8.0 8.5 9.0
lgnp
Predict yi ln(CorpProfits)i from xi
ln(GNP)i iyear, from 1960 to 1991 (n32) Data
set available at http//www2.tltc.ttu.edu/ westf
all/images/5349/ corp_prof.htm
51SAS File
data corp1 infile "c\research\corp.txt"
input year corpprof gnp lprof
log(corpprof) lgnp log(gnp) run proc reg
datacorp1 title "OLS analysis - assumes
unc. errors" model lprof lgnp / dw
run proc mixed datacorp1 title "Identical
to OLS" model lprof lgnp/s run proc
mixed datacorp1 title "Assumes CS
covariance structure" model lprof lgnp/s
repeated /subject intercept type cs
run proc mixed datacorp1 title "Assumes
Autoregressive covariance structure" model
lprof lgnp/s repeated /subject intercept
type ar(1) run proc mixed datacorp1
title "Assumes ARMA(1,1) covariance structure"
model lprof lgnp/s repeated /
subjectintercept type arma(1,1) run proc
mixed datacorp1 title "Assumes banded
Toeplitz covariance structure - 1 lag" model
lprof lgnp/s repeated /subject intercept
type toep(2) proc mixed datacorp1
title "Assumes banded Toeplitz covariance
structure - 2 lags" model lprof lgnp/s
repeated /subject intercept type toep(3)
proc mixed datacorp1 title "Assumes
banded Toeplitz covariance structure - 3 lags"
model lprof lgnp/s repeated /subject
intercept type toep(4) proc mixed
datacorp1 title "Assumes banded Toeplitz
covariance structure - 4 lags" model lprof
lgnp/s repeated /subject intercept type
toep(5) run quit
52(No Transcript)
53Quiz
Exercise 21 Write down the AR(1) corp profits
model using subscript notation. State all
model assumptions and defend (or criticize)
them. Exercise 22 Identify Y, X, Z, u, b, G
and R for the AR(1) corp profits model. Use
as needed. Exercise 23 Repeat exercise 20 and
21 for the CS model. Exercise 24 Write the CS
model as a random effects model. Use this model
to show why there is a problem with using the CS
model for these data.
54Repeated Measures Multiple Subjects
Case description Workers perform various
lifting tasks throughout the day. Â There is an
amount of stress associated with each lift.Â
Ergonomists have defined various measurements of
stress. In the data set there are two such
measures one is called li81 (published in 1981)
and the other is li91 (published in 91). The
input data has the logs of these stress
measures. The funding agency wants to know if
the li81 measure is predictive of the li91
measure. Our analysis must account for the
repeated measures on each subject, which implies
that the observations within a person are
correlated. http//www2.tltc.ttu.edu/westfall/imag
es/5349/li20case_description.htm
55Repeated Measures Regression Model
Yij b0 b1 Xij eij Y ln(li91) X
ln(li81) i worker j observation within
worker b0 population intercept b1
population slope Note We must model
correlation between (ei1 ei2 )
56Quiz
Exercise 25 Write down the random effects model
in subscript form that will allow a CS
covariance matrix. Write the CLASS, MODEL and
RANDOM statements To correspond. Exercise 26
Write down the model in mean and
covariance matrix form to allow a CS covariance
matrix. Write the CLASS, MODEL and REPEATED
statements to correspond.
57Random Intercept and CS Models
Random Intercept data liftindx infile
"c\research\liftindex.txt" input id idgrp
lnli91 lnli81 run proc mixed dataliftindx
covtest title "Repeated Measures Using
Random Intercept - Same as CS" class id
model lnli91 lnli81/s random int / subid
v1,10,19,29,33 run Exercise 27 Write the
random line without using subid. CS
covariance Structure use repeated/ subjectid
typecs r1,10,19,29,33
58Random Coefficients
Random intercept and slope (no covariance
structure equivalent)
proc mixed dataliftindx covtest title
"Repeated Measures Using Random Coefficients
Model" class id model lnli91
lnli81/s random int lnli81 / typeun subid
g gcorr v1,10,19 run
Random Coefficients model yij b0 b1xij g0i
g1ixij eij , where E(g0i)E(g1i)E(eij)0
Var(g0i)s00, Var(g1i)s11, Cov(g0i,g1i)s01,
Var(eij)s2 and g0i, g1i , eij
independent. (No way to anticipate the mean
covariance matrix form)
59(No Transcript)
60Quiz
Exercise 28 Write the form of the X, b, Z, and
u matrices (or vectors) for the RC model in this
case. Use notation as needed. Exercise 29
Write the theoretical form of the V matrix. Use
notation as needed. Exercise 30 Would
other (preferably, more parsimonious) covariance
structures for the random coefficients make
sense? Discuss.
61Seemingly Unrelated Regressions
(Related to crossover trials and time-dependent
covariates)
Yij investment by in year i by company j X1ij
market value of company j in year i X2ij
capitalization of company j in year i j GM,
Chrys, GenElec, WestingH, USSTeel i
1935-1954 Data available at http//www2.tltc.ttu.
edu/westfall/images/5349/grunfelds_investment_data
.htm There are 5 regression equations, one for
each firm, and they are seemingly
unrelated Exercise 30 Write the regression
models, and explain how and why the residuals
might be correlated.
62Missing Data In SUR
One beauty of the Mixed Model approach is that
complete cases are not needed you can use all
of the data that you have. Caveat Missing
cases should be missing AT RANDOM! (the bad news
is that this assumption is frequently not
satisfied!) Example Investment data, with data
for various companies Missing at particular
years.
63SAS file showing missing data handling in SUR
data inv infile "c\research\grunf_fake.txt"
input year Inv mktval cap comp run Proc
sort by year Proc print title "Data
structure used by PROC MIXED" proc mixed
orderdata title "SUR Using PROC MIXED"
class year comp model inv comp mktvalcomp
capcomp/s noint repeated comp/subjectyear
typeun r1,2,3,21,22,23 run
64Details of Growth Curve CaseAnalysis of
Hemodialyzers
data dial infile "C\research\dial.txt"
input sub qb tmp ufr index tmp tmp/100 ufr
ufr/100 run
Response variable UFR ultraftration rate
Predictor variables QB blood flow
(200 dl/min or 300 dl/min) TMP
transmembrane pressure (.24,
.505, .995, 1.485, 2.02, 2.495 and 3.0
dmHg) INDEX TMP number (1,2,3,4,5, or 6) SUB
Dialyzer (1,,20)
65Plot For Growth Curve Example
66Quiz!!!!
Exercise 31 Write a mixed model to predict UFR.
What assumptions are you making? Do those
assumptions seem reasonable? Exercise 32
Write the SAS PROC MIXED code needed to fit your
growth curve model.
67BLUPs
Example Consider estimating the means of
treatment A in the blood pressure trial for
different centers. Objective Rank the centers
according to average dbp in their patient
populations. Problem The simple averages may
be inappropriate when the number of patients per
center varies. Solution Rank centers using
BLUPs (best linear unbiased predictors), which
shrink the estimates toward an overall mean.
68Mixed Model Equations
General Mixed Model Y Xb Zg e, with
Cov(g)G and Cov(e) R BLUP estimates for g and
GLS estimates for b are obtained simultaneously
as follows
69SAS File
DATA a INFILE 'c\research\bp.dat' INPUT
patient visit center treat dbp dbp1 cf cf1
run DATA a SET a BY patient IF
last.patient if treat"A" run proc sort
by center run proc means output
outmeandbp mean (dbp) dbp n (dbp) ndbp
by center run proc mixed data a class
center treat model dbp treat/ noint s
outpredpred random center/ s run data
pred1 set pred by center if
first.center run data both merge pred1
meandbp by center run proc sort by dbp
run proc print var dbp pred ndbp center
run
70Final Words
- Mixed Model Methodology provides a powerful,
flexible tool for estimating effects with
repeated measures data - Likelihood-based methodology allows for simple
model comparisons - Caveats The methods are suspect with
- Gross nonnormality
- Badly misspecified covariance structure
(including non-modelled heteroscedasticity) - Data missing not at random
- Nonlinearity
- Omitted variable bias
- Confounding