Stata 15 help for mhodds

[R] epitab -- Tables for epidemiologists (mhodds)


mhodds var_case expvar [vars_adjust] [if] [in] [weight] [, mhodds_options]

mhodds_options Description ------------------------------------------------------------------------- Options by(varlist [, missing]) stratify on varlist binomial(varname) number of subjects variable compare(v_1, v_2) override categories of the control variable level(#) set confidence level; default is level(95) ------------------------------------------------------------------------- fweights are allowed; see weight.


Statistics > Epidemiology and related > Tables for epidemiologists > Ratio of odds of failure for two categories


mhodds is used with case-control and cross-sectional data. It estimates the ratio of the odds of failure for two categories of expvar, controlled for specified confounding variables, vars_adjust, and tests whether this odds ratio is equal to one. When expvar has more than two categories but none are specified with the compare() option, mhodds assumes that expvar is a quantitative variable and calculates a 1-degree-of-freedom test for trend. It also calculates an approximate estimate of the log odds-ratio for a one-unit increase in expvar. This is a one-step Newton-Raphson approximation to the maximum likelihood estimate calculated as the ratio of the score statistic, U, to its variance, V (Clayton and Hills 1993, 103).


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

by(varlist [, missing]) specifies that the tables be stratified on varlist. Missing categories in varlist 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.

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.

compare(v_1,v_2) indicates the categories of expvar to be compared; v_1 defines the numerator and v_2, the denominator. When compare() is not specified and there are only two categories, the second is compared to the first; when there are more than two categories, an approximate estimate of the odds ratio for a unit increase in expvar, controlled for specified confounding variables, is given.

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


Setup . webuse bdesop

Calculate the odds ratio for the effect of alcohol controlled for age . mhodds case alcohol agegrp [fw=freq]

Same as above, but perform the calculation by levels of tobacco consumption . mhodds case alcohol agegrp [fw=freq], by(tobacco)

Calculate the odds ratio for the effect of tobacco controlled for age by levels of alcohol consumption . mhodds case tobacco agegrp [fw=freq], by(alcohol)

Create a new variable with levels corresponding to all combinations of alcohol and tobacco consumption . egen alctob = group(alcohol tobacco)

Calculate the odds ratio for the effect of the highest level of alcohol and tobacco consumption versus the lowest . mhodds case alctob [fw=freq], compare(16,1)

Stored results

mhodds stores the following in r():

Scalars r(p) two-sided p-value r(or) odds ratio r(lb_or) lower bound of CI for or r(ub_or) upper bound of CI for or r(chi2_hom) chi-squared test of homogeneity r(df_hom) degrees of freedom for chi-squared test of homogeneity r(chi2) chi-squared


Clayton, D. G., and M. Hills. 1993. Statistical Models in Epidemiology. Oxford: Oxford University Press.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index