# Cochran's *Q* test using SPSS Statistics

## Introduction

Cochran's *Q* test is used to determine if there are differences on a dichotomous dependent variable between three or more related groups. It can be considered to be similar to the one-way repeated measures ANOVA, but for a dichotomous rather than a continuous dependent variable, or as an extension of McNemar's test. Cochran's *Q* test is commonly used to analyse longitudinal study designs, as well as being used when analysing participants that have undergone multiple different trials (a.k.a. treatments/conditions).

For example, you could use Cochran's *Q* test to determine whether the proportion of participants who had low self-esteem (as opposed to high self-esteem) decreased after a series of three counselling sessions (i.e., your dependent variable would be "level of self-esteem", which has two categories: "low" and "high", measured at four time points: "before the first counselling session", "after the second counselling session", "after the third counselling session" and "after the final counselling session"). Alternatively, you could use Cochran's *Q* test to determine whether the proportion of female participants who felt safe (yes or no) differed when carrying mace, an alarm or nothing at all (i.e., the dependent variable would be "sense of safety", which has two categories: "safe" or "not safe", measured across three treatments/conditions: "mace", "alarm" and "nothing").

When you run a Cochran's *Q* test, you will either get a statistically significant result or a non-statistically significant result. If your result is not statistically significant, it indicates that the percentages/proportions at the different time points or under the different treatments/conditions are the same in the population. In this circumstance, it is not necessary to follow up your results with a post hoc analysis. However, if you did get a statistically significant result, you will probably want to follow up your Cochran's *Q* test with a post hoc analysis. You will want to do this because Cochran's *Q* test is an omnibus test. That is, it tells you that there are differences in the proportions between three or more related groups, but it does not tell you which specific groups differed from each other (e.g., it will tell you that the proportion of female participants who felt safe differed based on whether they carried "mace", an "alarm" or "nothing at all", but it will not tell you which of these three treatments/conditions made females feel more safe). A post hoc analysis will allow you to do this.

This "quick start" guide shows you how to carry out Cochran's *Q* test using SPSS Statistics, as well as interpret and report the results from this test. However, before we introduce you to this procedure, you need to understand the different assumptions that your study design must meet in order for Cochran's *Q* test to be an appropriate choice of test. We discuss these assumptions next.

###### SPSS Statistics

## Assumptions

Cochran's *Q* test has four assumptions that must be met. If these assumptions are not met, you cannot use Cochran's *Q* test, but may be able to use another statistical test instead. Therefore, in order to run Cochran's *Q* test, you need to check that your study design meets the following four assumptions:

**Assumption #1:**You have**one dependent variable**with**two, mutually exclusive groups**(i.e., the variable is**dichotomous**). Examples of**dichotomous variables**include perceived safety (two groups: "safe" and "unsafe"), exam performance (two groups: "pass" and "fail"), preferred choice of cereal brand (two groups: "brand A" and "brand B"), feeling of seasickness (two groups: "yes" and "no"), level of exhaustion (two groups: "low" and "high"), use of safety equipment (two groups: "uses safety helmet" and "doesn't use safety helmet"), skin cream effectiveness (two groups: "rash" and "no rash"), and so forth. You can learn more about dichotomous variables in our article: Types of Variable.

**Mutually exclusive**means that a participant cannot be in more than one group at the same time. For example, imagine you were using Cochran's*Q*test to determine whether the proportion of participants who passed an exam (as opposed to failing the exam) before a two week revision period (i.e., an intervention) increased after the intervention (i.e., your dependent variable would be "exam performance", which has two categories: "pass" and "fail"). When a participant took the exam before the two week revision period, they could have only "passed" it or "failed" it. They could not pass and fail at the same time (e.g., they either got 60 out of 100 marks and above, which was a "pass", or 59 marks and below, which was a "fail"). Similarly, after the two week revision period, the participant could still only either pass or fail the exam.**Assumption #2:**You have**one independent variable**that consists of**three or more categorical**,**related groups**(i.e., your independent variable is an**ordinal**or**nominal variable**).

Examples of**ordinal variables**include Likert items (e.g., a 7-point scale from "strongly agree" through to "strongly disagree"), physical activity level (e.g., 4 groups: sedentary, low, moderate and high), customers liking a product (ranging from "Not very much", to "It is OK", to "Yes, a lot"), and so forth. Examples of**nominal variables**include ethnicity (e.g., three groups: "Caucasian", "African American" and "Hispanic") and profession (e.g., four groups: "doctor", "nurse", "dentist" and "therapist").

**Related groups**indicates that the three or more groups are not independent. The primary reason for having related groups is having the same participants in each group. It is possible to have the same participants in each group when each participant has been measured on two or more occasions on the same dependent variable. For example, you might have measured 10 individuals' performance in a spelling test (the dependent variable) before, midway and after they underwent a new form of computerized teaching method to improve spelling. You would like to know if the computer training improved their spelling performance. The first related group consists of the participants at the beginning (prior to) the computerized spelling training, the second related group consists of the same participants at the midway point through the computerized training and the third related group consists of the same participants at the end of the computerized training. Alternatively, you may have measured 20 individuals' task performance (the dependent variable) when working in three different lighting conditions (e.g., blue, red and natural lighting) to determine whether task performance was affected by the colour of the lighting in the room.**Assumption #3:**The cases (e.g., participants) are a random sample from the population of interest. However, in practice, this is not always how sampling took place.**Assumption #4:**Your sample size is sufficiently large that you can interpret the**asymptotic**produced by Cochran's*p*-value*Q*test (i.e., a*p*-value is the value that you consult to determine if there is a statistically significant difference in proportions between your three or more related groups). If your sample size is inadequate, the asymptotic*p*-value may not be accurate, but you can run an "exact" version of Cochran's*Q*test that will generate a more accurate**exact**.*p*-value

Therefore, before you can carry out your analysis, you need to know whether your data has met or violated this sample size assumption. It is important not only because it affects whether you need to run the "standard" Cochran's*Q*test (as shown in the Test Procedure in SPSS Statistics section below) or an "exact" version of Cochran's*Q*test, but it also will determine what post hoc test you carry out (i.e., since there is more than one type of post hoc test you can carry out after running Cochran's*Q*test). In this "quick start" guide, we just set out and explain the "standard" Cochran's*Q*test, but in our enhanced Cochran's*Q*test that is available if you choose to become a member of Laerd Statistics, we explain: (a) how to test the sample size assumption of Cochran's*Q*test using SPSS Statistics; (b) how to interpret whether your data has met or violated this assumption; and (c) how to run the "exact" version of Cochran's*Q*test using SPSS Statistics if your data violates this assumption.

If your study design does not meet these four assumptions, you cannot use Cochran's *Q* test, but you may be able to use another statistical test instead (learn more about our Statistical Test Selector if this is the case). However, assuming that you are using the correct test, we show you how to analyse your data using Cochran's *Q* test later in the Test Procedure in SPSS Statistics section. First, we introduce you to the example we use in this guide.