Test for equality of proportions in matched samples (Cochran's Q)
cochran varlist [weight] [if exp] [in range] [, detail ]
by ... : may be used with cochran; see help by.
fweights are allowed with cochran; see help weights.
cochran performs a test for equality of two or more proportions in matched samples: Taking the 1-to-1 matching of observations into account, cochran tests that the proportion of nonzero outcomes is constant for the variables in varlist.
The chi-squared calculated by cochran is known as Cochran's Q (Cochran 1950). If only two proportions are compared, Cochran's Q is equal to the McNemar chi-squared calculated by mcc. An exact significance probability will be reported in this case.
detail specifies to display the proportions and counts (i.e. number of nonzero outcomes).
r(N) number of cases r(chi2) Cochran's Q r(df) degrees of freedom r(p) p-value r(p_exact) exact p-value (if only two proportions are compared)
r(T) proportions and counts
Methods and Formulas
Cochran's Q is defined as
c * (c-1) * sum_j ( T_j - T_bar )^2 Q = ------------------------------------- c * sum_i ( u_i ) - sum_i ( u_i^2 )
where c is the number columns (= number of proportions = number of variables), T_j is the number of nonzero outcomes in the jth column, T_bar is the mean number of nonzero outcomes (i.e. the proportion of nonzero outcomes) per column, and u_i is the number of nonzero outcomes in the ith row (= number of nonzero outcomes in the ith observarion).
For large samples, Q is chi-square distributed with (c-1) degrees of freedom.
Cochran, W. G. 1950. The Comparison of Percentages in Matched Samples. Biometrika 37(3/4): 256-266.
Ben Jann, ETH Zurich, firstname.lastname@example.org