-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanova.sas
50 lines (34 loc) · 1.04 KB
/
anova.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
data diets; input diet$ weightloss;
cards;
1 8
1 16
1 9
2 9
2 16
2 21
2 11
2 18
3 15
3 10
3 17
3 6
;
run;
/* To run an ANOVA, we will use proc glm. It is very similiar to proc reg and can
be used to run regression, ANOVA, or ANCOVA. ANOVA has categorical predictors. Regression has
continuos predictors. ANCOVA has both.
The code is the same as for proc reg, but now we use a class command and list any categorical predictor
variables after it. Here, we have three types of diets, which are categories. Thus diet is a categorical variable.
*/
proc glm data=diets;
class diet;
model weightloss=diet;
run;
/*
The between sums of sqaures is the diet sums of squares.
The model sums of squares tests the global null hypothesis that none of the predictor vaiables
have an effect on the response.
Note here, the model sum of squares and the diet sum of sqaures are the same. This is because diet is
the only variable in the model.
The within sums of squares is the error sums of squares.
*/