SAS 0412

18
SAS tutorial: ANOVA

description

proc anova

Transcript of SAS 0412

Page 1: SAS 0412

SAS tutorial: ANOVA

Page 2: SAS 0412

作業 (目前 )沒有但考試會考的東西

• Full model/reduced model comparison• Multiple comparison• Post hoc analysis (regression)

Page 3: SAS 0412

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

Page 4: SAS 0412

Example

Page 5: SAS 0412

DataY X1 X2 X3

Page 6: SAS 0412

SAS code

• proc anova data=cream;• class batch position starter;• model acidity=batch position starter;• means batch starter /scheffe;• run;

Page 7: SAS 0412

Result - Data

Page 8: SAS 0412

Result – Analysis of Variance

Page 9: SAS 0412

Result- Scheffe’s test (batch)

Page 10: SAS 0412

Result – Scheffe’s test (starter)

Page 11: SAS 0412

Example: Repeated measure

• 30 people• Interest in voting (5-point scale)• Measured in 10, 15, 20 years old

Page 12: SAS 0412

SAS codedata ex2;

do subject=1 to 30;

do age=1 to 3;

input interest @@;

output;

end;

end;

datalines;

1 1 3

1 1 3

...

proc anova data=ex2;

class age subject;

model interest=age subject age*subject;

test h=age e=age*subject;

run;

Page 13: SAS 0412

Result - Data

Page 14: SAS 0412

Result - ANOVA

Page 15: SAS 0412

Result

test h=age e=age*subject;

Page 16: SAS 0412

Another way

• proc anova data=ex2;• class age subject;• model interest=age subject;• run;

Page 17: SAS 0412

Result - ANOVA

Page 18: SAS 0412

Questions

• ANOVA跟 linear regression的差別• Mean squared error的期望值• Fixed effect/random effect