Given the odds ratio (OR), we will calculate the individual cells in the contingency table (a,b,c,d).
In yellow, I’ve highlighted what is known.
a,b,c, and d are unknown and what we want to calculate.
Odds Ratio = (a/c) / (b/d)
Cases | Controls | Total | |
---|---|---|---|
Exposed | a | b | total_exposed (a+b) |
Unexposed | c | d | total_unexposed (c+d) |
Total | total_cases (a+c) |
total_controls (b+d) |
total_participants |
If you’re getting the OR from a paper, the paper usually has total_exposed, total_unexposed, total_cases,and total_participants.
In that case, you can derive a, b, c, and d.
Solving for a:
Cases | Controls | Total | |
---|---|---|---|
Exposed | a | total_exposed – a | total_exposed (a+b) |
Unexposed | total_cases – a | total_unexposed – total_cases + a | total_unexposed (c+d) |
Total | total_cases (a+c) | total_controls (b+d) | total_participants |
So now, the equation for OR can be written in terms of a and the known numbers :
OR = (a * d) / (b * c)
OR = (a * (total_unexposed – total_cases + a)) / ((total_exposed – a) * (total_cases – a))
If you have the values for OR, total_exposed, total_unexposed, total_cases, and total_controls, you can solve for a</i> using the quadratic formula.
Once you solve for a, solving for b, c, and d is trivial.
Try it out!
I came across this problem when reading an Alzheimer’s paper.
Looking at ApoE ε4 carriers (n=452), smokers have an OR of 1.97 for dementia compared to non-smokers.
Because this was a population study, I wanted to know how many smokers got dementia, and how many non-smokers got dementia. If I got the individual cells, I could calculate this.
Out of the 452 ApoE ε4 carriers, 207 were smokers (45.8% of 452) and 31 had dementia (6.9% of 452).
From this,
- OR = 1.97
- total_exposed = 207
- total_unexposed = 245
- total cases (those with dementia) = 31
- total controls (without dementia) = 421
I plugged in the above calculator to get:
Dementia | Non-Dementia | Total | |
---|---|---|---|
Smoking | 19 | 188 | 207 |
Non-smoking | 12 | 233 | 245 |
Total | 31 | 421 | 452 |
In this population-based study, 9% (19/207) of the smokers had dementia while 5% (12/245) of the nonsmokers had dementia.