|
|
|
||||
|
|
|||||
Use data file rbcf2-2, page 596.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbcf2-2, clear
list
a b g s y
1. 0 0 0 0 3
2. 0 0 0 1 5
3. 0 0 0 2 6
4. 0 0 0 3 5
5. 1 1 0 0 16
6. 1 1 0 1 14
7. 1 1 0 2 17
8. 1 1 0 3 15
9. 0 1 1 4 14
10. 0 1 1 5 14
11. 0 1 1 6 16
12. 0 1 1 7 16
13. 1 0 1 4 7
14. 1 0 1 5 6
15. 1 0 1 6 7
16. 1 0 1 7 11
Table 13.3-1, page 596.
tabdisp s a b, cellvar(y) by(g) concise
----------+-------------------------
| b and a
| ---- 0 --- ---- 1 ---
g and s | 0 1 0 1
----------+-------------------------
0 |
0 | 3 16
1 | 5 14
2 | 6 17
3 | 5 15
----------+-------------------------
1 |
4 | 7 14
5 | 6 14
6 | 7 16
7 | 11 16
----------+-------------------------
table a b, cont(sum y) row col
----------+--------------------
| b
a | 0 1 Total
----------+--------------------
0 | 19 60 79
1 | 31 62 93
|
Total | 50 122 172
----------+--------------------
Table 13.3-2, page 598.
anova y g / s|g a b / a*b*s|g
Number of obs = 16 R-squared = 1.0000
Root MSE = 0.00 Adj R-squared =
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 371.00 15 24.7333333
|
g | 6.25 1 6.25 1.90 0.2174
s|g | 19.75 6 3.29166667
-----------+----------------------------------------------------
a | 12.25 1 12.25 8.40 0.0274
b | 324.00 1 324.00 222.17 0.0000
a*b*s|g | 8.75 6 1.45833333
-----------+----------------------------------------------------
|
Residual | 0.00 0
-----------+----------------------------------------------------
Total | 371.00 15 24.7333333
Use data file rbcr2-3, page 604.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbcf2-3, clear
list
a b c g s y
1. 0 0 0 0 0 3
2. 0 0 0 0 1 6
3. 0 0 0 0 2 3
4. 0 0 0 0 3 3
5. 0 1 1 0 0 7
6. 0 1 1 0 1 8
7. 0 1 1 0 2 9
8. 0 1 1 0 3 8
9. 1 0 1 0 0 2
10. 1 0 1 0 1 3
11. 1 0 1 0 2 4
12. 1 0 1 0 3 3
13. 1 1 0 0 0 5
14. 1 1 0 0 1 6
15. 1 1 0 0 2 5
16. 1 1 0 0 3 6
17. 0 0 1 1 4 4
18. 0 0 1 1 5 5
19. 0 0 1 1 6 4
20. 0 0 1 1 7 3
21. 0 1 0 1 4 7
22. 0 1 0 1 5 8
23. 0 1 0 1 6 7
24. 0 1 0 1 7 6
25. 1 0 0 1 4 1
26. 1 0 0 1 5 2
27. 1 0 0 1 6 2
28. 1 0 0 1 7 2
29. 1 1 1 1 4 10
30. 1 1 1 1 5 10
31. 1 1 1 1 6 9
32. 1 1 1 1 7 11
Table 13.5-1, page 604.
tabdisp s a b if g==0, cellvar(y) by(c)
----------+-------------------------
| b and a
| ---- 0 --- ---- 1 ---
c and s | 0 1 0 1
----------+-------------------------
0 |
0 | 3 5
1 | 6 6
2 | 3 5
3 | 3 6
----------+-------------------------
1 |
0 | 2 7
1 | 3 8
2 | 4 9
3 | 3 8
----------+-------------------------
tabdisp s a b if g==1, cellvar(y) by(c)
----------+-------------------------
| b and a
| ---- 0 --- ---- 1 ---
c and s | 0 1 0 1
----------+-------------------------
0 |
4 | 1 7
5 | 2 8
6 | 2 7
7 | 2 6
----------+-------------------------
1 |
4 | 4 10
5 | 5 10
6 | 4 9
7 | 3 11
----------+-------------------------
table a b, cont(sum y) row col
----------+--------------------
| b
a | 0 1 Total
----------+--------------------
0 | 31 60 91
1 | 19 62 81
|
Total | 50 122 172
----------+--------------------
table a c, cont(sum y) row
----------+-----------
| c
a | 0 1
----------+-----------
0 | 43 48
1 | 29 52
|
Total | 72 100
----------+-----------
table b c, cont(sum y)
----------+-----------
| c
b | 0 1
----------+-----------
0 | 22 28
1 | 50 72
----------+-----------
table a c b, cont(sum y)
----------+-------------------------
| b and c
| ---- 0 --- ---- 1 ---
a | 0 1 0 1
----------+-------------------------
0 | 15 16 28 32
1 | 7 12 22 40
----------+-------------------------
Table 13.5-2, page 607.
anova y g / s|g a b c a*b a*c b*c / a*b*c*s|g
Number of obs = 32 R-squared = 1.0000
Root MSE = 0.00 Adj R-squared =
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 235.50 31 7.59677419
|
g | 3.125 1 3.125 2.94 0.1372
s|g | 6.375 6 1.0625
-----------+----------------------------------------------------
a | 3.125 1 3.125 4.64 0.0451
b | 162.00 1 162.00 240.49 0.0000
c | 24.50 1 24.50 36.37 0.0000
a*b | 6.125 1 6.125 9.09 0.0074
a*c | 10.125 1 10.125 15.03 0.0011
b*c | 8.00 1 8.00 11.88 0.0029
a*b*c*s|g | 12.125 18 .673611111
-----------+----------------------------------------------------
|
Residual | 0.00 0
-----------+----------------------------------------------------
Total | 235.50 31 7.59677419
Use data file rbpf2-3, page 609.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbpf2-3, clear
list
a b c g s y
1. 0 0 0 0 0 3
2. 0 0 1 0 0 4
3. 1 1 0 0 0 5
4. 1 1 1 0 0 10
5. 0 1 0 0 1 7
6. 0 1 1 0 1 7
7. 1 0 0 0 1 1
8. 1 0 1 0 1 2
9. 0 0 0 1 2 6
10. 0 1 0 1 2 8
11. 1 0 1 1 2 3
12. 1 1 1 1 2 10
13. 0 0 1 1 3 5
14. 0 1 1 1 3 8
15. 1 0 0 1 3 2
16. 1 1 0 1 3 6
17. 0 0 0 2 4 3
18. 0 1 1 2 4 9
19. 1 0 0 2 4 2
20. 1 1 1 2 4 9
21. 0 0 1 2 5 4
22. 0 1 0 2 5 7
23. 1 0 1 2 5 4
24. 1 1 0 2 5 5
25. 0 0 0 3 6 3
26. 0 1 1 3 6 8
27. 1 0 1 3 6 3
28. 1 1 0 3 6 6
29. 0 0 1 3 7 3
30. 0 1 0 3 7 6
31. 1 0 0 3 7 2
32. 1 1 1 3 7 11
Parts of Table 13.7-1, page 609.
table a b, cont(sum y) row col
----------+--------------------
| b
a | 0 1 Total
----------+--------------------
0 | 31 60 91
1 | 19 62 81
|
Total | 50 122 172
----------+--------------------
table a c, cont(sum y) row
----------+-----------
| c
a | 0 1
----------+-----------
0 | 43 48
1 | 29 52
|
Total | 72 100
----------+-----------
Table 13.7-2, page 614.
Note: Ignore F-ratios for g and s|g.
anova y g s|g a b c a*b a*c b*c a*b*c
Number of obs = 32 R-squared = 0.9478
Root MSE = .850317 Adj R-squared = 0.9048
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 223.208333 14 15.9434524 22.05 0.0000
|
g | 5.25 3 1.75 2.42 0.1016
s|g | .958333333 4 .239583333 0.33 0.8530
a | 3.125 1 3.125 4.32 0.0531
b | 162.00 1 162.00 224.05 0.0000
c | 24.50 1 24.50 33.88 0.0000
a*b | 3.375 1 3.375 4.67 0.0453
a*c | 6.00 1 6.00 8.30 0.0104
b*c | 7.04166667 1 7.04166667 9.74 0.0062
a*b*c | 2.66666667 1 2.66666667 3.69 0.0717
|
Residual | 12.2916667 17 .723039216
-----------+----------------------------------------------------
Total | 235.50 31 7.59677419
Use data file rbcf3-2, page 618.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbcf3-2, clear
list
a b g s y
1. 0 0 0 0 3
2. 1 2 0 0 7
3. 2 1 0 0 4
4. 0 0 0 1 2
5. 1 2 0 1 6
6. 2 1 0 1 3
7. 0 1 1 2 4
8. 1 0 1 2 3
9. 2 2 1 2 6
10. 0 1 1 3 2
11. 1 0 1 3 1
12. 2 2 1 3 5
13. 0 2 2 4 7
14. 1 1 2 4 3
15. 2 0 2 4 3
16. 0 2 2 5 5
17. 1 1 2 5 4
18. 2 0 2 5 2
Table 13.8-1, page 618.
tabdisp s a b, cellvar(y) by(g) concise
----------+---------------------------------------------------------
| b and a
| ------- 0 ------ ------- 1 ------ ------- 2 ------
g and s | 0 1 2 0 1 2 0 1 2
----------+---------------------------------------------------------
0 |
0 | 3 4 7
1 | 2 3 6
----------+---------------------------------------------------------
1 |
2 | 3 4 6
3 | 1 2 5
----------+---------------------------------------------------------
2 |
4 | 3 3 7
5 | 2 4 5
----------+---------------------------------------------------------
table a b, cont(sum y) row col
----------+---------------------------
| b
a | 0 1 2 Total
----------+---------------------------
0 | 5 6 12 23
1 | 4 7 13 24
2 | 5 7 11 23
|
Total | 14 20 36 70
----------+---------------------------
Table 13.8-2, page 620.
anova y g / s|g a b a*b
Number of obs = 18 R-squared = 0.9504
Root MSE = .666667 Adj R-squared = 0.8595
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 51.1111111 11 4.64646465 10.45 0.0046
|
g | 1.16666667 2 .583333333 0.28 0.7760
s|g | 6.33333333 3 2.11111111
-----------+----------------------------------------------------
a | .111111111 2 .055555556 0.13 0.8847
b | 43.1111111 2 21.5555556 48.50 0.0002
a*b | .111111111 2 .055555556 0.13 0.8847
|
Residual | 2.66666667 6 .444444444
-----------+----------------------------------------------------
Total | 53.7777778 17 3.16339869
Use data file rbpf3-2, page 621.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbpf3-2, clear
list
a b g ab s y
1. 0 0 0 0 0 3
2. 1 2 0 0 0 7
3. 2 1 0 0 0 4
4. 0 1 0 1 1 4
5. 1 0 0 1 1 3
6. 2 2 0 1 1 6
7. 0 2 0 2 2 7
8. 1 1 0 2 2 3
9. 2 0 0 2 2 3
10. 0 0 1 0 3 2
11. 1 1 1 0 3 4
12. 2 2 1 0 3 5
13. 0 2 1 1 4 5
14. 1 0 1 1 4 1
15. 2 1 1 1 4 3
16. 0 1 1 2 5 2
17. 1 2 1 2 5 6
18. 2 0 1 2 5 2
Table 13.8-3, page 621.
table a b, cont(sum y) row col
----------+---------------------------
| b
a | 0 1 2 Total
----------+---------------------------
0 | 5 6 12 23
1 | 4 7 13 24
2 | 5 7 11 23
|
Total | 14 20 36 70
----------+---------------------------
table a g, cont(sum y)
----------+-----------
| g
a | 0 1
----------+-----------
0 | 14 9
1 | 13 11
2 | 13 10
----------+-----------
Table 13.8-4, page 624.
Note: Ignore F-ratios for g and s|ab.
anova y g s|ab a b a*b
Number of obs = 18 R-squared = 0.9773
Root MSE = .552771 Adj R-squared = 0.9034
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 52.5555556 13 4.04273504 13.23 0.0116
|
g | .711111111 1 .711111111 2.33 0.2018
s|ab | 2.22222222 4 .555555556 1.82 0.2884
a | .111111111 2 .055555556 0.18 0.8403
b | 43.1111111 2 21.5555556 70.55 0.0008
a*b | 2.88888889 4 .722222222 2.36 0.2126
|
Residual | 1.22222222 4 .305555556
-----------+----------------------------------------------------
Total | 53.7777778 17 3.16339869
Use data file rbpf32-2, page 643.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/rbpf32-2, clear
list
a b c g s y
1. 0 0 0 0 0 3
2. 0 1 1 0 0 7
3. 1 0 1 0 0 4
4. 1 1 0 0 0 7
5. 2 0 1 0 0 3
6. 2 1 0 0 0 6
7. 0 0 1 0 1 4
8. 0 1 0 0 1 7
9. 1 0 0 0 1 3
10. 1 1 1 0 1 9
11. 2 0 0 0 1 3
12. 2 1 1 0 1 8
13. 0 0 1 1 2 2
14. 0 1 0 1 2 5
15. 1 0 0 1 2 2
16. 1 1 1 1 2 10
17. 2 0 1 1 2 3
18. 2 1 0 1 2 6
19. 0 0 0 1 3 1
20. 0 1 1 1 3 10
21. 1 0 1 1 3 3
22. 1 1 0 1 3 6
23. 2 0 0 1 3 2
24. 2 1 1 1 3 11
25. 0 0 1 2 4 3
26. 0 1 0 2 4 6
27. 1 0 1 2 4 4
28. 1 1 0 2 4 7
29. 2 0 0 2 4 2
30. 2 1 1 2 4 9
31. 0 0 0 2 5 2
32. 0 1 1 2 5 8
33. 1 0 0 2 5 3
34. 1 1 1 2 5 8
35. 2 0 1 2 5 3
36. 2 1 0 2 5 7
Parts of Table 13.11-2, page 643.
table a b, cont(sum y) row col
----------+--------------------
| b
a | 0 1 Total
----------+--------------------
0 | 15 43 58
1 | 19 47 66
2 | 16 47 63
|
Total | 50 137 187
----------+--------------------
table a c, cont(sum y) row
----------+-----------
| c
a | 0 1
----------+-----------
0 | 24 34
1 | 28 38
2 | 26 37
|
Total | 78 109
----------+-----------
Table 13.11-3, page 647.
Note: Ignore F-ratios for g and s|g.
anova y g s|g a b c a*b a*c b*c a*b*c
Number of obs = 36 R-squared = 0.9287
Root MSE = 1.00204 Adj R-squared = 0.8687
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 248.561111 16 15.5350694 15.47 0.0000
|
g | .388888889 2 .194444444 0.19 0.8256
s|g | 1.20 3 .40 0.40 0.7557
a | 2.72222222 2 1.36111111 1.36 0.2816
b | 210.25 1 210.25 209.39 0.0000
c | 26.6944444 1 26.6944444 26.59 0.0001
a*b | .50 2 .25 0.25 0.7821
a*c | .055555556 2 .027777778 0.03 0.9728
b*c | 4.50 1 4.50 4.48 0.0477
a*b*c | .033333333 2 .016666667 0.02 0.9836
|
Residual | 19.0777778 19 1.00409357
-----------+----------------------------------------------------
Total | 267.638889 35 7.6468254
Use data file lscf3-2, page 653.
use http://www.ats.ucla.edu/stat/stata/examples/kirk/lscf3-2, clear
list
a b g s y
1. 0 0 0 0 3
2. 1 1 0 0 3
3. 2 2 0 0 6
4. 0 0 0 1 2
5. 1 1 0 1 4
6. 2 2 0 1 5
7. 1 0 1 2 3
8. 2 1 1 2 4
9. 0 2 1 2 7
10. 1 0 1 3 1
11. 2 1 1 3 3
12. 0 2 1 3 5
13. 2 0 2 4 3
14. 0 1 2 4 4
15. 1 2 2 4 7
16. 2 0 2 5 2
17. 0 1 2 5 2
18. 1 2 2 5 6
Table 13.12-1, page 653.
tabdisp s b, cellvar(y) by(g) concise
----------+-----------------
| b
g and s | 0 1 2
----------+-----------------
0 |
0 | 3 3 6
1 | 2 4 5
----------+-----------------
1 |
2 | 3 4 7
3 | 1 3 5
----------+-----------------
2 |
4 | 3 4 7
5 | 2 2 6
----------+-----------------
table a b, cont(sum y) row col
----------+---------------------------
| b
a | 0 1 2 Total
----------+---------------------------
0 | 5 6 12 23
1 | 4 7 13 24
2 | 5 7 11 23
|
Total | 14 20 36 70
----------+---------------------------
Table 13.12-2, page 655.
anova y g / s|g a b a*b
Number of obs = 18 R-squared = 0.9628
Root MSE = .57735 Adj R-squared = 0.8946
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 51.7777778 11 4.70707071 14.12 0.0020
|
g | 1.16666667 2 .583333333 0.25 0.7936
s|g | 7.00 3 2.33333333
-----------+----------------------------------------------------
a | .111111111 2 .055555556 0.17 0.8503
b | 43.1111111 2 21.5555556 64.67 0.0001
a*b | 1.44444444 2 .722222222 2.17 0.1958
|
Residual | 2.00 6 .333333333
-----------+----------------------------------------------------
Total | 53.7777778 17 3.16339869
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