The Cochran’s Q test statistic is calculated as follows:
where
k is the number of treatments
b is the number of blocks
Xij is the response (0 or 1) for the ith subject for the kth treatment
N is the grand total of positive responses across all subjects and treatments