naginterfaces.library.nonpar.test_​cochranq

naginterfaces.library.nonpar.test_cochranq(x)[source]

test_cochranq performs the Cochran -test on cross-classified binary data.

For full information please refer to the NAG Library document for g08al

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/g08/g08alf.html

Parameters
xfloat, array-like, shape

The matrix of observed zero-one data. must contain the value , for , for .

Returns
qfloat

The value of the Cochran -test statistic.

probfloat

The upper tail probability, , associated with the Cochran -test statistic, that is the probability of obtaining a value greater than or equal to the observed value (the output value of ).

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: or .

Warns
NagAlgorithmicWarning
(errno )

The solution has failed to converge while calculating the tail probability.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

Cochran’s -test may be used to test for differences between treatments applied independently to individuals or blocks ( related samples of equal size ), where the observed response can take only one of two possible values; for example a treatment may result in a ‘success’ or ‘failure’. The data is recorded as either or to represent this dichotomization.

The use of this ‘randomized block design’ allows the effect of differences between the blocks to be separated from the differences between the treatments. The test assumes that the blocks were randomly selected from all possible blocks and that the result may be one of two possible outcomes common to all treatments within blocks.

The null and alternative hypotheses to be tested may be stated as follows.

:

the treatments are equally effective, that is the probability of obtaining a within a block is the same for each treatment.

:

there is a difference between the treatments, that is the probability of obtaining a is not the same for different treatments within blocks.

The data is often represented in the form of a table with the rows representing the blocks and the columns the treatments. Let represent the row totals, for , and represent the column totals, for . Let represent the response or result where or .

[table omitted]

If , for and , then the hypotheses may be restated as follows

:

, for each .

:

, for some and , and for some .

The test statistic is defined as

When the number of blocks, , is large relative to the number of treatments, , has an approximate -distribution with degrees of freedom. This is used to find the probability, , of obtaining a statistic greater than or equal to the computed value of . Thus is the upper tail probability associated with the computed value of , where the -distribution is used to approximate the true distribution of .

References

Conover, W J, 1980, Practical Nonparametric Statistics, Wiley

Siegel, S, 1956, Non-parametric Statistics for the Behavioral Sciences, McGraw–Hill