use https://stats.idre.ucla.edu/stat/stata/examples/kirk/cr4, clear
Table 5.2-1, page 167. The variable order was added to the file to preserve the original ordering of the data.
tabdisp order a, cellvar(y) ----------+----------------------- | a order | 1 2 3 4 ----------+----------------------- 1 | 4 4 5 3 2 | 6 5 6 5 3 | 3 4 5 6 4 | 3 3 4 5 5 | 1 2 3 6 6 | 3 3 4 7 7 | 2 4 3 8 8 | 2 3 4 10 ----------+----------------------- dotplot y, by(a) ylabel(1(1)10)
table a, contents(freq mean y sd y) ----------+----------------------------------- a | Freq. mean(y) sd(y) ----------+----------------------------------- 1 | 8 3 1.511858 2 | 8 3.5 .9258201 3 | 8 4.25 1.035098 4 | 8 6.25 2.12132 ----------+-----------------------------------
Figure 5.2-1(a), page 168.
egen mean = mean(y), by(a) generate e = y - mean dotplot e, by(a) ylabel(-3(1)4)
Table 5.3-2, page 172.
anova y a Number of obs = 32 R-squared = 0.4455 Root MSE = 1.476 Adj R-squared = 0.3860 Source | Partial SS df MS F Prob > F -----------+---------------------------------------------------- Model | 49.00 3 16.3333333 7.50 0.0008 | a | 49.00 3 16.3333333 7.50 0.0008 | Residual | 61.00 28 2.17857143 -----------+---------------------------------------------------- Total | 110.00 31 3.5483871
Three contrasts, page 173.
Note 1: The anovacontrast command can be downloaded by typing search anovacontrast (see How can I use the search command to search for programs and get additional help? for more information about using search).
anovacontrast a, value(1 -1 0 0) title(contrast 1) contrast 1 Contrast variable: a (1 -1 0 0) Dep Var: y source SS df MS Contrast = -0.50 ---------+--------------------------------- N of obs = 32 contrast | 1 1 1.0000 F = 0.46 error | 61 28 2.1786 Prob > F = 0.5036 ---------+--------------------------------- t = 0.68 anovacontrast a, value(0 0 1 -1) title(contrast 2) contrast 2 Contrast variable: a (0 0 1 -1) Dep Var: y source SS df MS Contrast = -2.00 ---------+--------------------------------- N of obs = 32 contrast | 16 1 16.0000 F = 7.34 error | 61 28 2.1786 Prob > F = 0.0114 ---------+--------------------------------- t = 2.71 anovacontrast a, value(1 1 -1 -1) title(contrast 3) contrast 3 Contrast variable: a (1 1 -1 -1) Dep Var: y source SS df MS Contrast = -4.00 ---------+--------------------------------- N of obs = 32 contrast | 32 1 32.0000 F = 14.69 error | 61 28 2.1786 Prob > F = 0.0007 ---------+--------------------------------- t = 3.83
Table 5.4-1, page 174.
Note: The fhcomp command can be downloaded by typing search fhcomp (see How can I use the search command to search for programs and get additional help? for more information about using search).
fhcomp a Fisher-Hayter pairwise comparisons for variable a studentized range critical value(.05, 3, 28) = 3.4994064 mean critical grp vs grp group means dif dif ------------------------------------------------------- 1 vs 2 3.0000 3.5000 0.5000 1.8261 1 vs 3 3.0000 4.2500 1.2500 1.8261 1 vs 4 3.0000 6.2500 3.2500* 1.8261 2 vs 3 3.5000 4.2500 0.7500 1.8261 2 vs 4 3.5000 6.2500 2.7500* 1.8261 3 vs 4 4.2500 6.2500 2.0000* 1.8261
Omega-squared on page 178 and effect size on page 181.
Note: The omega2 command can be downloaded by typing search omega2 (see How can I use the search command to search for programs and get additional help? for more information about using search).
omega2 omega squared = 0.3785 effect size = 0.7805
Parts of Table 5.7-4, page 196.
anovacontrast a, value(-3 -1 1 3) title(linear trend) linear trend Contrast variable: a (-3 -1 1 3) Dep Var: y source SS df MS Contrast = 10.50 ---------+--------------------------------- N of obs = 32 contrast | 44.1 1 44.1000 F = 20.24 error | 61 28 2.1786 Prob > F = 0.0001 ---------+--------------------------------- t = 4.50 anovacontrast a, value(1 -1 -1 1) title(quadratic trend) quadratic trend Contrast variable: a (1 -1 -1 1) Dep Var: y source SS df MS Contrast = 1.50 ---------+--------------------------------- N of obs = 32 contrast | 4.5 1 4.5000 F = 2.07 error | 61 28 2.1786 Prob > F = 0.1617 ---------+--------------------------------- t = 1.44 anovacontrast a, value(-1 3 -3 1) title(cubic trend) cubic trend Contrast variable: a (-1 3 -3 1) Dep Var: y source SS df MS Contrast = 1.00 ---------+--------------------------------- N of obs = 32 contrast | .4 1 0.4000 F = 0.18 error | 61 28 2.1786 Prob > F = 0.6716 ---------+--------------------------------- t = 0.43
Figure 5.7-3, page 199.
predict p1 /* compute observed means */ graph twoway (scatter p1 a, connect(l)) (lfit p1 a), ylabel(2(1)7)