Solved – Calculate z-score from odds-ratio

geneticsodds-ratio

I want to calculate the z-score for a distribution for which I know the odds-ratio, and the p-value. I also know the upper and lower 95% confidence limits for the odds-ratio. An example with two-data points is shown here.

OR       OR_95    OR_95U   p-value
0.997804 0.970573 1.025798 0.876215
1.039562 1.010116 1.069866 0.00815

Best Answer

Odds ratios standard errors, CIs, etc are calculated on the log of the odds.

Here's some R code. First we'll take the log of the odds:

OR <- 0.997804
ORL95 <- 0.970573

logor <- log(OR)
logorl95 <- log(ORL95)

Then calculate the difference between the odds ration and the lower (or upper, it doesn't matter, they're the same) confidence limit.

diff <- logor - logorl95

The confidence limit is 1.96 * se, so:

seor <- diff / 1.96

z is estimate / se.

z <- logor / seor
z

Let's calculate p, just to make sure we didn't make a foolish mistake along the way:

(1 - pnorm(abs(z))) * 2

Here are the important bits of the output:

> z 
[1] -0.155723

> (1 - pnorm(abs(z))) * 2
[1] 0.8762514