Use of Proc Mixed to Analyze Experimental Data . Animal Science 500 Lecture No. October , 2010. GLM and MIXED in SAS. The SAS procedures GLM and MIXED can be used to fit linear models. Commonly used to analyze data from a wide range of experiments
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Use of Proc Mixed to Analyze Experimental Data
Animal Science 500
Lecture No.
October , 2010
From D. A. Dickey, 2008: SAS Global Forum
y = Xβ + ZU + e
where y is a vector of responses X is a known design matrix for the fixed effects,
β is vector of unknown fixed-effect parameters,
Z is a known design matrix for the random effects,
U is vector of unknown random-effect parameters, and
e is a vector of (normally distributed) random errors.
PROC MIXED options;CLASS variable-list;MODEL dependent=fixed effects/ options;RANDOM random effects / options;REPEATED repeated effects / options;CONTRAST 'label' fixed-effect values | random-effect values/ options;ESTIMATE 'label' fixed-effect values | random-effect values/ options;LSMEANS fixed-effects / options;MAKE 'table' OUT= SAS-data-set < options >;RUN;
Proc mixed data=mydata method=remlcovtest;
PROC MIXED data=mydatacovtest; Class group gender agecat;
Quit;
Quit;Proc sort data=one; By group id t; Run;
QuitProc mixed data=one covtest; Class t group id; Model y=group time group*time; Repeated t /type=ar(1) subject=id; Run;
Quit;
σ 2
σ 2
σ 2
σ 2
σ 2
yijk= μ + τi+ Lj+ R (L)jk+ τLij+ eijk
where
yijk is the observation
μ is the overall mean
τi is the treatment effect
Lj is the random Location effect, ~ N(0,σL2 )
R (L)jkis the block within location, ~ N(0,σR2 )
τLijis the treatment by location effect, ~ N(0,σT2 ) and
eijkis the random error, ~ N(0,σ2)
The SAS code we’ll use to fit the data is the following.
Proc Mixed;
Class loc block trt;
Model resp = trt / ddfm=satterth;
Random loc block(loc) loc*trt;
Run;
Quit;
SAS/STAT(R) 9.2 User's Guide, Second Edition
SAS/STAT(R) 9.2 User's Guide, Second Edition
SAS/STAT(R) 9.2 User's Guide, Second Edition
SAS/STAT(R) 9.2 User's Guide, Second Edition
SAS/STAT(R) 9.2 User's Guide, Second Edition
The Mixed Procedure
Model Information
Data Set WORK.SP
Dependent Variable Y
Covariance Structure Variance Components
Estimation Method REML
Residual Variance Method Profile
Fixed Effects SE Method Model-Based
Degrees of Freedom Method Containment
SAS/STAT(R) 9.2 User's Guide, Second Edition
Class Level Information
Class Levels Values
A 3 1 2 3
B 2 1 2
Block 4 1 2 3 4
The "Class Level Information" table lists the levels of all variables specified in the CLASS statement. Check this table to make sure that the data are correct.
SAS/STAT(R) 9.2 User's Guide, Second Edition
Dimensions
Covariance Parameters 3
Columns in X 12
Columns in Z 16
Subjects 1
Max Obs Per Subject 24
The "Dimensions" table lists the magnitudes of various vectors and matrices.
SAS/STAT(R) 9.2 User's Guide, Second Edition
Number of Observations
Number of Observations Read 24
Number of Observations Used 24
Number of Observations Not Used 0
The "Number of Observations" table shows that all observations read from the data set are used in the analysis
SAS/STAT(R) 9.2 User's Guide, Second Edition
Iteration History
Iteration Evaluations -2 Res Log Like Criterion
0 1 139.81461222
1 1 119.76184570 0.00000000
PROC MIXED estimates the variance components for Block, A*Block, and the residual by REML. The REML estimates are the values that maximize the likelihood of a set of linearly independent error contrasts, and they provide a correction for the downward bias found in the usual maximum likelihood estimates. The objective function is times the logarithm of the restricted likelihood, and PROC MIXED minimizes this objective function to obtain the estimates.
The minimization method is the Newton-Raphson algorithm, which uses the first and second derivatives of the objective function to iteratively find its minimum. The "Iteration History" table records the steps of that optimization process. For this example, only one iteration is required to obtain the estimates. The Evaluations column reveals that the restricted likelihood is evaluated once for each of the iterations. A criterion of 0 indicates that the Newton-Raphson algorithm has converged.
SAS/STAT(R) 9.2 User's Guide, Second Edition
Covariance Parameter Estimates
CovParm Estimate
Block 62.3958
A*Block 15.3819
Residual 9.3611
The REML estimates for the variance components for the random effects Block, A*Block, and the residual are shown in the Estimate column of the "Covariance Parameter Estimates“.
SAS/STAT(R) 9.2 User's Guide, Second Edition
Fit Statistics
-2 Res Log Likelihood 119.8
AIC (smaller is better) 125.8
AICC (smaller is better) 127.5
BIC (smaller is better) 123.9
The "Fit Statistics“ lists several values about the fitted mixed model, including the residual log likelihood.
The Akaike (AIC) and Bayesian (BIC) information criteria can be used to compare different models; the ones with smaller values are preferred.
The AICC information criteria is a small-sample bias-adjusted form of the Akaike criterion (Hurvich and Tsai 1989).
SAS/STAT(R) 9.2 User's Guide, Second Edition
Type 3 Tests of Fixed Effects
Effect Num DF Den DF F Value Pr > F
A 2 6 4.07 0.076
B 19 19.39 0.0017
A*B 29 4.02 0.0566
The fixed effects are tested by using Type 3 estimable functions.
SAS/STAT(R) 9.2 User's Guide, Second Edition
The results from the PROC MIXED analysis are the same as those obtained from the following GLM analysis
PROC GLM data=sp;
class A B Block;
model Y = A B A*B Block A*Block;
test h=A e=A*Block;
Run;
Quit;
SAS/STAT(R) 9.2 User's Guide, Second Edition
SAS/STAT(R) 9.2 User's Guide, Second Edition