# Calculating p-values for ratios of binomial variables

I have a problem that I will express in 2 ways: a math-y way and a biology way. Hopefully this will make it more clear.

Math-y way:

I have N observations of a pair of binomial variables, call them R and D. Each time I observe them, I do n trials and observe k successes to get an estimated binomial probability p. For each observation, I am interested in the ratio R/D, a.k.a. the ratio of the paired binomial probabilities. I have done N observations of this ratio for group 1, and M observations of this ratio for group 2. I would like to know whether these two groups are significantly different. Some caveats are that M,N are small, i.e. 2-3, and for some of the observations, the number of trials for either R or D is low, so I'm thinking that normal approximations may not work here.

Biology way:

I have a community of ~30 microbes, and each one expresses the same gene (call it YFG1). I can measure the relative abundance of each microbe in the community, as well as the relative amount of each microbe's YFG1 transcription via high-throughput sequencing. So for each microbe, I have both RNA and DNA data. For each type of data, I know the number of reads that map to the microbe, and the total number of mappable reads. I'm interested in the YFG1 RNA/DNA ratio for each microbe under different conditions, and so I've collected data 2-3 times at each condition of interest. I would like to know if there are any conditions in which a particular microbe significantly up- or down-regulates YFG1 expression.

I know that the ratio of two binomial variables does not have a finite variance, since dividing by zero is a possibility, but I was wondering if it was possible to know whether two groups of binomial ratios are significantly different? I'm open to simulations, as long as I know what to simulate :). I've been running around in circles on this one and was hoping y'all could shed some light.

• Having a variable on the denominator that can be 0 with prob>0 is problematic; how are you dealing with this? – Glen_b May 10 '18 at 1:45
• I would naively think that I could throw out any observations with a DNA count of zero, but I'm certainly open to suggestions :). – Nathan Crook May 10 '18 at 20:12
• Why would you throw out the count-pairs that corresponded to the strongest indication of a high (or low) ratio? It might be better to rethink what the ratio is supposed to tell you (e.g. if you're trying to estimate a population ratio, the raw sample ratio may not be the best approach to estimating it) – Glen_b May 10 '18 at 23:03
• I might throw them out because a count of 0 for a microbe could indicate that whole sample had a low number of total reads, and therefore have too high of a count variance to be useful. But then again there may be a method to extract useful info in this case? I'm not sure. In my mind, the ratio is supposed to tell me the amount of transcription of YFG1 on a per-microbe basis, and that by measuring this ratio across several replicate samples, I'd be able to see how much this ratio varies within a certain condition, and consequently whether this ratio varies significantly between conditions. – Nathan Crook May 11 '18 at 0:02
• You should be focusing first on what you're trying to achieve (and then finding out the best way to achieve that) rather than choosing in - an ad hoc fashion - how to manipulate the data without reference to what you're trying to find out. If it's binomial as you assert then the zero certainly has information. – Glen_b May 11 '18 at 2:55

## 1 Answer

As explained in this document, https://pdfs.semanticscholar.org/9988/59d48216848def1c97db875d6f923aa257a6.pdf, if the number of trials n is low, you should at least have larger values of the number of observations N.

One way to go about your problem would be to analyze the data on your R variable separately from the data on your D variable. For each variable, you can use the N corresponding proportions of successes k/n as a basis for conducting a binomial logistic regression with condition as a predictor variable. This will help you estimate the probability of success p in a single trial under each condition, separately for each variable.

Let's say you have two conditions only: C1 and C2. The above strategy will give you the estimated probability values phat(R, C1) and phat(R, C2) for the variable R, along with estimated probability values phat(D, C1) and phat(D, C2) for the variable R. You can now construct the ratio phat(R,C1)/phat(D,C1) and use it to estimate the true ratio p(R,C1)/p(D,C1). Similarly, you can construct the ratio phat(R,C2)/phat(D,C2) and use it to estimate the true ratio p(R,C2)/p(D,C2). Recall that p(R,C1) represents the (true) probability of success in a trial corresponding to the variable R under condition C1, etc.

You can then use bootstrapping to compute percentile confidence intervals for each of the two true ratios. If the confidence intervals exclude the value 1 for both conditions, that will suggest evidence of a difference between R and D at each condition. (With more than two conditions, you may need to do some multiplicity adjustments to your confidence intervals.) You may need to log transform the ratio first, then do bootstrapping and look at whether the resulting confidence interval excludes 0.

Of course, there is a problem with this approach if the variables R and D are correlated. See here, for example, for some references on how you might handle correlation between R and D in your modeling: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2798811/.

As always with research, you can start small and build from there.