Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I have pairs of values from two runs (replicate) for each sample along with total count for each run. I assumed each value as random binomial. I used log-likelihood ratio test to compare each pair, but my data range is wide, e.g. X1, X2 = (0,0), (0,1), (0,2), ..., (20, 20) with total counts for each run (n1, n2) range from hundreds to thousands. So my data look like:

ID    X1    X2    n1       n2
A1    0     0     119     230
A2    0     1     213     185
.     .     .      .       .
.     .     .      .       .
.     .     .      .       .
A200  15    23    2300    1735

What test will be appropriate and power for it? Already tried likelihood ratio test, how can I implement Fisher's exact test in R for it? any other test that may use X1 condition of X1 + X2!

Any help will be appreciated. I want to implement it in R, so R codes/function will be more helpful. Thanks in advance

share|improve this question
1  
What is the question? What do you want to determine from these data? Are the X1 and X2 predetermined or are they observations? What do they mean? What is a "run"? Does it correspond one-to-one with a single "ID"? What does the reference to "X1+X2" mean? – whuber Jul 1 '11 at 16:04
Do you want to run a separate test for each row or an overall test? – Aniko Jul 1 '11 at 16:13
@Aniko, yes I want to run a separate test for each row. – Adam Jul 6 '11 at 19:13
@whuber - X1 and X2 correspond to observed count data for lab test in run 1 and run2. Run is basically is a replicate, where a test was repeated twice. Yes it correspond one-to-one with a single ID. I assume that both X1 and X2 are iid binomial random variables. I am testing my assumption that both are from a same binomial distribution with parameter p1, and p2, where p1=p2=p. I am applying likelihood ratio test, but heard if I use a test where X1 is conditional on X1+X2 it is more powerful, which hypergeometric. (from the OP) – chl Nov 3 '11 at 22:49
Let's see whether I get it. On row 2 you're saying that for ID = A2, $X_1$ is an observation of a Binomial($p_1,213$) variable and $X_2$ is an independent observation of a Binomial($p_2,185$) variable. You also assert all rows are independent. You wish to test whether $p_1=p_2$. You are wondering whether a test based on $\Pr(X_1|X_1+X_2)$ might be a good choice. Is all this correct? – whuber Nov 3 '11 at 22:59

1 Answer

One option is the Mantel-Haenszel test. This will test/estimate the odds-ratio between x1 and x2 while allowing the margins to vary between the ID's. In R use the mantelhaen.test function.

You could also use the glm function to fit a logistic regression with a term indicating x1 vs. x2 and another for ID (and possibly an interaction).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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