|
|
|
||||
|
|
|||||
Table 7.2-1, page 260.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rb4, clear
tabdisp s a, cellvar(y)
----------+-----------------------
| a
s | 1 2 3 4
----------+-----------------------
1 | 3 4 4 3
2 | 2 4 4 5
3 | 2 3 3 6
4 | 3 3 3 5
5 | 1 2 4 7
6 | 3 3 6 6
7 | 4 4 5 10
8 | 6 5 5 8
----------+-----------------------
Table 7.2-2, page 261.
anova y a s
Number of obs = 32 R-squared = 0.7318
Root MSE = 1.18523 Adj R-squared = 0.6041
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 80.50 10 8.05 5.73 0.0004
|
a | 49.00 3 16.3333333 11.63 0.0001
s | 31.50 7 4.50 3.20 0.0180
|
Residual | 29.50 21 1.4047619
-----------+----------------------------------------------------
Total | 110.00 31 3.5483871
Table 7.3-2, page 271.
Note: The nonadd command can be downloaded by typing findit contrast (see How can I use the findit command to search for programs and get additional help? for more information about using findit).
nonadd y a s Tukey's test of nonadditivity for randomized block designs F (1,20) = 1.2795813 Pr > F: .27135918
Figure 7.3-1, page 272.
anova y a s, noanova /* rerun anova without redisplaying anova table */ predict yhat /* yhat is the fitted value */ predict e, rstandard /* e is the standardized residual */ graph twoway scatter e yhat, ylabel(-2.5(.5)2.5) xlabel(1(1)9)
Various computations on compound symmetry, pages 274-282.
anova y a s, repeated(a) /* anova with conservative p-values for repeated measures */
Number of obs = 32 R-squared = 0.7318
Root MSE = 1.18523 Adj R-squared = 0.6041
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 80.50 10 8.05 5.73 0.0004
|
a | 49.00 3 16.3333333 11.63 0.0001
s | 31.50 7 4.50 3.20 0.0180
|
Residual | 29.50 21 1.4047619
-----------+----------------------------------------------------
Total | 110.00 31 3.5483871
Between-subjects error term: s
Levels: 8 (7 df)
Lowest b.s.e. variable: s
Repeated variable: a
Huynh-Feldt epsilon = 0.8343
Greenhouse-Geisser epsilon = 0.6195
Box's conservative epsilon = 0.3333
------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
a | 3 11.63 0.0001 0.0003 0.0015 0.0113
Residual | 21
-----------+----------------------------------------------------
matrix list e(Srep) /* display variance-covariance matrix */
symmetric e(Srep)[4,4]
c1 c2 c3 c4
r1 2.2857143
r2 1.1428571 .85714286
r3 .71428571 .28571429 1.0714286
r4 1.2857143 .28571429 .92857143 4.5
Table 7.8-2, page 299.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rb3, clear
tabdisp s a, cellvar(y)
----------+-----------------
| a
s | 1 2 3
----------+-----------------
1 | 15 12 11
2 | 11 9
3 | 13 13
----------+-----------------
Table 7.8-3, page 301.
anova y a s
Number of obs = 7 R-squared = 0.8970
Root MSE = 1.06458 Adj R-squared = 0.6909
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 19.7333333 4 4.93333333 4.35 0.1954
|
a | 8.40 2 4.20 3.71 0.2125
s | 3.73333333 2 1.86666667 1.65 0.3778
|
Residual | 2.26666667 2 1.13333333
-----------+----------------------------------------------------
Total | 22.00 6 3.66666667
Tables 7.9-1, page 305.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/grb4, clear
tabdisp id a, by(g) cellvar(y)
----------+-----------------------
| a
g and id | 1 2 3 4
----------+-----------------------
1 |
1 | 3 4 4 3
2 | 3 3 3 5
----------+-----------------------
2 |
1 | 2 4 4 5
2 | 2 3 3 6
----------+-----------------------
3 |
1 | 6 5 5 8
2 | 3 3 6 6
----------+-----------------------
4 |
1 | 1 2 4 7
2 | 4 4 5 10
----------+-----------------------
table g a, cont(sum y)
----------+-----------------------
| a
g | 1 2 3 4
----------+-----------------------
1 | 6 7 7 8
2 | 4 7 7 11
3 | 9 8 11 14
4 | 5 6 9 17
----------+-----------------------
Table 7.9-2, page 306.
Note: To obtain the correct F-ratio of a, a*g is used as the error term.
anova y a g a*g
Number of obs = 32 R-squared = 0.7727
Root MSE = 1.25 Adj R-squared = 0.5597
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 85.00 15 5.66666667 3.63 0.0074
|
a | 49.00 3 16.3333333 10.45 0.0005
g | 16.75 3 5.58333333 3.57 0.0377
a*g | 19.25 9 2.13888889 1.37 0.2795
|
Residual | 25.00 16 1.5625
-----------+----------------------------------------------------
Total | 110.00 31 3.5483871
test a /a*g
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
a | 49.00 3 16.3333333 7.64 0.0076
a*g | 19.25 9 2.13888889
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