**[R] epitab** -- Tables for epidemiologists (tabodds)

__Syntax__

**tabodds** *var_case* [*expvar*] [*if*] [*in*] [*weight*] [**,** *tabodds_options*]

*tabodds_options* Description
-------------------------------------------------------------------------
Main
__b__**inomial(***varname***)** number of subjects variable
__l__**evel(***#***)** set confidence level; default is **level(95)**
**or** report odds ratio
__adj__**ust(***varlist***)** report odds ratios adjusted for the variables in
*varlist*
**base(***#***)** reference group of control variable for odds ratio
__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
__g__**raph** graph odds against categories
__ci__**plot** same as **graph** option, except include confidence
intervals

CI plot
__ciop__**ts(***rcap_options***)** affect rendition of the confidence bands

Plot
*marker_options* change look of markers (color, size, etc.)
*marker_label_options* add marker labels; change look or position
*cline_options* affect rendition of the plotted points

Add plots
**addplot(***plot***)** add other plots to the generated graph

Y axis, X axis, Titles, Legend, Overall
*twoway_options* any options other than **by()** documented in **[G-3]**
*twoway_options*
-------------------------------------------------------------------------
**fweight**s are allowed; see weight.

__Menu__

**Statistics > Epidemiology and related > Tables for epidemiologists >**
**Tabulate odds of failure by category**

__Description__

**tabodds** is used with case-control and cross-sectional data. It tabulates
the odds of failure against a categorical explanatory variable *expvar*.
If *expvar* is specified, **tabodds** performs an approximate chi-squared test
of homogeneity of odds and a test for linear trend of the log odds
against the numerical code used for the categories of *expvar*. Both tests
are based on the score statistic and its variance; see *Methods and*
*formulas*. When *expvar* is absent, the overall odds are reported. The
variable *var_case* is coded 0/1 for individual and simple frequency
records and equals the number of cases for binomial frequency records.

Optionally, **tabodds** tabulates adjusted or unadjusted odds ratios, using
either the lowest levels of *expvar* or a user-defined level as the
reference group. If **adjust(***varlist***)** is specified, it produces odds
ratios adjusted for the variables in *varlist* along with a (score) test
for trend.

__Options__

+------+
----+ Main +-------------------------------------------------------------

**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.

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

**or** specifies that odds ratios be produced; see **base()** for details about
selecting a reference category. By default, **tabodds** will calculate
odds.

**adjust(***varlist***)** specifies that odds ratios adjusted for the variables in
*varlist* be calculated.

**base(***#***)** specifies that the *#*th category of *expvar* be used as the
reference group for calculating odds ratios. If **base()** is not
specified, the first category, corresponding to the minimum value of
*expvar*, is used as the reference group.

**cornfield** requests that the Cornfield (1956) approximation be used to
calculate the confidence interval of the odds ratio. By default,
**tabodds** reports a standard-error-based interval, with the standard
error coming from the square root of the variance of the score
statistic.

**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, **tabodds** reports
a standard-error-based interval, with the standard error coming from
the square root of the variance of the score statistic.

**graph** produces a graph of the odds against the numerical code used for
the categories of *expvar*. All graph options except **connect()** are
allowed. This option is not allowed with either the **or** option or the
**adjust()** option.

**ciplot** produces the same plot as the **graph** option, except that it also
includes the confidence intervals. This option may not be used with
either the **or** option or the **adjust()** option.

+---------+
----+ CI plot +----------------------------------------------------------

**ciopts(***rcap_options***)** is allowed only with the **ciplot** option. It affects
the rendition of the confidence bands; see **[G-3]** *rcap_options*.

+------+
----+ Plot +-------------------------------------------------------------

*marker_options* affect the rendition of markers drawn at the plotted
points, including their shape, size, color, and outline; see **[G-3]**
*marker_options*.

*marker_label_options* specify if and how the markers are to be labeled;
see **[G-3]** *marker_label_options*.

*cline_options* affect whether lines connect the plotted points and the
rendition of those lines; see **[G-3]** *cline_options*.

+-----------+
----+ Add plots +--------------------------------------------------------

**addplot(***plot***)** provides a way to add other plots to the generated graph;
see **[G-3]** *addplot_option*.

+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

*twoway_options* are any of the options documented in **[G-3]** *twoway_options*,
excluding **by()**. These include options for titling the graph (see
**[G-3]** *title_options*) and for saving the graph to disk (see **[G-3]**
*saving_option*).

__Examples__

Setup
**. webuse bdesop**

Tabulate the odds of cancer against alcohol consumption
**. tabodds case alcohol [fw=freq]**

Same as above, but report odds ratios rather than odds
**. tabodds case alcohol [fw=freq], or**

Tabulate Mantel-Haenszel age-adjusted odds ratios
**. tabodds case alcohol [fw=freq], adjust(age)**

Same as above, but adjust for tobacco use instead of age
**. tabodds case alcohol [fw=freq], adjust(tobacco)**

__Stored results__

**tabodds** stores the following in **r()**:

Scalars
**r(odds)** odds
**r(lb_odds)** lower bound for **odds**
**r(ub_odds)** upper bound for **odds**
**r(chi2_hom)** chi-squared test of homogeneity
**r(p_hom)** p-value for test of homogeneity
**r(df_hom)** degrees of freedom for chi-squared test of homogeneity
**r(chi2_tr)** chi-squared for score test for trend
**r(p_trend)** p-value for score test for trend

__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.