UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Textbook Examples
Design and Analysis, Third Edition by Geoffrey Keppel
Chapter 10: Factorial Experiments with Two Factors - Calculating the Major Effects

In chapter 10 Keppel shows how to perform a two-way factorial anova on page 217. We use the xi3 command as shown below to get the analysis for the two-way anova. The a*b term requests the main effects of a and b and interaction effect of a by b. You can download the xi3 command by typing findit xi3 (see How can I use the findit command to search for programs and get additional help? for more information about using findit).
use http://www.ats.ucla.edu/stat/stata/examples/da/chap10, clear
xi3:  regress errors g.a*g.b

g.a               _Ia_1-3             (naturally coded; _Ia_1 omitted)
g.b               _Ib_1-2             (naturally coded; _Ib_1 omitted)

      Source |       SS       df       MS              Number of obs =      24
-------------+------------------------------           F(  5,    18) =    3.05
       Model |         280     5          56           Prob > F      =  0.0361
    Residual |         330    18  18.3333333           R-squared     =  0.4590
-------------+------------------------------           Adj R-squared =  0.3087
       Total |         610    23  26.5217391           Root MSE      =  4.2817

------------------------------------------------------------------------------
      errors |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _Ia_2 |          4   2.140872     1.87   0.078    -.4978054    8.497805
       _Ia_3 |          5   2.140872     2.34   0.031     .5021946    9.497805
       _Ib_2 |          2   1.748015     1.14   0.268    -1.672443    5.672443
     _Ia2Xb2 |         -6   4.281744    -1.40   0.178    -14.99561    2.995611
     _Ia3Xb2 |        -12   4.281744    -2.80   0.012    -20.99561   -3.004389
       _cons |         10   .8740074    11.44   0.000     8.163779    11.83622
------------------------------------------------------------------------------
Below we use the test command to get the main effect of a, the main effect of b and the interaction of a by b.
test  _Ia_2 _Ia_3 

 ( 1)  _Ia_2 = 0.0
 ( 2)  _Ia_3 = 0.0

       F(  2,    18) =    3.05
            Prob > F =    0.0721

test  _Ib_2

 ( 1)  _Ib_2 = 0.0

       F(  1,    18) =    1.31
            Prob > F =    0.2675

test  _Ia2Xb2 _Ia3Xb2

 ( 1)  _Ia2Xb2 = 0
 ( 2)  _Ia3Xb2 = 0

       F(  2,    18) =    3.93
            Prob > F =    0.0384
On page 222, Keppel shows how to compute Omega Squared for the a*b effect. We do not know how to compute this via regression so we have not done that.

How to cite this page

Report an error on this page

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


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California