|
|
|
||||
|
|
|||||
These data are from a 2x4 factorial design but the same data can also be used for one-way ANOVA examples. The variable y is the dependent variable. The variable a is an independent variable with two levels while b is an independent variable with four levels.use http://www.ats.ucla.edu/stat/stata/faq/crf24
anova y b
Number of obs = 32 R-squared = 0.8259
Root MSE = 1.21008 Adj R-squared = 0.8072
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 194.50 3 64.8333333 44.28 0.0000
|
b | 194.50 3 64.8333333 44.28 0.0000
|
Residual | 41.00 28 1.46428571
-----------+----------------------------------------------------
Total | 235.50 31 7.59677419
table b, contents(mean y)
----------+-----------
b | mean(y)
----------+-----------
1 | 2.75
2 | 3.5
3 | 6.25
4 | 9
----------+-----------
It is quite clear that there is a significant overall F for the
independent variable b. Now, let's devise some contrasts that we can test:anovacontrast b, values(0 0 1 -1) Contrast variable b (0 0 1 -1) Dep Var = y source SS df MS N of obs = 32 ---------+--------------------------------- F = 20.66 contrast | 30.25 1 30.2500 Prob > F = 0.0001 error | 41 28 1.4643 ---------+--------------------------------- anovacontrast b, values(1 1 -1 -1) Contrast variable b (1 1 -1 -1) Dep Var = y source SS df MS N of obs = 32 ---------+--------------------------------- F = 110.63 contrast | 162 1 162.0000 Prob > F = 0.0000 error | 41 28 1.4643 ---------+--------------------------------- anovacontrast b, values(1 1 1 -3) Contrast variable b (1 1 1 -3) Dep Var = y source SS df MS N of obs = 32 ---------+--------------------------------- F = 95.72 contrast | 140.166667 1 140.1667 Prob > F = 0.0000 error | 41 28 1.4643 ---------+---------------------------------
anova y a b a*b
Number of obs = 32 R-squared = 0.9214
Root MSE = .877971 Adj R-squared = 0.8985
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 217.00 7 31.00 40.22 0.0000
|
a | 3.125 1 3.125 4.05 0.0554
b | 194.50 3 64.8333333 84.11 0.0000
a*b | 19.375 3 6.45833333 8.38 0.0006
|
Residual | 18.50 24 .770833333
-----------+----------------------------------------------------
Total | 235.50 31 7.59677419
anovacontrast b, values(0 0 1 -1)
Contrast variable b (0 0 1 -1) Dep Var = y
source SS df MS N of obs = 32
---------+--------------------------------- F = 39.24
contrast | 30.25 1 30.2500 Prob > F = 0.0000
error | 18.5 24 0.7708
---------+---------------------------------
anovacontrast b, values(1 1 -1 -1)
Contrast variable b (1 1 -1 -1) Dep Var = y
source SS df MS N of obs = 32
---------+--------------------------------- F = 210.16
contrast | 162 1 162.0000 Prob > F = 0.0000
error | 18.5 24 0.7708
---------+---------------------------------
anovacontrast b, values(1 1 1 -3)
Contrast variable b (1 1 1 -3) Dep Var = y
source SS df MS N of obs = 32
---------+--------------------------------- F = 181.84
contrast | 140.166667 1 140.1667 Prob > F = 0.0000
error | 18.5 24 0.7708
---------+---------------------------------
Note that the F-ratios in these contrasts are larger than the F-ratios in the one-way ANOVA example. This is
because the two-way ANOVA has a smaller mean square residual than the one-way ANOVA.
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services