Test for aggregation of binary events/successes (binomial/glm??) this has been vexing me for a while and I can't seem to solidify an answer beyond vague thoughts about Poisson distributions. I think this is a simple problem and I'm missing something obvious. Any thoughts appreciated, particularly with R snippets :) 
Chris
Experiment: 2 replicate assays from each of 50 tissues. In the 100 samples, call a binary (0,1) event (without using tissue of origin; I'll call 1 outcomes "successes", per Bernoulli trial convention). Then score tissues for concordance (2 if both replicates are successful; 1 if only one; 0 otherwise). If the assay is working, we expect non-random numbers of concordance = 2 for tissues (i.e. the effect should replicate), given the total number of successes S.
How can I test that the distribution of (0,1,2) on tissues- or perhaps the proportions of (1,2) tissues - deviates from expectation?
thanks!
 A: Perhaps you can jigger with your data structure a little bit like this:
You say that each assay is produced twice on each tissue type. If both samples receive precisely the same assay, then it should not matter to you to arbitrarily call, say, one assay on the tissue "group A" and the other assay on the same tissue "group B".
So, if you code your outcome/success=1, and no outcome/failure = 0, your data could be thought of as looking like:
Tissue  Outcome A  Outcome B

     1       0         0
     2       1         1
     3       1         1
     .       .         .
     .       .         .
     .       .         .
    49       0         1
    50       0         0
These look like paired data (because one observation of success/no success in a tissue is paired with a second observation of success/no success in the same tissue type), and when someone says "I wanna examine the correlation between paired data with binomial outcomes" I head straight over to McNemar's test. This require rejiggering your data, because what you are analyzing are pairs, and there are four kinds of pairs, and you wanna set up the counts of each (totally made up numbers, yo):
   Group A    Group B  Kind of Pair  Count of Pairs
no success  no success   concordant        15
   success  no success   discordant        11
no success     success   discordant        19
   success     success   concordant        5
McNemar's test is a $\chi^{2}$ equivalent to the sign test. The test statistic only examines discordant pairs. Let's call the count of Group A successful, but Group B not successful $r$, and then let's call the count of Group A not successful, but Group B successful $s$ (which discordant pair you call which is arbitrary). The test statistic (which is including a Yates continuity correction in that "$-1$" business) is:
$$\chi^{2}_{\text{df=1}} = \frac{\left(\left|r-s\right|-1\right)^{2}}{r+s}$$
$$\chi^{2}_{\text{df=1}} = \frac{\left(\left|11-19\right|-1\right)^{2}}{11+19} = \frac{49}{30} = 1.6\bar{3}$$
These made up data give a $p$-value of about 0.20, so unless you are being outrageously libertine with your Type I error preferences, you would not reject the null hypothesis. As it so happens, the null hypothesis you are testing is that there is no association between group membership and probability of success.
R can perform McNemar's test using the, ahem, mcnemar.test() function
A: This sounds like a classic use case for the good old Pearson $\chi^2$ test. There's a short R tutorial here.
Basically, you have data points in one of three categories (i.e. 0, 1, or 2). You have an expected distribution of frequencies over those categories; the $\chi^2$ test is explicitly intended to check whether the observed frequencies match your expectation. In this case you'd have:
$$
\frac{o_0+e_0}{e_0}+\frac{o_1+e_1}{e_1}+\frac{o_2+e_2}{e_2}\sim\chi^2_2
$$ 
where, e.g. "$o_0$" is the observed number of "0" tissues and $e_0$ is the number you expect.
Also -- the outcome (0, 1, and 2) in this case is binomial, not Poisson.
