# st: Chi-square test for differences in a binary outcome

 From "Christoph Vanberg" To statalist@hsphsun2.harvard.edu Subject st: Chi-square test for differences in a binary outcome Date Wed, 4 Jul 2007 18:58:07 +0200

```Hello,

I want to test for an effect of a randomly administered treatment on a
binary variable y=0 or 1. My data consists of observations on the same
set of individuals in different conditions, thus the samples are not
independent. Specifically, three treatment conditions are applied to
each individual a random number of times. I want to compare outcomes
between subjects in two of these three conditions. Since the number of
times an individual is in these two conditions is random, it is not
balanced across subjects.

I am looking at data of the following form, where the fractions
represent (times y=1 is observed in condition x) / (times subject is
in condition x).

i:    1     2    3        4  ....  N
x1: 1/2  1/1  1/1   2/3  ....  3/3
x2: 0/1  0/0  1/2   1/2  ....  1/4

As I understand it, McNemar's Chi-square test (mcc in Stata) tests
for treatment effects if you have paired observations, each with one
outcome. That is, it applies to
the following type of data, where i identifies matched pairs, x1 is a
dummy indicating y=1 in condition 1 and x2 is a dummy indicating y=1
in condition 2.

i:    1     2    3    4  ....  N
x1: 1    1    1     0  ....  1
x2: 0    0    1     1  ....  0

This is pretty close to what I want to do, but the test does not apply
to my situation, where the same individual can be repeatedly observed
in the same condition.

Does anyone have a suggestion as to what type of nonparametric test
might be appropriate in such a case?

Thank you,
Christoph

--
--
_______________________________________________________

Christoph Vanberg, Ph.D.
Max Planck Institute of Economics
Strategic Interaction Group
Kahlaische Str. 10, D-07745 Jena, Germany
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```