Cochran's Q Test

Cochran's Q test is appropriate for random-blocks or repeated-measures data where the values are dichotomous (represented by zero or any non-zero numbers). The test computes a statistic Q which is compared to a critical value from the Chi-squared distribution. The Chi-squared distribution is an asymptotic approximation for the exact null distribution of Q. The null hypothesis (H0) is that the proportion of non-zero members is the same for all columns.

Consider the following data contained in wave1:

Group1Group2Group3Group4Group5
Block1  00001
Block200001
Block300011
Block401011
Block501010
Block611010
Block711000
Block810000
Block910000

The test statistic is smaller than the critical value

In this case there are 5 columns and 9 rows with a total of 45 entries which implies that the Chi-square approximation can be used (greater than 4 columns and 24 total entires). To run the test execute the following command:

StatsCochranTest/T=1/Q  wave1

The results are given in the Cochran Test table:

RowsColumnsStatisticCriticalConclusionP-value
955.565229.4877310.234056

It may be somewhat perplexing that despite the fact that Group3 column is identically zero, the test does not suggest rejection of the null hypothesis where the proportion of "ON" blocks is the same across all groups.

Keeping Group3 column fixed, you can increase the proportion of "ON" blocks in all other columns until the Q value exceeds the critical value. This is done in wave2 shown below.

Group1Group2Group3Group4Group5
Block1  00001
Block200001
Block300011
Block401011
Block511011
Block611011
Block711010
Block811000
Block910000

To run the test on these data execute the following command:

StatsCochranTest/T=1/Q  wave2

The results are given in the Cochran Test table:

RowsColumnsStatisticCriticalConclusionP-value
9510.36369.4877300.0347281

As expected the test statistic has increased above the critical value and so the H0 must be rejected, i.e., the proportion of non-zero entries in the different columns is not the same.