Odds ratio and relative risk | R Documentation |
Odds ratio and relative risk.
odds.ratio(x, a = 0.05, logged = FALSE)
rel.risk(x, a = 0.05, logged = FALSE)
x |
A 2 x 2 matrix or a vector with 4 elements. In the case of the vector make sure it corresponds to the correct table. |
a |
The significance level, set to 0.05 by default. |
logged |
Should the p-values be returned (FALSE) or their logarithm (TRUE)? |
The odds ratio and the confidence interval are calculated.
A list including:
res |
The estimated odds ratio and the p-value for the null hypothesis test that it is equal to 1. |
ci |
The (1-a)% confidence interval for the true value of the odds ratio. |
Michail Tsagris
R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr>.
Mosteller Frederick (1968). Association and Estimation in Contingency Tables. Journal of the American Statistical Association. 63(321):1-28.
Edwards A.W.F. (1963). The measure of association in a 2x2 table. Journal of the Royal Statistical Society, Series A. 126(1):109-114.
odds, g2Test
x <- rpois(4, 30)+2
res<-odds.ratio(x)
res<-odds.ratio( matrix(x, ncol = 2) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.