MTB > # First I'll enter the data and the info needed for a
MTB > # two-way analysis.
MTB > set c1
DATA> 0.28 0.51 1.00 0.39 0.29 0.36 0.32 0.69 0.17 0.33
DATA> 0.30 0.39 0.63 0.38 0.21 0.88 0.39 0.51 0.32 0.42
DATA> 1.07 1.35 0.69 0.28 1.24 1.53 0.49 0.56 1.02 0.30
DATA> end
MTB > set c2
DATA> 10(1) 10(2) 10(3)
DATA> end
MTB > set c3
DATA> 3(1 2 3 4 5 6 7 8 9 10)
DATA> end
MTB > name c1 'conc' c2 'drug' c3 'dog'
MTB > # Now I'll do a two-way ANOVA F test.
MTB > twoway c1 c2 c3 c4 c5
ANALYSIS OF VARIANCE conc
SOURCE DF SS MS
drug 2 1.1458 0.5729
dog 9 0.9872 0.1097
ERROR 18 1.6887 0.0938
TOTAL 29 3.8217
MTB > # To reduce rounding error, I'll use the SS values to compute
MTB > # the value of the F statistic.
MTB > let k1 = (1.1458/2)/(1.6887/18)
MTB > cdf k1 k2;
SUBC> f 2 18.
MTB > let k2 = 1 - k2
MTB > name k1 'F' k2 'p-value' c4 'residual' c5 'est mean' c6 'n score'
MTB > print k1 k2
F 6.10659
p-value 0.00945550
MTB > # I'll look at a probit plot of the residuals, and a plot of the
MTB > # residuals against the estimated means.
MTB > nsco c4 c6
MTB > plot c6 c4
n score -
- *
-
1.5+ * *
- *
- 3
- ** *
- * 2
0.0+ * * 2
- 2 *
- ** *
- * **
- *
-1.5+ **
-
- *
-
+---------+---------+---------+---------+---------+------residual
-0.45 -0.30 -0.15 0.00 0.15 0.30
MTB > plot c4 c5
residual-
-
- * * *
0.30+ *
- * * *
- *2
- * * *
- * *
0.00+ *
- *
- *** *
- * *
- * *
-0.30+ * *
- * *
- *
-
----+---------+---------+---------+---------+---------+--est mean
0.20 0.40 0.60 0.80 1.00 1.20
MTB > # The probit plot suggests a light-tailed error term distribution, but the
MTB > # plot of the residuals against the estimated means suggests that there is
MTB > # heteroscedasticity. It may be that the F test result should not be trusted.
MTB > # Friedman's test allows for the error term distribution to differ among the
MTB > # blocks, and it may be more reliable.
MTB > # I'll try Friedman's test.
MTB > fried c1 c2 c3
Friedman test of conc by drug blocked by dog
S = 2.60 d.f. = 2 p = 0.273
Est. Sum of
drug N Median RANKS
1 10 0.3358 19.0
2 10 0.3742 17.0
3 10 0.7825 24.0
Grand median = 0.4975
MTB > # Minitab uses the chi-square approximation which results in an approximate
MTB > # p-value of about 0.27.
MTB > save 'anesthes'
Saving worksheet in file: anesthes.MTW
_______________________________________________________________________________________
---------------------------------------------------------------------------------------
*** StatXact info ***
* Friedman's test *
The four columns of values (the block ID and the three columns of concentration values)
can be pasted into Var1 through Var4 in StatXact's CaseData editor. Then one can use
Nonparametics > K Related Samples > Friedman...
One can highlight Var2, Var3, and Var4 in the Variables box and click the arrow to put
them into the Populations (Treatments) box. Under compute select Exact, and then click
OK.
The value of the test statistic and the asymptotic p-value are in agreement with the
Minitab results. The exact p-value is about 0.316, in agreement with the value given
in the table on p. 12-6 of the class notes.
* Friedman aligned rank test *
The four columns of values (the block ID and the three columns of concentration values)
can be pasted into Var1 through Var4 in StatXact's CaseData editor. Then one can use
Nonparametics > K Related Samples > Friedman Aligned Rank...
One can highlight Var2, Var3, and Var4 in the Variables box and click the arrow to put
them into the Populations (Treatments) box. Under compute select Exact, under Align
you can select mean, and then click OK.
The exact p-value is about 0.039, which is quite a bit smaller than the p-value from
(the ordinary) Friedman's test. The chi-square approximation is used to obtain the
asymptotic p-value of about 0.047.
* Quade test *
The four columns of values (the block ID and the three columns of concentration values)
can be pasted into Var1 through Var4 in StatXact's CaseData editor. Then one can use
Nonparametics > K Related Samples > Quade...
One can highlight Var2, Var3, and Var4 in the Variables box and click the arrow to put
them into the Populations (Treatments) box. Under compute select Exact, under Align
you can select mean, and then click OK.
The exact p-value is about 0.034, which is quite a bit smaller than the p-value from
Friedman's test, and a little smaller than the p-value from the aligned rank test.
The F approximation is used to obtain the asymptotic p-value of about 0.033.
* ANOVA F test *
One needs to copy and paste the 30 concentrations values into a single column, say Var5.
Then in Var6 put ten 1s followed by ten 2s followed by 10 3s, and in Var7 paste the block
column (Var1) three times (to make a column of length 30, with 1, 2, ..., 10 repeated
three times). Then use
Basic_Statistics > ANOVA...
Put Var5 into the Value box, Var6 into the Factor 1 box, and Var7 into the Factor 2 box.
Then click OK.
The desired F statistic value (6.107) and p-value (about 0.0095) are in the Var6 row of
the outputted ANOVA table, and they are in close agreement with the Minitab values shown
above.