Learn R Programming

EpiStats (version 1.6-2)

CC: 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")

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.

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

Author

jean.pierre.decorps@gmail.com

References

Stata 13: cc https://www.stata.com/manuals13/stepitab.pdf

See Also

CCTable, CCInter, CS, CSTable, CSInter

Examples

Run this code
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

Run the code above in your browser using DataLab