NAG CL Interface
g04dbc (confidence)

Settings help

CL Name Style:


1 Purpose

g04dbc computes simultaneous confidence intervals for the differences between means. It is intended for use after g04bbc or g04bcc.

2 Specification

#include <nag.h>
void  g04dbc (Nag_IntervalType type, Integer nt, const double tmean[], double rdf, const double c[], Integer tdc, double clevel, double cil[], double ciu[], Integer isig[], NagError *fail)
The function may be called by the names: g04dbc, nag_anova_confidence or nag_anova_confid_interval.

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), σ ^ 2 , the residual degrees of freedom, ν , and the (variance ratio) F -statistic for the t 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 t treatments then there are t (t-1) / 2 comparisons to be considered. In tests the type 1 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 t -test is used with, say, a five percent significance level then the type 1 error for all k = t (t-1) / 2 tests will be much higher. If the tests were independent then if each test is carried out at the 100 α percent level then the overall type 1 error would be α * = 1 - (1-α) k k α . 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 100 (1-α) percent confidence interval for the difference in two treatment means, τ ^ i and τ ^ j is given by
( τ ^ i - τ ^ j ) ± T (α,ν,t) * se ( τ ^ i - τ ^ j ) ,  
where se () denotes the standard error of the difference in means and T (α,ν,t) * is an appropriate percentage point from a distribution. There are several possible choices for T (α,ν,t) * . These are:
  1. (a) 1 2 q (1-α,ν,t) , the studentized range statistic. It is the appropriate statistic to compare the largest mean with the smallest mean. This is known as Tukey–Kramer method.
  2. (b) t (α/k,ν) , this is the Bonferroni method.
  3. (c) t ( α 0 ,ν) , where α 0 = 1 - (1-α) 1/k , this is known as the Dunn–Sidak method.
  4. (d) t (α,ν) , this is known as Fisher's LSD (least significant difference) method. It should only be used if the overall F -test is significant, the number of treatment comparisons is small and were planned before the analysis.
  5. (e) (k-1) F 1 - α , k - 1 , ν where F 1 - α , k - 1 , ν is the deviate corresponding to a lower tail probability of 1-α from an F -distribution with k-1 and ν degrees of freedom. This is Scheffe's method.
In cases (b), (c) and (d), t (α,ν) denotes the α two-tail significance level for the Student's t -distribution with ν degrees of freedom, see g01fbc.
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,
τ ^ i - τ ^ j se ( τ ^ i - τ ^ j )  
is compared with the appropriate value of T (α,ν,t) * .

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 Arguments

1: type Nag_IntervalType Input
On entry: indicates which method is to be used.
type=Nag_TukeyInterval
The Tukey–Kramer method is used.
type=Nag_BonferroniInterval
The Bonferroni method is used.
type=Nag_DunnInterval
The Dunn–Sidak method is used.
type=Nag_FisherInterval
The Fisher LSD method is used.
type=Nag_ScheffeInterval
The Scheffe's method is used.
Constraint: type=Nag_TukeyInterval, Nag_BonferroniInterval, Nag_DunnInterval, Nag_FisherInterval or Nag_ScheffeInterval.
2: nt Integer Input
On entry: the number of treatment means, t .
Constraint: nt2 .
3: tmean[nt] const double Input
On entry: tmean[i-1] contains the treatment means, τ ^ i , i = 1 , 2 , , t .
4: rdf double Input
On entry: the residual degrees of freedom, ν .
Constraint: rdf1.0 .
5: c[nt×tdc] const double Input
On entry: the strictly lower triangular part of c must contain the standard errors of the differences between the means as returned by g04bbc and g04bcc. That is c[(i-1)×tdc+j-1] , i>j , contains the standard error of the difference between the i th and j th mean in tmean.
Constraint: c[(i-1)×tdc+j-1] > 0.0 , for i=2,3,,t and j=1,2,,i-1.
6: tdc Integer Input
On entry: the stride separating matrix column elements in the array c.
Constraint: tdcnt .
7: clevel double Input
On entry: the required confidence level for the computed intervals, (1-α) .
Constraint: 0.0 < clevel < 1.0 .
8: cil[nt×(nt-1)/2] double Output
On exit: cil[ (i-1) (i-2) / 2 + j - 1 ] contains the lower limit to the confidence interval for the difference between i th and j th means in tmean, for i=2,3,,t and j=1,2,,i-1.
9: ciu[nt×(nt-1)/2] double Output
On exit: ciu[ (i-1) (i-2) / 2 + j - 1 ] contains the upper limit to the confidence interval for the difference between i th and j th means in tmean, for i=2,3,,t and j=1,2,,i-1.
10: isig[nt×(nt-1)/2] Integer Output
On exit: isig[ (i-1) (i-2) / 2 + j - 1 ] indicates if the difference between i th and j th means in tmean is significant, for i=2,3,,t and j=1,2,,i-1. If the difference is significant then the returned value is 1; otherwise the returned value is 0.
11: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_2_INT_ARG_LT
On entry, tdc=value while nt=value . These arguments must satisfy tdcnt .
NE_2D_REAL_ARRAY_CONS
On entry, c[(value)×tdc+value] = value.
Constraint: c[(i)×tdc+j] > 0.0 , for i=1,2,,nt-1 and j=0,1,,i - 1.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument type had an illegal value.
NE_INT_ARG_LT
On entry, nt=value.
Constraint: nt2.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_REAL
On entry, clevel=value .
Constraint: 0.0 < clevel < 1.0 .
NE_REAL_ARG_LT
On entry, rdf must not be less than 1.0: rdf=value .
NE_STUDENTIZED_STAT
There has been a failure in the computation of the studentized range statistic. Try using a smaller value of clevel.

7 Accuracy

For the accuracy of the percentage point statistics see g01fbc.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g04dbc is not threaded in any implementation.

9 Further Comments

An alternative approach to one used in g04dbc 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 argument of the Studentized range statistic is the number of means in the subset rather than the total number of means.

10 Example

In the example taken from Winer (1970) a completely randomized design with unequal treatment replication is analysed using g04bbc and then confidence intervals are computed by g04dbc using the Tukey–Kramer method.

10.1 Program Text

Program Text (g04dbce.c)

10.2 Program Data

Program Data (g04dbce.d)

10.3 Program Results

Program Results (g04dbce.r)