relative.risk {BioProbability} | R Documentation |
Relative risk calculation
Description
This function calculates the relative risk from a contingency table. Furthermore, a confidence interval for the relative risk is provided. Details on the confidence interval can be found in Agresti (2018, ISBN: 978-1-119-40528-3).
Usage
relative.risk(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 Relative Risk
corresponds to the estimation of the relative risk; 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 relative risk.
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)
relative.risk(A,show.matrix=TRUE,conf.int=TRUE)
relative.risk(A,show.matrix=TRUE,conf.int=TRUE,level=0.1)