CC {EpiStats} | R Documentation |
Univariate analysis of case control studies
Description
CC is used with case-control studies to determine the association between an exposure and an outcome. Note that all variables need to be numeric and binary and coded as "0" and "1". Point estimates and confidence intervals for the odds ratio are calculated, along with attributable or prevented fractions for the exposed and total population.
Additionally you can select if you want to display the Fisher's exact test, by specifying exact = TRUE.
If you specify full = TRUE you can easily access useful statistics from the output tables.
Usage
CC(data, cases, exposure, exact = FALSE, full = FALSE, title = "CC")
Arguments
data |
data.frame |
cases |
character - Case variable |
exposure |
character - Exposure variable |
exact |
boolean - TRUE if you would like to display Fisher's exact p-value |
full |
boolean - TRUE if you need to display useful statistics and values for formatting |
title |
character - title of tables |
Value
list:
df1 |
data.frame - two by two table |
df2 |
data.frame - statistics |
df1.align |
character - alignment for kable/xtable |
df2.align |
character - alignment for kable/xtable |
df1.digits |
integer vector - digit number displayed for kable/xtable |
df2.digits |
integer vector - digit number displayed for kable/xtable |
st |
list - individual statistics |
The item st returns the odds ratio and its 95 percent confidence intervals, the attributable fraction among the exposed and its 95 percent confidence intervals, the attributable fraction among the population and its 95 percent confidence intervals, the Chi square value, the Chi square p-value and the Fisher's exact test p-value.
Note
You can use the lowercase command "cc" in place of "CC"
Please note also that when the outcome is frequent the odds ratio will overestimate the risk ratio (if OR>1) or underestimate the risk ratio (OR<1). If the outcome is rare, the risk ratio and the odds ratio are similiar.
In a case control study, the attributable fraction among the exposed and among the population assume that the OR approximates the risk ratio.
Please interpret all measures with caution.
Author(s)
jean.pierre.decorps@gmail.com
References
Stata 13: cc https://www.stata.com/manuals13/stepitab.pdf
See Also
CCTable, CCInter, CS, CSTable, CSInter
Examples
library(EpiStats)
# Dataset by Anja Hauri, RKI.
data(Tiramisu)
DF <- Tiramisu
# The CC command looks at the association between the outcome variable "ill"
# and an exposure "mousse"
CC(DF, "ill", "mousse")
# The option exact = TRUE provides Fisher's exact test p-values
CC(DF, "ill", "mousse", exact = TRUE)
# With the option full = TRUE you can easily use individual elements of the results:
result <- CC(DF, "ill", "mousse", full = TRUE)
result$st$odds_ratio$point_estimate