# Cochran's Q test

This page offers all the basic information you need about the cochran's q test. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find *p * values, SPSS how-to’s and more.

To compare the cochran's q test with other statistical methods, go to Statkat's or practice with the cochran's q test at Statkat's

##### Contents

- 1. When to use
- 2. Null hypothesis
- 3. Alternative hypothesis
- 4. Assumptions
- 5. Test statistic
- 6. Sampling distribution
- 7. Significant?
- 8. Equivalent to
- 9. Example context
- 10. SPSS
- 11. Jamovi

##### When to use?

Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables. The cochran's q test requires the following variable types:

Independent/grouping variable: One within subject factor ($\geq 2$ related groups) | Dependent variable: One categorical with 2 independent groups |

Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).

If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.

##### Null hypothesis

The cochran's q test tests the following null hypothesis (H_{0}):

_{0}: $\pi_1 = \pi_2 = \ldots = \pi_I$

$\pi_1$ is the population proportion of 'successes' for group 1; $\pi_2$ is the population proportion of 'successes' for group 2; $\pi_I$ is the population proportion of 'successes' for group $I$

##### Alternative hypothesis

The cochran's q test tests the above null hypothesis against the following alternative hypothesis (H_{1} or H_{a}):

_{1}: not all population proportions are equal

##### Assumptions

Statistical tests always make assumptions about the sampling procedure that's been used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).

The cochran's q test makes the following assumptions:

- Sample of 'blocks' (usually the subjects) is a simple random sample from the population. That is, blocks are independent of one another

##### Test statistic

The cochran's q test is based on the following test statistic:

If a failure is scored as 0 and a success is scored as 1:$Q = k(k - 1) \dfrac{\sum_{groups} \Big (\mbox{group total} - \frac{\mbox{grand total}}{k} \Big)^2}{\sum_{blocks} \mbox{block total} \times (k - \mbox{block total})}$

Here $k$ is the number of related groups (usually the number of repeated measurements), a group total is the sum of the scores in a group, a block total is the sum of the scores in a block (usually a subject), and the grand total is the sum of all the scores.

Before computing $Q$, first exclude blocks with equal scores in all $k$ groups.

##### Sampling distribution

Sampling distribution of $Q$ if H_{0}were true:

If the number of blocks (usually the number of subjects) is large, approximately the chi-squared distribution with $k - 1$ degrees of freedom

##### Significant?

This is how you find out if your test result is significant:

If the number of blocks is large, the table with critical $X^2$ values can be used. If we denote $X^2 = Q$:- Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
- Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$

##### Equivalent to

The cochran's q test is equivalent to:

Friedman test, with a categorical dependent variable consisting of two independent groups##### Example context

The cochran's q test could for instance be used to answer the question:

Subjects perform three different tasks, which they can either perform correctly or incorrectly. Is there a difference in task performance between the three different tasks?##### SPSS

How to perform the cochran's q test in SPSS:

Analyze > Nonparametric Tests > Legacy Dialogs > K Related Samples...- Put the $k$ variables containing the scores for the $k$ related groups in the white box below Test Variables
- Under Test Type, select Cochran's Q test

##### Jamovi

How to perform the cochran's q test in jamovi:

Jamovi does not have a specific option for the Cochran's Q test. However, you can do the Friedman test instead. The $p$ value resulting from this Friedman test is equivalent to the $p$ value that would have resulted from the Cochran's Q test. Go to:ANOVA > Repeated Measures ANOVA - Friedman

- Put the $k$ variables containing the scores for the $k$ related groups in the box below Measures