### EBM Stats Calculator

Note: This stats calculator requires JavaScript. Please ensure that you are using an up-to-date browser with JavaScript turned on. If you have technical difficulties, please contact david.newton@utoronto.ca.

The CEBM Statistics Calculator was created for your own personal use and testing purposes. It is to be used as a guide only. Medical decisions should NOT be based solely on the results of this program. Although this program has been tested thoroughly, the accuracy of the information cannot be guaranteed.

## CEBM Statistics Calculator

 A B C D LR+ LR-

### Results

Chi-squared — p-value: — — — — — — — — — — — — — — — — — — — — — — — ### Help

#### Getting Started

To perform a calculation, please choose a table type from the menu.

##### Table Type Options
Diagnostic Test
calculates the Sensitivity, Specificity, Positive Predictive Value (PPV), Negative Predictive Value (NPV), Likelihood Ratio + (LR+), and Likelihood Ratio – (LR-)
Prospective Study
calculates the Relative Risk (RR), Absolute Relative Risk (ARR), and Number Needed to Treat (NNT)
Case-control Study
calculates the Odds Ratio (OR)
Randomized Control Trial (RCT)
calculates the Relative Risk Reduction (RRR), Absolute Relative Risk (ARR), and Number Needed to Treat (NNT)

#### Equations

nr1 = a+b
nr2 = c+d
nc1 = a+c
nc2 = b+d
N = a + b + c + d
z = 1.959964

##### Diagnostic Test1,2,3
###### Sensitivity

Sensitivity = a/nc1
Lower limit = ((2×a) + z2 – z√( ( 4×a×c / nc1 ) + z2 )) / ((2×nc1) + (2×z2))
Upper limit = ((2×a) + z2 + z√( ( 4×a×c / nc1 ) + z2 )) / ((2×nc1) + (2×z2))

###### Specificity

Specificity = d/nc2
Lower limit = ((2×d) + z2 – z√( ( 4×d×b / nc2 ) + z2 )) / ((2×nc2) + (2×z2))
Upper limit = ((2×d) + z2 + z√( ( 4×d×b / nc2 ) + z2 )) / ((2×nc2) + (2×z2))

###### Positive Predictive Value (PPV)

PPV = a/nr1
Lower limit = ((2×a) + z2 – z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))
Upper limit = ((2×a) + z2 + z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))

###### Negative Predictive Value (NPV)

NPV = d/nr2
Lower limit = ((2×d) + z2 – z√( ( 4×d×c / nr2 ) + z2 )) / ((2×nr2) + (2×z2))
Upper limit = ((2×d) + z2 + z√( ( 4×d×c / nr2 ) + z2 )) / ((2×nr2) + (2×z2))

###### Likelihood Ratio +

LR+ = Sensitivity / (1 – Specificity)
Lower limit = exp ( ln( (nc2×a)/(nc1×b) ) – z√( ( c/(a×nc1) ) + ( d/(b×nc2) ) ) )
Upper limit = exp ( ln( (nc2×a)/(nc1×b) ) + z√( ( c/(a×nc1)) + ( d/(b×nc2) ) ) )

###### Likelihood Ratio –

LR+ = (1 – Sensitivity) / Specificity
Lower limit = exp ( ln( (nc2×c)/(nc1×d) ) – z√( ( a/(c×nc1) ) + ( b/(d×nc2) ) ) )
Upper limit = exp ( ln( (nc2×c)/(nc1×d) ) + z√( ( a/(c×nc1)) + ( b/(d×nc2) ) ) )

###### Pre-test Probability by Post-test Probability Plot

Plot PretestProb by PosttestProb(+) and PretestProb by PosttestProb(-).
PretestProb = a vector of values from 0 to 1.0 by 0.001 increments
PosttestProb(+) = (PretestOdds × LR+) / (1 + (PretestOdds × LR+))
PosttestProb(-) = (PretestOdds × LR-) / (1 + (PretestOdds × LR-))
where…
PretestOdds = PretestProb / (1 – PretestProb)

##### Prospective Study4, 5, 6
###### Chi-squared

Chi-squared = (N × ( | (a×d) – (b×c) | – (N / 2))2) / (nr1 × nr2 × nc1 × nc2)
p-value = Chi-squared density at 1 degree of freedom

###### Relative Risk (RR)

RR = (a × (c+d)) / (c × (a+b))
Lower limit = exp ( ln(RR) – z√( (1/c) – (1/(c+d)) + (1/a) – (1/(a+b)) )
Upper limit = exp ( ln(RR) + z√( (1/c) – (1/(c+d)) + (1/a) – (1/(a+b)) )

###### Absolute Risk Reduction (ARR)

ARR = (c/(c+d)) – (a/(a+b))
Lower limit = ARR – z√( (u2×(1-u2) / (a+b)) + (w1×(1-w1) / (c+d)) )
Upper limit = ARR + z√( (u1×(1-u1) / (c+d)) + (w2×(1-w2) / (a+b)) )
where…
u1 = ((2×c) + z2 + z√( ( 4×c×d / nr2 ) + z2 )) / ((2×nr2) + (2×z2))
u2 = ((2×a) + z2 + z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))
w1 = ((2×c) + z2 – z√( ( 4×c×d / nr2 ) + z2 )) / ((2×nr2) + (2×z2))
w2 = ((2×a) + z2 – z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))

###### Number Needed to Treat (NNT)

NNT = 1/ARR (rounded down to 0 decimal places)
Lower limit = 1 / ARR lower limit (rounded to 0 decimal places)
Upper limit = 1 / ARR upper limit (rounded to 0 decimal places)

##### Case-Control Study4,7
###### Chi-squared

Chi-squared = (N × ( | (a×d) – (b×c) | – (N / 2))2) / (nr1 × nr2 × nc1 × nc2)
p-value = Chi-squared density at 1 degree of freedom

###### Odds Ratio (OR)

OR = (a × d) / (b × c)
Lower limit = exp ( ln(OR) – z√( (1/a) + (1/b) + (1/c) + (1/d) )
Upper limit = exp ( ln(OR) + z√( (1/a) + (1/b) + (1/c) + (1/d) )

##### Randomized Controlled Trial (RCT)4,6
###### Chi-squared

Chi-squared = (N × ( | (a×d) – (b×c) | – (N / 2))2) / (nr1 × nr2 × nc1 × nc2)
p-value = Chi-squared density at 1 degree of freedom

###### Relative Risk Reduction (RRR)

RRR = ((c / (c+d)) – (a / (a+b))) / (c / (c+d))
Lower limit = 1 – ( exp( ln( (a × (c+d)) / (c × (a+b)) ) + z√( (1/c) – (1/(c+d)) + (1/a) – (1/(a+b)) ) ) )
Upper limit = 1 – ( exp( ln( (a × (c+d)) / (c × (a+b)) ) – z√( (1/c) – (1/(c+d)) + (1/a) – (1/(a+b)) ) ) )

###### Absolute Risk Reduction (ARR)

ARR = (c/(c+d)) – (a/(a+b))
Lower limit = ARR – z√( (u2×(1-u2) / (a+b)) + (w1×(1-w1) / (c+d)) )
Upper limit = ARR + z√( (u1×(1-u1) / (c+d)) + (w2×(1-w2) / (a+b)) )
where…
u1 = ((2×c) + z2 + z√( ( 4×c×d / nr2 ) + z2 )) / ((2×nr2) + (2×z2))
u2 = ((2×a) + z2 + z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))
w1 = ((2×c) + z2 – z√( ( 4×c×d / nr2 ) + z2 )) / ((2×nr2) + (2×z2))
w2 = ((2×a) + z2 – z√( ( 4×a×b / nr1 ) + z2 )) / ((2×nr1) + (2×z2))

###### Number Needed to Treat (NNT)

NNT = 1/ARR (rounded down to 0 decimal places)
Lower limit = 1 / ARR lower limit (rounded to 0 decimal places)
Upper limit = 1 / ARR upper limit (rounded to 0 decimal places)

##### References

For full references, see the Credits & References section.

1. Wilson (1927)
95% confidence interval for sensitivity, specificity, PPV and NPV
2. Newcombe (1998a)
95% confidence interval for sensitivity, specificity, PPV and NPV
3. Simel et al (1991)
95% confidence interval for LR+ and LR-
4. Yates (1934)
Chi-squared
5. Armitage & Berry (1994)
95% confidence interval for RR
6. Newcombe (1998b)
95% confidence interval for ARR
7. Bland & Altman (2000)
95% confidence interval for OR

#### Troubleshooting

If you encounter an error, it is most likely because invalid (i.e. non-numeric) data was entered, or because the data you entered forced an equation to attempt to divide by zero. In either case, try modifying your input.

#### Credits

CEBM Statistics Calculator © 2004-2010 CEBM.

Statisticians
Farah Khandwala, Kevin Thorpe
Developer
David Newton
Based on the Java CEBM Statistics Calculator by
Peter Wong
SAJAX Simple AJAX Toolkit by
MODERNMETHOD; used under the BSD license
The Probability Distribution Library (PDL) (a descendant of the JSci Project source tree) by
Meagher et al; used under the GNU Lesser General Public License

#### References

1. Wilson, E. B. “Probable inference, the law of succession, and statistical inference,” Journal of the American Statistical Association 22: 209-212, 1927.
2. Newcombe, RG. “Two-Sided Confidence Intervals for the Single Proportion: Comparison of Seven Methods,” Statistics in Medicine17: 857-872, 1998 (a).
3. Simel DL, Samsa GP, Matchar DB. “Likelihood ratios with confidence: sample size estimation for diagnostic test studies,” Journal of Clinical Epidemiology 44: 763-70, 1991.
4. Yates, F. “Contingency table involving small numbers and the Χ2 test,” Journal of the Royal Statistical Society (Supplement) 1: 217-235, 1934.
5. Armitage P and Berry G. Statistical Methods in Medical Research (3rd ed.), Blackwell, 1994.
6. Newcombe RG. “Interval estimation for the difference between independent proportions: Comparison of eleven methods,” Statistics in Medicine 17: 873-890, 1998 (b).
7. Bland JM and Altman DG. “The odds ratio,” British Medical Journal Statistics Notes 320: 1468, 2000.