Data from Chapter 2 from Table 2.2, page 22
clear input a score 1 16 1 18 1 10 1 12 1 19 2 4 2 7 2 8 2 10 2 1 3 2 3 10 3 9 3 13 3 11 end
Table 4.4, page 70. The analysis of variance of orthogonal contrasts in a one-way design
NOTE1: For these contrast, we are going to exploit xi3 (xi3
must be installed; if it is not, it can be done by typing search xi3 in
the Stata
command window and proceed with installation) user defined coding scheme
u.varname, where u is defined in the char command and the
variables are expanded with the xi3 command. The user defined variables
must be treated as continuous to obtain the correct Sums of Squares.
NOTE2: The orthogonal contrast exclusively partitions the model sums of squares
between the two comparisons.
char a[user] (1 -.5 -.5 0 1 -1) xi3 u.a
u.a _Ia_1-3 (naturally coded; _Ia_3 omitted)
anova score _Ia_1 _Ia_2, continuous(_Ia_1 _Ia_2)
Number of obs = 15 R-squared = 0.5385 Root MSE = 3.87298 Adj R-squared = 0.4615 Source | Partial SS df MS F Prob > F -----------+---------------------------------------------------- Model | 210 2 105 7.00 0.0097 | _Ia_1 | 187.5 1 187.5 12.50 0.0041 _Ia_2 | 22.5 1 22.5 1.50 0.2442 | Residual | 180 12 15 -----------+---------------------------------------------------- Total | 390 14 27.8571429
Non orthogonal contrast in a one-way design, top of page 78
NOTE: The non-orthogonal contrast does not uniquely partition the model sums of squares
char a[user] (1 -1 01 0 -1) xi3, pre(non) u.a
u.a nona_1-3 (naturally coded; nona_3 omitted)
anova score nona_1 nona_2, continuous(nona_1 nona_2)
Number of obs = 15 R-squared = 0.5385 Root MSE = 3.87298 Adj R-squared = 0.4615 Source | Partial SS df MS F Prob > F -----------+---------------------------------------------------- Model | 210 2 105 7.00 0.0097 | nona_1 | 202.5 1 202.5 13.50 0.0032 nona_2 | 90 1 90 6.00 0.0306 | Residual | 180 12 15 -----------+---------------------------------------------------- Total | 390 14 27.8571429