Code covered by the BSD License

### Highlights from Odds

5.0
5.0 | 1 rating Rate this file 8 Downloads (last 30 days) File Size: 3.48 KB File ID: #15347

# Odds

### Giuseppe Cardillo (view profile)

19 Jun 2007 (Updated )

Compute odds and risk ratio on 2x2 matrix

File Information
Description

This function calculates the Risk Ratio and the Odds Ratio (OR) on a 2x2 input matrix. Both ratios are computed with confidence intervals. If confidence interval of OR doesn't encompass the value OR=1, then the function computes the Bayesian Credibility Assessment of the test. If the test is credible, the function calculates the Association Parameter Phi. The association parameter Phi=sqrt(chisquare/N). The routine coumputes the Power and, if necessary, the sample sizes needed to achieve a power=0.80 using a modified asymptotic normal method with continuity correction as described by Hardeo Sahai and Anwer Khurshid in Statistics in Medicine, 1996, Vol. 15, Issue 1: 1-21.

Acknowledgements

This file inspired Forest Plot For Meta Analysis Or Sub Group Analysis.

MATLAB release MATLAB 7.3 (R2006b)
28 Mar 2013 Bruce Raine

### Bruce Raine (view profile)

Hi Giuseppe,

I do admit I messed up the arithmetic bit of my example and should have said:
so RR = (17/1707)/(7/1786) but my numeric answer was correct to 4d.p. I had 1779 instead of 1707.

But from the WIKI def of Risk Ratio (RR):

RR = [a/(a+b)]/[c/(c+d)]

then given RR, and using our data,
e.g. a=17,b=1690,c=7,d=1779
where a+b= 17+1690=1707
and c+d=7+1779=1886

...my input matrix must be
x1 = [ 17, 7;
1707, 1786];

which corresponds to:
(17/1707)/(7/1786)

I don't understand, and please forgive me , why I use this
matrix >> x=[17 1690;
7 1779];

It does not fit your ODDS header input example and does not fit the WIKI def. either.

Also is it possible to add P-values to the ODDS function?

Cheers,

Bruce

Comment only
27 Mar 2013 Giuseppe Cardillo

### Giuseppe Cardillo (view profile)

Look well the matrix you gave to odds!
you wrote x1 = [17, 7; 1707 1786];
so a=17, b=7, c=1707 and d=1786.
If you use the correct matrix of your example
>> x=[17 1690;7 1779];
>> odds(x)
Significance level: 95%

Risk Ratio: 1.0564<2.5410<6.1119
Absolute risk reduction: 0.6%
Relative risk reduction: 60.6%

Odds Ratio: 1.0575<2.5565<6.1801
Phi: 0.0331
Weak positive association (risk factor)

Bayesian Credibility Assessment
Critical Odds Ratio: 11.4919
OR<=COR. Test isn't credible at the 95%

alpha = 0.0500 n1 = 1707 n2 = 1786
Z1-b = 0.1982 Power (2-tails) = 0.5786

To achieve a recommended Power=0.80
n1 = 3203 (add 1496 subjects to exposed row)
n2 = 3351 (add 1565 subjects to not exposed row)

Comment only
26 Mar 2013 Bruce Raine

### Bruce Raine (view profile)

Hello Giuseppe,
I ran your ODDS function for a microbiologist's data set and we both feel after a little research that ODDS is producing an Odds Ratio rather than a Risk Ratio. Our definitions of Risk ratio and Odds ratio are backed up by WIKI as well and I include the links as well.

e.g.
>> x1 = [17, 7; 1707 1786];
>> odds(x1)
Significance level: 95%

Risk Ratio: 1.1188<1.4494<1.8779
Absolute risk reduction: 22.0%
Relative risk reduction: 31.0%

Odds Ratio: 1.0511<2.5410<6.1425
Phi: 0.0327
Weak positive association (risk factor)
...

You can see that 2.5410 is the Odds ratio according to the data but in fact this should be the Risk Ratio not the value
1.4494 as printed above from ODDS.

We base these assertions on some simple arithmetic backed up by WIKI defs: en.wikipedia.org/wiki/Relative_risk
i.e. Risk Ratio (RR) is defined as:

RR = [a/(a+b)]/[c/(c+d)]

So given this, using our data,
let a=17,b=1690,c=7,d=1779
so RR = (17/1779)/(7/1786) = 0.00996/0.00392 = 2.5410
This is what you have for Odds Ratio but but your Risk Ratio shows 1.4494, a quite different result to 2.5410

Also the Odds Ratio is defined here:
en.wikipedia.org/wiki/Odds_ratio#Example

p1/(1-p1)
---------
p2/(1-p2)

Using the same data as before:

17/1690 0.0100591
------- = --------- = 2.5565
7/1779 0.0039347

Again this is quite different to your ODDS function output for the Odds ratio which has 2.5410.

Are you able to please explain these discrepancies?

Regards,

Bruce

Comment only
22 Jun 2012 Qi An

### Qi An (view profile)

21 Jun 2007

Fix bug in confidence interval computation

05 Jul 2007

28 Aug 2007

updating power and sample sizes calculation

13 Sep 2007

I fixed a bug in standard error of log(RR) as suggested by Torsten Heyer

12 Jun 2008

NORMINV and NORMCDF was replaced by ERFCINV and ERFC so Statistics Toolbox is no more needed.

12 Nov 2008

Changes in help section

23 Dec 2009

Changes in description

18 Jun 2012

bug fixed in Relative Risk Standard Error computation