confidence_interval#
- OddsRatioResult.confidence_interval(confidence_level=0.95, alternative='two-sided')[source]#
Confidence interval for the odds ratio.
- Parameters:
- confidence_level: float
Desired confidence level for the confidence interval. The value must be given as a fraction between 0 and 1. Default is 0.95 (meaning 95%).
- alternative{‘two-sided’, ‘less’, ‘greater’}, optional
The alternative hypothesis of the hypothesis test to which the confidence interval corresponds. That is, suppose the null hypothesis is that the true odds ratio equals
OR
and the confidence interval is(low, high)
. Then the following options for alternative are available (default is ‘two-sided’):‘two-sided’: the true odds ratio is not equal to
OR
. There is evidence against the null hypothesis at the chosen confidence_level ifhigh < OR
orlow > OR
.‘less’: the true odds ratio is less than
OR
. Thelow
end of the confidence interval is 0, and there is evidence against the null hypothesis at the chosen confidence_level ifhigh < OR
.‘greater’: the true odds ratio is greater than
OR
. Thehigh
end of the confidence interval isnp.inf
, and there is evidence against the null hypothesis at the chosen confidence_level iflow > OR
.
- Returns:
- ci
ConfidenceInterval
instance The confidence interval, represented as an object with attributes
low
andhigh
.
- ci
Notes
When kind is
'conditional'
, the limits of the confidence interval are the conditional “exact confidence limits” as described by Fisher [1]. The conditional odds ratio and confidence interval are also discussed in Section 4.1.2 of the text by Sahai and Khurshid [2].When kind is
'sample'
, the confidence interval is computed under the assumption that the logarithm of the odds ratio is normally distributed with standard error given by:se = sqrt(1/a + 1/b + 1/c + 1/d)
where
a
,b
,c
andd
are the elements of the contingency table. (See, for example, [2], section 3.1.3.2, or [3], section 2.3.3).References
[1]R. A. Fisher (1935), The logic of inductive inference, Journal of the Royal Statistical Society, Vol. 98, No. 1, pp. 39-82.
[2] (1,2)H. Sahai and A. Khurshid (1996), Statistics in Epidemiology: Methods, Techniques, and Applications, CRC Press LLC, Boca Raton, Florida.
[3]Alan Agresti, An Introduction to Categorical Data Analysis (second edition), Wiley, Hoboken, NJ, USA (2007).