[Stata Program] use http://www.gseis.ucla.edu/courses/data/dummy generate dum1 = (group==1) generate dum2 = (group==2) list group dum1 dum2 regress y dum1 dum2 anova y group generate eff1 = (group==1) generate eff2 = (group==2) replace eff1=-1 if (group==3) replace eff2=-1 if (group==3) list group eff1 eff2 regress y eff1 eff2 [Stata Program] use http://www.gseis.ucla.edu/courses/data/dummy generate dum1 = (group==1) generate dum2 = (group==2) list group dum1 dum2 group dum1 dum2 1. 1 1 0 2. 1 1 0 3. 1 1 0 4. 1 1 0 5. 1 1 0 6. 2 0 1 7. 2 0 1 8. 2 0 1 9. 2 0 1 10. 2 0 1 11. 3 0 0 12. 3 0 0 13. 3 0 0 14. 3 0 0 15. 3 0 0 regress y dum1 dum2 Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 2, 12) = 18.00 Model | 90.00 2 45.00 Prob > F = 0.0002 Residual | 30.00 12 2.50 R-squared = 0.7500 -------------+------------------------------ Adj R-squared = 0.7083 Total | 120.00 14 8.57142857 Root MSE = 1.5811 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dum1 | 3 1 3.00 0.011 .8211872 5.178813 dum2 | 6 1 6.00 0.000 3.821187 8.178813 _cons | 3 .7071068 4.24 0.001 1.459347 4.540653 ------------------------------------------------------------------------------ anova y group Number of obs = 15 R-squared = 0.7500 Root MSE = 1.58114 Adj R-squared = 0.7083 Source | Partial SS df MS F Prob > F -----------+---------------------------------------------------- Model | 90.00 2 45.00 18.00 0.0002 | group | 90.00 2 45.00 18.00 0.0002 | Residual | 30.00 12 2.50 -----------+---------------------------------------------------- Total | 120.00 14 8.57142857 generate eff1 = (group==1) generate eff2 = (group==2) replace eff1=-1 if (group==3) replace eff2=-1 if (group==3) list group eff1 eff2 group eff1 eff2 1. 1 1 0 2. 1 1 0 3. 1 1 0 4. 1 1 0 5. 1 1 0 6. 2 0 1 7. 2 0 1 8. 2 0 1 9. 2 0 1 10. 2 0 1 11. 3 -1 -1 12. 3 -1 -1 13. 3 -1 -1 14. 3 -1 -1 15. 3 -1 -1 regress y eff1 eff2 Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 2, 12) = 18.00 Model | 90.00 2 45.00 Prob > F = 0.0002 Residual | 30.00 12 2.50 R-squared = 0.7500 -------------+------------------------------ Adj R-squared = 0.7083 Total | 120.00 14 8.57142857 Root MSE = 1.5811 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eff1 | 0 .5773503 0.00 1.000 -1.257938 1.257938 eff2 | 3 .5773503 5.20 0.000 1.742062 4.257938 _cons | 6 .4082483 14.70 0.000 5.110503 6.889497 ------------------------------------------------------------------------------