NAG Library Routine Document
G04DBF
1 Purpose
G04DBF computes simultaneous confidence intervals for the differences between means. It is intended for use after
G04BBF or
G04BCF.
2 Specification
SUBROUTINE G04DBF ( |
TYP, NT, TMEAN, RDF, C, LDC, CLEVEL, CIL, CIU, ISIG, IFAIL) |
INTEGER |
NT, LDC, ISIG(NT*(NT-1)/2), IFAIL |
REAL (KIND=nag_wp) |
TMEAN(NT), RDF, C(LDC,NT), CLEVEL, CIL(NT*(NT-1)/2), CIU(NT*(NT-1)/2) |
CHARACTER(1) |
TYP |
|
3 Description
In the computation of analysis of a designed experiment the first stage is to compute the basic analysis of variance table, the estimate of the error variance (the residual or error mean square), , the residual degrees of freedom, , and the (variance ratio) -statistic for the treatments. The second stage of the analysis is to compare the treatment means. If the treatments have no structure, for example the treatments are different varieties, rather than being structured, for example a set of different temperatures, then a multiple comparison procedure can be used.
A multiple comparison procedure looks at all possible pairs of means and either computes confidence intervals for the difference in means or performs a suitable test on the difference. If there are treatments then there are comparisons to be considered. In tests the type error or significance level is the probability that the result is considered to be significant when there is no difference in the means. If the usual -test is used with, say, a significance level then the type error for all tests will be much higher. If the tests were independent then if each test is carried out at the percent level then the overall type error would be . In order to provide an overall protection the individual tests, or confidence intervals, would have to be carried out at a value of such that is the required significance level, e.g., five percent.
The
percent confidence interval for the difference in two treatment means,
and
is given by
where
denotes the standard error of the difference in means and
is an appropriate percentage point from a distribution. There are several possible choices for
. These are:
(a) |
, the studentized range statistic, see G01FMF. It is the appropriate statistic to compare the largest mean with the smallest mean. This is known as Tukey–Kramer method. |
(b) |
, this is the Bonferroni method. |
(c) |
, where , this is known as the Dunn–Sidak method. |
(d) |
, this is known as Fisher's LSD (least significant difference) method. It should only be used if the overall -test is significant, the number of treatment comparisons is small and were planned before the analysis. |
(e) |
where is the deviate corresponding to a lower tail probability of from an -distribution with and degrees of freedom. This is Scheffe's method. |
In cases
(b),
(c) and
(d),
denotes the
two tail significance level for the Student's
-distribution with
degrees of freedom, see
G01FBF.
The Scheffe method is the most conservative, followed closely by the Dunn–Sidak and Tukey–Kramer methods.
To compute a test for the difference between two means the statistic,
is compared with the appropriate value of
.
4 References
Kotz S and Johnson N L (ed.) (1985a) Multiple range and associated test procedures Encyclopedia of Statistical Sciences 5 Wiley, New York
Kotz S and Johnson N L (ed.) (1985b) Multiple comparison Encyclopedia of Statistical Sciences 5 Wiley, New York
Winer B J (1970) Statistical Principles in Experimental Design McGraw–Hill
5 Parameters
- 1: TYP – CHARACTER(1)Input
On entry: indicates which method is to be used.
- The Tukey–Kramer method is used.
- The Bonferroni method is used.
- The Dunn–Sidak method is used.
- The Fisher LSD method is used.
- The Scheffe's method is used.
Constraint:
, , , or .
- 2: NT – INTEGERInput
On entry: , the number of treatment means.
Constraint:
.
- 3: TMEAN(NT) – REAL (KIND=nag_wp) arrayInput
On entry: the treatment means,
, for .
- 4: RDF – REAL (KIND=nag_wp)Input
On entry: , the residual degrees of freedom.
Constraint:
.
- 5: C(LDC,NT) – REAL (KIND=nag_wp) arrayInput
On entry: the strictly lower triangular part of
C must contain the standard errors of the differences between the means as returned by
G04BBF and
G04BCF. That is
,
, contains the standard error of the difference between the
th and
th mean in
TMEAN.
Constraint:
, for and .
- 6: LDC – INTEGERInput
On entry: the first dimension of the array
C as declared in the (sub)program from which G04DBF is called.
Constraint:
.
- 7: CLEVEL – REAL (KIND=nag_wp)Input
On entry: the required confidence level for the computed intervals, ().
Constraint:
.
- 8: CIL() – REAL (KIND=nag_wp) arrayOutput
On exit: the
th element contains the lower limit to the confidence interval for the difference between
th and
th means in
TMEAN, for
and
.
- 9: CIU() – REAL (KIND=nag_wp) arrayOutput
On exit: the
th element contains the upper limit to the confidence interval for the difference between
th and
th means in
TMEAN, for
and
.
- 10: ISIG() – INTEGER arrayOutput
On exit: the
th element indicates if the difference between
th and
th means in
TMEAN is significant, for
and
. If the difference is significant then the returned value is
; otherwise the returned value is
.
- 11: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | , , , or . |
On entry, | for some , and . |
There has been a failure in the computation of the studentized range statistic. This is an unlikely error. Try using a small value of
CLEVEL.
7 Accuracy
For the accuracy of the percentage point statistics see
G01FBF and
G01FMF.
If the treatments have a structure then the use of linear contrasts as computed by
G04DAF may be more appropriate.
An alternative approach to one used in G04DBF is the sequential testing of the Student–Newman–Keuls procedure. This, in effect, uses the Tukey–Kramer method but first ordering the treatment means and examining only subsets of the treatment means in which the largest and smallest are significantly different. At each stage the third parameter of the Studentized range statistic is the number of means in the subset rather than the total number of means.
9 Example
In the example taken from
Winer (1970) a completely randomized design with unequal treatment replication is analysed using
G04BBF and then confidence intervals are computed by G04DBF using the Tukey–Kramer method.
9.1 Program Text
Program Text (g04dbfe.f90)
9.2 Program Data
Program Data (g04dbfe.d)
9.3 Program Results
Program Results (g04dbfe.r)