Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.

Wednesday, June 18, 2014

Test for a Difference in Two Odds Ratios

Testing for a statistical difference between two odds ratio estimates can be useful in determining if an association has statistically different effects in different groups or strata of a variable.  For example, maybe an association is stronger for older individuals than younger individuals.  To test for such a difference we need the odds ratio estimate (or more precisely the natural log of the odds ratio estimate, aka the beta estimate from a logistic regression) and the standard error of the log odds ratio.

If you don't have access to the primary data and need to estimate the standard error from a 95% confidence interval (95% CI), see this blog entry.  If you have forgotten how to calculate the standard error of the log odds ratio use this formula:
SE(logOR)=1n1+1n2+1n3+1n4

To test if two odds ratios are significantly different and get a p-value for the difference follow these steps:
(1) Take the absolute value of the difference between the two log odds ratios. We will call this value δ.
(2) Calculate the standard error for δ, SE(δ), using the formula:
SE21+SE22

(3) Calculate the Z score for the test: z=δ/SE(δ)
(4) Calculate the p-value from the z score. The p-value can be easily calculated in R or Microsoft Excel using the below formulas.

R: P-value=2*(1-pnorm(Z))
MS Excel: P-value=2*(1-(NORMDIST(Z,0,1,TRUE)))