CS: Univariate analysis of cohort study measuring risk

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/CS_.R

Description

CS analyses cohort studies with equal follow-up time per subject. The risk (the proportion of individuals who become cases) is calculated overall and among the exposed and unexposed. Note that all variables need to be numeric and binary and coded as "0" and "1".

Point estimates and confidence intervals for the risk ratio and risk difference are calculated, along with attributable or preventive fractions for the exposed and the 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

1
CS(x, cases, exposure, exact = F, full = FALSE, title = "CS")

Arguments

x

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

st

list - individual statistics

df1.digits

integer vector - digit number displayed for kable/xtable

df2.digits

integer vector - digit number displayed for kable/xtable

df2.align

character - alignment for kable/xtable

The item st returns the risk difference and its 95 percent confidence intervals, the risk 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 "cs" in place of "CS"

Author(s)

jean.pierre.decorps@gmail.com

References

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

See Also

CSTable, CSInter, CC, CCTable, CCInter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(EpiStats)

# Dataset by Anja Hauri, RKI.
# Dataset provided with package.
data(Tiramisu)
DF <- Tiramisu

# The CS command looks at the association between the outcome variable "ill"
# and an exposure "mousse"
CS(DF, "ill", "mousse")

# The option exact = TRUE provides Fisher's exact test p-values
CS(DF, "ill", "mousse", exact = TRUE)

# With the option full = TRUE you can easily use individual elements of the results:
result <- CS(DF, "ill", "mousse", full = TRUE)
result$st$risk_ratio$point_estimate

EpiStats documentation built on June 7, 2021, 5:06 p.m.