naginterfaces.library.anova.confidence¶
- naginterfaces.library.anova.confidence(typ, tmean, rdf, c, clevel)[source]¶
confidence
computes simultaneous confidence intervals for the differences between means. It is intended for use afterrandom()
orrowcol()
.For full information please refer to the NAG Library document for g04db
https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/g04/g04dbf.html
- Parameters
- typstr, length 1
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.
- tmeanfloat, array-like, shape
The treatment means, , for .
- rdffloat
, the residual degrees of freedom.
- cfloat, array-like, shape
The strictly lower triangular part of must contain the standard errors of the differences between the means as returned by
random()
androwcol()
. That is , , contains the standard error of the difference between the th and th mean in .- clevelfloat
The required confidence level for the computed intervals, ().
- Returns
- cilfloat, ndarray, shape
The th element contains the lower limit to the confidence interval for the difference between th and th means in , for , for .
- ciufloat, ndarray, shape
The th element contains the upper limit to the confidence interval for the difference between th and th means in , for , for .
- isigint, ndarray, shape
The th element indicates if the difference between th and th means in is significant, for , for . If the difference is significant then the returned value is ; otherwise the returned value is .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: , , , or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
There has been a failure in the computation of the studentized range statistic.
- Notes
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
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:
, the studentized range statistic, see
stat.inv_cdf_studentized_range
. It is the appropriate statistic to compare the largest mean with the smallest mean. This is known as Tukey–Kramer method., this is the Bonferroni method.
, where , this is known as the Dunn–Sidak method.
, 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.
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
stat.inv_cdf_students_t
.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 .
- References
Kotz, S and Johnson, N L (ed.), 1985, Multiple range and associated test procedures, Encyclopedia of Statistical Sciences (5), Wiley, New York
Kotz, S and Johnson, N L (ed.), 1985, Multiple comparison, Encyclopedia of Statistical Sciences (5), Wiley, New York
Winer, B J, 1970, Statistical Principles in Experimental Design, McGraw–Hill