|
|
|
||||
|
|
|||||
Page 120 shows how to compare treatment means following a one way anova. First, let's run the basic anova.
use http://www.ats.ucla.edu/stat/stata/examples/da/chap2, clear
anova score a
Number of obs = 15 R-squared = 0.5526
Root MSE = 3.76386 Adj R-squared = 0.4781
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 210.00 2 105.00 7.41 0.0080
|
a | 210.00 2 105.00 7.41 0.0080
|
Residual | 170.00 12 14.1666667
-----------+----------------------------------------------------
Total | 380.00 14 27.1428571
Page 120 shows a comparison of group 1 versus 2 and 3, and a second comparison of group 2 versus 3. Let's create a variable acomp1 that contains the comparison coefficients represented by the first comparison, and acomp2 that contains the coefficients for the second comparison.
generate acomp1=a recode acomp1 1=1 2=-.5 3=-.5 generate acomp2=a recode acomp2 1=0 2=1 3=-1
Let's enter the variables acomp1 and acomp2 in the anova as continuous variables. The test for comparison 1 is shown for acomp1 and the test for comparison 2 are shown for acomp2.
anova score acomp1 acomp2, continuous(acomp1 acomp2)
Number of obs = 15 R-squared = 0.5526
Root MSE = 3.76386 Adj R-squared = 0.4781
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 210.00 2 105.00 7.41 0.0080
|
acomp1 | 187.50 1 187.50 13.24 0.0034
acomp2 | 22.50 1 22.50 1.59 0.2315
|
Residual | 170.00 12 14.1666667
-----------+----------------------------------------------------
Total | 380.00 14 27.1428571
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