**[R] epitab** -- Tables for epidemiologists (cc and cci)

__Syntax__

**cc** *var_case var_exposed* [*if*] [*in*] [*weight*] [**,** *cc_options*]

**cci** *#a #b #c #d* [**,** *cci_options*]

*cc_options* Description
-------------------------------------------------------------------------
Options
**by(***varname* [**,** __mis__**sing**]**)** stratify on *varname*
__es__**tandard** combine external weights with within-stratum
statistics
__is__**tandard** combine internal weights with within-stratum
statistics
__s__**tandard(***varname***)** combine user-specified weights with
within-stratum statistics
__p__**ool** display pooled estimate
__noc__**rude** do not display crude estimate
__noh__**om** do not display homogeneity test
**bd** perform Breslow-Day homogeneity test
__t__**arone** perform Tarone's homogeneity test
__b__**inomial(***varname***)** number of subjects variable
__co__**rnfield** use Cornfield approximation to calculate CI of
the odds ratio
__w__**oolf** use Woolf approximation to calculate SE and CI
of the odds ratio
__e__**xact** calculate Fisher's exact p
__l__**evel(***#***)** set confidence level; default is **level(95)**
-------------------------------------------------------------------------

*cci_options* Description
-------------------------------------------------------------------------
__co__**rnfield** use Cornfield approximation to calculate CI of the
odds ratio
__w__**oolf** use Woolf approximation to calculate SE and CI of
the odds ratio
__e__**xact** calculate Fisher's exact p
__l__**evel(***#***)** set confidence level; default is **level(95)**
-------------------------------------------------------------------------
**fweight**s are allowed; see weight.

__Menu__

__cc__

**Statistics > Epidemiology and related > Tables for epidemiologists >**
**Case-control odds ratio**

__cci__

**Statistics > Epidemiology and related > Tables for epidemiologists >**
**Case-control odds-ratio calculator**

__Description__

**cc** is used with case-control and cross-sectional data. It calculates
point estimates and confidence intervals for the odds ratio, along with
attributable or prevented fractions for the exposed and total population.
**cci** is the immediate form of **cc**; see immed. Also see **[R] logistic** for
related commands.

__Options for cc__

+---------+
----+ Options +----------------------------------------------------------

**by(***varname* [**,** **missing**]**)** specifies that the tables be stratified on
*varname*. Missing categories in *varname* are omitted from the
stratified analysis, unless option **missing** is specified within **by()**.
Within-stratum statistics are shown and then combined with
Mantel-Haenszel weights. If **estandard**, **istandard**, or **standard()** is
also specified (see below), the weights specified are used in place
of Mantel-Haenszel weights.

**estandard**, **istandard**, and **standard(***varname***)** request that within-stratum
statistics be combined with external, internal, or user-specified
weights to produce a standardized estimate. These options are
mutually exclusive and can be used only when **by()** is also specified.
(When **by()** is specified without one of these options, Mantel-Haenszel
weights are used.)

**estandard** external weights are the number of unexposed controls.

**istandard** internal weights are the number of exposed controls.
**istandard** can be used to produce, among other things, standardized
mortality ratios (SMRs).

**standard(***varname***)** allows user-specified weights. *varname* must
contain a constant within stratum and be nonnegative. The scale of
*varname* is irrelevant.

**pool** specifies that, in a stratified analysis, the directly pooled
estimate also be displayed. The pooled estimate is a weighted
average of the stratum-specific estimates using inverse-variance
weights, which are the inverse of the variance of the
stratum-specific estimate. **pool** is relevant only if **by()** is also
specified.

**nocrude** specifies that in a stratified analysis the crude estimate -- an
estimate obtained without regard to strata -- not be displayed.
**nocrude** is relevant only if **by()** is also specified.

**nohom** specifies that a chi-squared test of homogeneity not be included in
the output of a stratified analysis. This tests whether the exposure
effect is the same across strata and can be performed for any pooled
estimate -- directly pooled or Mantel-Haenszel. **nohom** is relevant
only if **by()** is also specified.

**bd** specifies that Breslow and Day's chi-squared test of homogeneity be
included in the output of a stratified analysis. This tests whether
the exposure effect is the same across strata. **bd** is relevant only
if **by()** is also specified.

**tarone** specifies that Tarone's chi-squared test of homogeneity, which is
a correction to the Breslow-Day test, be included in the output of a
stratified analysis. This tests whether the exposure effect is the
same across strata. **tarone** is relevant only if **by()** is also
specified.

**binomial(***varname***)** supplies the number of subjects (cases plus controls)
for binomial frequency records. For individual and simple frequency
records, this option is not used.

**cornfield** requests that the Cornfield (1956) approximation be used to
calculate the confidence interval of the odds ratio. By default, **cc**
reports an exact interval.

**woolf** requests that the Woolf (1955) approximation, also known as the
Taylor expansion, be used for calculating the standard error and
confidence interval for the odds ratio. By default, **cc** reports an
exact interval.

**exact** requests that Fisher's exact p be calculated rather than the
chi-squared and its significance level. We recommend specifying
**exact** whenever samples are small. When the least-frequent cell
contains 1,000 cases or more, there will be no appreciable difference
between the exact significance level and the significance level based
on the chi-squared, but the exact significance level will take
considerably longer to calculate. **exact** does not affect whether
exact confidence intervals are calculated. Commands always calculate
exact confidence intervals where they can, unless **cornfield** or **woolf**
is specified.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

__Options for cci__

**cornfield** requests that the Cornfield (1956) approximation be used to
calculate the confidence interval of the odds ratio. By default, **cci**
reports an exact interval.

**woolf** requests that the Woolf (1955) approximation, also known as the
Taylor expansion, be used for calculating the standard error and
confidence interval for the odds ratio. By default, **cci** reports an
exact interval.

**exact** requests that Fisher's exact p be calculated rather than the
chi-squared and its significance level. We recommend specifying
**exact** whenever samples are small. When the least-frequent cell
contains 1,000 cases or more, there will be no appreciable difference
between the exact significance level and the significance level based
on the chi-squared, but the exact significance level will take
considerably longer to calculate. **exact** does not affect whether
exact confidence intervals are calculated. Commands always calculate
exact confidence intervals where they can, unless **cornfield** or **woolf**
is specified.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

__Examples__

---------------------------------------------------------------------------
Setup
**. webuse ccxmpl**

List the data
**. list**

Calculate odds ratio, etc.
**. cc case exposed [fw=pop]**

Immediate form of above command
**. cci 4 386 4 1250**

Same as above, but calculate Fisher's exact p rather than the chi-squared
**. cci 4 386 4 1250, exact**

---------------------------------------------------------------------------
Setup
**. webuse downs**

List the data
**. list**

Perform stratified analysis of the odds ratio
**. cc case exposed [fw=pop], by(age)**

Same as above, but report Tarone's chi-squared test of homogeneity
**. cc case exposed [fw=pop], by(age) tarone**
---------------------------------------------------------------------------

__Video examples__

Odds ratios for case-control data

Stratified analysis of case-control data

Odds ratios calculator

__Stored results__

**cc** and **cci** store the following in **r()**:

Scalars
**r(p)** two-sided p-value
**r(p1_exact)** one-sided p-value for Fisher's exact test
**r(p_exact)** two-sided p-value for Fisher's exact test
**r(or)** odds ratio
**r(lb_or)** lower bound of CI for **or**
**r(ub_or)** upper bound of CI for **or**
**r(afe)** attributable (prev.) fraction among exposed
**r(lb_afe)** lower bound of CI for **afe**
**r(ub_afe)** upper bound of CI for **afe**
**r(afp)** attributable fraction for the population
**r(crude)** crude estimate (**cc** only)
**r(lb_crude)** lower bound of CI for **crude**
**r(ub_crude)** upper bound of CI for **crude**
**r(pooled)** pooled estimate (**cc** only)
**r(lb_pooled)** lower bound of CI for **pooled**
**r(ub_pooled)** upper bound of CI for **pooled**
**r(chi2_p)** pooled heterogeneity chi-squared
**r(chi2_bd)** Breslow-Day chi-squared
**r(df_bd)** degrees of freedom for Breslow-Day chi-squared
**r(chi2_t)** Tarone chi-squared
**r(df_t)** degrees of freedom for Tarone chi-squared
**r(df)** degrees of freedom
**r(chi2)** chi-squared

__References__

Cornfield, J. 1956. A statistical problem arising from retrospective
studies. In Vol. 4 of *Proceedings of the Third Berkeley Symposium*,
ed. J. Neyman, 135-148. Berkeley, CA: University of California
Press.

Woolf, B. 1955. On estimating the relation between blood group disease.
*Annals of Human Genetics* 19: 251-253. Reprinted in *Evolution of*
*Epidemiologic Ideas: Annotated Readings on Concepts and Methods*, ed.
S. Greenland, pp. 108-110. Newton Lower Falls, MA: Epidemiology
Resources.