# Calculate z-score from odds-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

• "Z score" of what? (By "distribution" surely you mean data, so what you have is an estimated odds ratio (and its p-value).) And what is the second row of statistics you show? A second example? – whuber Sep 6 '13 at 18:43

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

• In case you want more detail, this is covered in Agresti's An Introduction to Categorical Data Analysis. – Sycorax says Reinstate Monica Sep 6 '13 at 19:06
• Thanks! Does it matter if the odds-ratios are greater than or less than 1? For the second data point I know the Z is 2.185, however when I try to follow the directions you stated above, the answers do not seem to match. Am I misunderstanding something? – sanyal Sep 6 '13 at 19:41
• I'm not sure if you're misunderstanding, but that Z is not correct. If Z is 2.185 then p is not 0.008. A z of 2.185 gives p of 0.029. (Zs of tour 2, 2.5 and 3.3 give ps of tour 0.05, 0.01, 0.001.) – Jeremy Miles Sep 7 '13 at 0:21