3
$\begingroup$

I want to do a chi-squared test on data that looks like this:

A B
0 0 
1 0
0 1
1 1
8 0
3 4
...

You can think of each pair as one trial with two participants. In each trial, there are a different number of observations for each participant.

I have binned each data pair like so: I counted how many pairs have 0 for both pairs (e.g. 0-0), how many have exactly one 0 (e.g., 0-1, 1-0, 8-0, etc.), and how many have greater than 0 for both (e.g., 1-1, 3-4, etc.). This gives me the following counts:

Two zeroes: 227
One zero: 277
No zeroes: 146

The problem is that I am not sure how to calculate expected values here. Each pair represents the number of times something appears within an arbitrary number of observations; each pair represents a different number of observations, and each element of the pair does too. So, for instance, for a given 0-1 pair the first participant might have given 200 observations (with no hits), and the second might have yielded 150 observations (with 1 hit). Another 0-1 pair might have yielded 100 observations and 50 observations, respectively.

So, in this case, just totaling the overall number of hits and dividing that by the total number of observations won't get me the right expected values...

Am I missing something obvious here? For instance if we know that the relative frequency of hits per observation is 0.01217, and if there are a different number of observations for each trial, is there a simple way to get expected values in a problem like this?

This is what I want to test: whether the hits between participants in each trial are independent. I expect that as the hits of one participant in one pair increases, so will the other. I realize that there might be better ways to test this, but my committee have asked me to use a chi-sq test, if possible. So what I expect to find is that the number of trials in the 0-0 and in the no-zero bins will be higher than would be expected if hits are distributed evenly.

$\endgroup$
  • $\begingroup$ Sorry to ask, but do you want to test trails and patients are independent? If no, can you please specify what does the Chi-sq test intend to do? $\endgroup$ – suncoolsu Jan 8 '11 at 3:49
  • $\begingroup$ Yes, that's what I am looking for. I have edited the question to reflect that. Please let me know if anything is unclear. $\endgroup$ – Alan H. Jan 8 '11 at 5:24
3
$\begingroup$

First of all, if your counts come from a different number of trials, then you cannot just ignore that. Apparently your data is better represent as follows:

Pair Subject NTrials Hits
1       A     200     0
1       B     150     0
2       A     100     1
2       B     215     0
etc

Second, there does not seem to be any reason to recode the number of hits as 0 or >0 - you are throwing away data, and making the analysis more difficult (and probably less meaningful).

For the analysis approach, I don't think you can make do with a simple chi-square test. You will need some sort of binomial regression, probably with a random effect accounting for the within-pair correlation. In fact, a test for the presence of this random effect would answer the question of the presence of correlation.

Alternatively, you could calculate the probability of a hit for each participant, and then use some sort of weighted correlation, with each observation weighted by its inverse variance (np(1-p)).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.