SAS tutorial: ANOVA
作業(目前)沒有但考試會考的東西
• Full model/reduced model comparison
• Multiple comparison
• Post hoc analysis (regression)
PROC ANOVA
• CLASS
  – Names the classification variables to be used in the model.
• MODEL
  – dependents=effects </ options>
• TEST
  – TEST <H= effects> E= effect
• MEANS
  – MEANS effects </ options>
  – Post hoc analysis for the effects specified.
• REPEATED; ABSORB; BY; FREQ; MANOVA
Example
Data
Y   X1          X2   X3
SAS code
•   proc anova data=cream;
•   class batch position starter;
•   model acidity=batch position starter;
•   means batch starter /scheffe;
•   run;
Result - Data
Result – Analysis of Variance
Result- Scheffe’s test (batch)
Result – Scheffe’s test (starter)
Example: Repeated measure
• 30 people
• Interest in voting (5-point scale)
• Measured in 10, 15, 20 years old
SAS code
data ex2;                   proc anova data=ex2;
do subject=1 to 30;         class age subject;
       do age=1 to 3;       model interest=age subject
       input interest @@;   age*subject;
       output;              test h=age e=age*subject;
       end;                 run;
end;
datalines;
1      1       3
1      1       3
...
Result - Data
Result - ANOVA
Result



test h=age e=age*subject;
Another way
•   proc anova data=ex2;
•   class age subject;
•   model interest=age subject;
•   run;
Result - ANOVA
Questions
• ANOVA跟linear regression的差別
• Mean squared error的期望值
• Fixed effect/random effect

SAS 0412