odds.ratio {BioProbability}R Documentation

Odds ratio calculation

Description

This function calculates the odds ratio from a contingency table. Furthermore, a confidence interval for the odds ratio is provided. Details on the confidence interval can be found in Agresti (2018, ISBN: 978-1-119-40528-3).

Usage

odds.ratio(A, show.matrix = FALSE, conf.int = FALSE, level = 0.05)

Arguments

A

a 2x2 matrix object where A[1,1] contains the number of people with the disease who have been exposed to some condition; A[1,2], the number of people without the disease who have not been exposed this condition; A[2,1], the number of people with the disease who have been exposed to the condition; A[2,2], the number of people without the disease who have not been exposed to some condition.

show.matrix

a logical value indicating whether the matrix A must be shown.

conf.int

a logical value indicating whether a confidence interval for the relative risk must be calculated.

level

level of significance for the confidence interval.

Value

If conf.int=TRUE, a list of length equal to two. The first element of the list Odds Ratio corresponds to the estimation of the odds ratio; the second one Confidence Interval of level contains the corresponding confidence interval.

If conf.int=FALSE, a numeric value corresponding to the estimation of the odds ratio.

References

Agresti, A. (2018). An introduction to categorical data analysis. John Wiley & Sons. ISBN: 978-1-119-40528-3.

Examples

A<-matrix(c(744,231,421,659),nrow=2)
odds.ratio(A,show.matrix=TRUE,conf.int=TRUE)

[Package BioProbability version 1.0 Index]