# Can I get an Odds Ratio (or other effect size) from two proportions and a p-value?

I am conducting a meta analysis that is comparing dichotomous outcomes for two groups. So for each study, I have the proportion of the outcome for both groups and the sample size of each group, and I am using Comprehensive Meta Analysis software to get the odds ratio for each.

One study that I would like to include if possible only provided the proportions (42% in group A and 51% in group B) and the p-value (p=.03). I believe he p-value only depends on the proportion and sample size (which is all you need to construct a 2x2 contingency table), so I would assume one could reverse engineer the sample size from the p-value. However, I have not found a formula to do so, and it is not an option in my software to enter this data (though it includes many other options like "chi-square and sample size" or "sample size and p-value"). I'm not sure if perhaps you'd need to know the test they used as well, like Z-test for proportions or fisher's exact test.

Does anyone know how to reverse-compute the sample size given this data? I know that a study that didn't even report the overall sample size is not a great paper (non-peer reviewed journal), but we want our meta-analysis to be comprehensive and include everything out there, included unpublished (and thus also not peer-reviewed) studies.

• The odds ratio (or rather log-transformed odds ratio) is easy to get, since you have the two proportions: $OR = (.42/(1-.42))/(.51/(1-.51)) = .696$ (assuming you want the OR for group A versus B and not ther other way around). And then $log(OR) = -.363$. The more difficult part is getting the sampling variance or standard error of the log-transformed odds ratio. Can you assume that group A and groupp B are (roughly) of equal size? Jun 27, 2015 at 7:03
• Thanks! That makes sense about the OR - I was calculating them all as a 2x2 contingency table, forgetting I could use just the proportions. But you're right that the SE is the harder part, which I would still need to include in the meta analysis (or estimating the sample size, and then I could move forward). Yes, we can assume they are roughly equal. In fact, for any study where people are randomized into the two groups and they don't explicitly say how many are in each condition, we just assume the groups are exactly the same, which we can do here as well. Jun 28, 2015 at 19:12
• Under that assumption, it's then also possible to figure out the SE. Or better yet, you can figure out the entire table and then enter that into the software, which will compute things for you. Jun 28, 2015 at 21:18

Assuming that the p-value reported is based on a chi-square test of independence (which is equivalent to the standard test of the equality of the two proportions) and assuming that the two groups are of equal size, we can indeed figure out (at least approximately) what the original data looked like.

### total sample size (determined via trial-and-error)
n <- 622

### observed proportions
p1 <- .42
p2 <- .51

### create 2x2 contingency table
tab <- round(matrix(c(p1*n/2, (1-p1)*n/2, p2*n/2, (1-p2)*n/2), byrow=TRUE, nrow=2))
tab


This yields:

     [,1] [,2]
[1,]  131  180
[2,]  159  152


Now let's apply the chi-square test:

chisq.test(tab)


This yields:

        Pearson's Chi-squared test with Yates' continuity correction

data:  tab
X-squared = 4.7096, df = 1, p-value = 0.03


There is that p-value of 0.03. And the OR is then:

(tab[1,1] * tab[2,2]) / (tab[1,2] * tab[2,1])


Which is:

 0.6957372


If one wants to be fancy, one can easily write a function that determines n via a simple root-finding algorithm automatically. But for a one-shot application, it's easy to determine n via trial-and-error.

Also note that the table obtained may only approximate the real data. The reported proportions and p-value are likely to be rounded, which introduces some uncertainty. But this should give you something close enough to work with.

• Thank you! This answers my question, but I wonder if you might post your trial and error steps for others that come across this later. In particular, did you write a function where a user could insert an n to test that would spit out a p-value? I haven't quite gotten the hang of writing functions in r yet, but I imagine it would be something like 'chisq.test(round(matrix(c(p1*x/2, (1-p1)*x/2, p2*x/2, (1-p2)*x/2), byrow=TRUE, nrow=2))', where a person would replace p1 and p2 with their numbers, and then use the function with various values of X to narrow down based on the outputted p value. Jun 30, 2015 at 18:09
• No, I did not use a function. I just started with some guess about n and then increased/decreased the value until the resulting 2x2 table yielded the correct p-value when using the chi-square test. Same thing can be done for different p1 and p2 values. Jun 30, 2015 at 19:47