930 likes | 1.29k Views
Mixed Models. Simon Sheather Michael Speed TAMU. Part 1. Choosing the Mean Structure Fixed Effects. Learning Outcomes – Part 1. The participant will learn: How to determine what is being tested by the Type I, II , III sums of squares How to use the Estimable Functions in SAS
E N D
Mixed Models Simon Sheather Michael Speed TAMU
Part 1 Choosing the Mean Structure Fixed Effects
Learning Outcomes – Part 1 • The participant will learn: • How to determine what is being tested by the Type I, II , III sums of squares • How to use the Estimable Functions in SAS • Which non-estimable functions are used in SAS and their implications • Why testing for “Main” Effects in the presence of interaction may be useful • How missing data will affect what is being tested • Why “gain” scores may cause a problem • What is being tested in ANCOVA
Who Uses? • Proc GLM • Proc Mixed • Enterprise Guide
Linear Model where Y denotes the vector of observed yi's, X is the known matrix of xij's, beta is the unknown fixed-effects parameter vector, and the error is the unobserved vector of independent and identically distributed Gaussian random errors.
Mixed Model Formulation of the Mixed Model The previous general linear model is certainly a useful one (Searle 1971), and it is the one fitted by the GLM procedure. However, many times the distributional assumption about is too restrictive. The mixed model extends the general linear model by allowing a more flexible specification of the covariance matrix of . In other words, it allows for both correlation and heterogeneous variances, although you still assume normality. The mixed model is written as where everything is the same as in the general linear model except for the addition of the known design matrix, Z, and the vector of unknown random-effects parameters, . The matrix Z can contain either continuous or dummy variables, just like X. The name mixed model comes from the fact that the model contains both fixed-effects parameters, , and random-effects parameters, . Refer to Henderson (1990) and Searle, Casella, and McCulloch (1992) for historical developments of the mixed model.
Random and Error Terms • A key assumption in the foregoing analysis is that and are normally distributed with
V Matrix The variance of Y is, therefore, V = ZGZ' + R. You can model V by setting up the random-effects design matrix Z and by specifying covariance structures for G and R
More And Many More
Endpoints • Continuous Endpoints :Y is continuous • Discrete or Categorical Endpoints • We will consider only continuous endpoints
Fixed Effects • Let us examine the Fixed Effects in the simple case of no random effects and the errors are normal i.i.d. • Continuous Endpoints • Discussion of “Analysis of Clinical Trials Using SAS” Dmitrienko et al
Example • The example is a clinical trial comparing an experimental drug (D) with a placebo (P) in patients with a major depressive disorder. • The primary efficacy measure was the change from baseline to the end of the 9-week acute treatment phase in the 17-item Hamilton depression rating scale (HAMID17). • Patient randomization was stratified by center (5 centers).
Hypothesis Testing – TYPE III • Main Effect Drug • Main Effect Center • No Interaction
SAS Code – Mixed & GLM PROC MIXED DATA = WORK.SORTTempTableSorted METHOD=REML; CLASS drug center ; MODEL change= drug center drug*center /HTYPE=3; RUN; PROC GLM DATA=WORK.SORTTempTableSorted ; CLASS drug center; MODEL change= center drug drug*center / INTERCEPT SS1 SS2 SS3 SS4 SOLUTION E1 E2 E3 E4 ZETA=1E-08 SINGULAR=1E-07 ; RUN;
Output – GLM & Mixed GLM Mixed
Point #1 • GLM & Mixed give same results for fixed effects with errors i.i.d. normal with mean 0 and constant variance
Confusion on Type I, II, III & IV Sums of Squares • Hypotheses Testing is about Population Parameters • Hypotheses Testing is about Population Parameters
Jargon • I am testing “R(a|u), which represents the additional reduction due to fitting the treatment effect after fitting the mean and helps assess the amount of variability explained by the treatment accounting for the mean.” • Wonderful, now tell me what hypotheses you are testing in terms of the population parameters. • What is Ho??
Other Jargon • I am “doing an unadjusted analysis.” • I am “doing an adjusted analysis.” • “I am testing hypotheses about the population parameters and here they are.”
Change the Order What is being tested by “center” “drug” “drug*center” in terms of the population parameters?
Point #2 • Different hypotheses are being tested by Type I, II and III sums of squares when the population sample are unequal.
Estimable Functions Can Help PROC GLM DATA=WORK.SORTTempTableSorted ; CLASS drug center; MODEL change= center drug drug*center / INTERCEPT SS1 SS2 SS3 SS4 SOLUTION E1 E2 E3 E4 ZETA=1E-08 SINGULAR=1E-07 ;
E3 – Type III Alias 1 4 1 4
We Only Need drug*center Interaction Center Int Drug Intercept is testing: Why ? Let L1 =1
We Only Need drug*center Center Center is testing: Why ? Let L2 = 1;L3=L4 = L5=0 Let L3 = 1; L2=L4=L5=0 Let L4 =1; L2=L3=L5 = 0 Let L5 = 1; L2=L3= L4=0
We Only Need drug*center Drug Drug is testing: Why ? Let L7 =1
We Only Need drug*center Interaction Drug*center is testing: Why ? Let L9=1; L10=L11=L12=0 Let L10 = 1 ; L9 = L11 = L12 = 0 Let L11 = 0 ; L9 = L10 = L12 = 0 Let L12 =0; L9 = L10 = L11 =0
Proc Mixed – Estimable FunctionsType 3 – NO L’s Interaction Center Drug
Coefficients – Function of Sample Size Recall: The subjects were assigned to the Centers at random.
Point #3 • The hypotheses being tested by the Type I and II sums of squares are a function of the number of time a population is sampled. • In general, not a good idea to use Type I or III. • Type III is useful if all populations are sampled at least once.
Testing “Main” Effects in thePresence of Interaction • May we (can we) test for “main” effects in the presence of interaction? i.e. We reject the hypothesis of no interaction. • Sure – it is a valid test. • Should we do the test? Well, it depends.
Need Input from Researcher • Does makes sense? • Is there a difference between the new drug and the placebo when you averaged over the centers?
Point #4 • Testing “Main” Effects in the presence of interaction may be correct if the test makes sense to the researcher. • “Main Effect for Drug” is not unique. The hypothesis depends on the type of sum of squares used.
Effect of Missing Populations Suppose we did not sample the 2,3 population. What effect does this have on hypotheses testing?
Type 3 Center No Missing Missing
Point #5 • Even Type III (3) sums of squares gives rather strange hypotheses when there are some populations with no samples.