Cochran Q Test Calculator Formula

Understand the math behind the cochran q test calculator. Each variable explained with a worked example.

Formulas Used

Cochran Q

q_stat = (k - 1) * (k * ss_col - pow(grand_total, 2)) / (k * grand_total - ss_row)

df

df = k - 1

Variables

VariableDescriptionDefault
kTreatments4
grand_totalGrand Total40
ss_colSum of Cj squared500
ss_rowSum of Ri squared210

How It Works

Cochran Q Test

Q = (k-1)[k*Sum(Cj^2) - T^2] / [kT - Sum(Ri^2)]

Extension of McNemar to 3+ related groups with binary outcomes.

Worked Example

4 treatments, T=40.

k = 4grand_total = 40ss_col = 500ss_row = 210
  1. 01Q = 3*(2000-1600)/(160-210)

Ready to run the numbers?

Open Cochran Q Test Calculator