### Stata Textbook Examples Experimental Design by Roger Kirk Chapter 10: Completely Randomized Factorial Design with Three or More Treatments

Table 10.2-1, page 440.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/crf222, clear

tabdisp order c b, cellvar(y) by(a)

----------+-------------------------
|         b and c
a and     | ---- 1 ---    ---- 2 ---
order     |    1     2       1     2
----------+-------------------------
1         |
1 |    3     4       7     7
2 |    6     5       8     8
3 |    3     4       7     9
4 |    3     3       6     8
----------+-------------------------
2         |
1 |    1     2       5    10
2 |    2     3       6    10
3 |    2     4       5     9
4 |    2     3       6    11
----------+-------------------------

table a b, cont(sum y) row col

----------+--------------------
|          b
a |     1      2  Total
----------+--------------------
1 |    31     60     91
2 |    19     62     81
|
Total |    50    122    172
----------+--------------------

table a c, cont(sum y) row

----------+-----------
|     c
a |    1     2
----------+-----------
1 |   43    48
2 |   29    52
|
Total |   72   100
----------+-----------

table b c, cont(sum y)

----------+-----------
|     c
b |    1     2
----------+-----------
1 |   22    28
2 |   50    72
----------+-----------

table a c b, cont(sum y)

----------+-------------------------
|         b and c
| ---- 1 ---    ---- 2 ---
a |    1     2       1     2
----------+-------------------------
1 |   15    16      28    32
2 |    7    12      22    40
----------+-------------------------
Table 10.2-2, page 442.
anova y a b c a*b a*c b*c a*b*c

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 |      162.00     1      162.00     210.16     0.0000
c |       24.50     1       24.50      31.78     0.0000
a*b |       6.125     1       6.125       7.95     0.0095
a*c |      10.125     1      10.125      13.14     0.0014
b*c |        8.00     1        8.00      10.38     0.0036
a*b*c |       3.125     1       3.125       4.05     0.0554
|
Residual |       18.50    24  .770833333
-----------+----------------------------------------------------
Total |      235.50    31  7.59677419 
Table 10.6-1, page 457.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbf33, clear

tabdisp s b a, cellvar(y)

----------+---------------------------------------------------------
|                         a and b
| ------- 1 ------    ------- 2 ------    ------- 3 ------
s |    1     2     3       1     2     3       1     2     3
----------+---------------------------------------------------------
1 |   37    43    48      39    35    46      31    41    64
2 |   42    44    47      30    40    36      21    50    52
3 |   33    36    29      34    31    45      20    39    53
4 |   29    27    38      26    22    27      18    36    42
5 |   24    25    28      21    27    26      10    34    49
----------+---------------------------------------------------------

table a b, cont(sum y) row col

----------+---------------------------
|             b
a |     1      2      3  Total
----------+---------------------------
1 |   165    175    190    530
2 |   150    155    180    485
3 |   100    200    260    560
|
Total |   415    530    630   1575
----------+---------------------------
Table 10.6-2, page 503.
anova y s a b a*b

Number of obs =      45     R-squared     =  0.8784
Root MSE      = 4.45424     Adj R-squared =  0.8328

Source |  Partial SS    df       MS           F     Prob > F
-----------+----------------------------------------------------
Model |  4585.11111    12  382.092593      19.26     0.0000
|
s |  1615.11111     4  403.777778      20.35     0.0000
a |      190.00     2       95.00       4.79     0.0152
b |  1543.33333     2  771.666667      38.89     0.0000
a*b |  1236.66667     4  309.166667      15.58     0.0000
|
Residual |  634.888889    32  19.8402778
-----------+----------------------------------------------------
Total |     5220.00    44  118.636364

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.