*! version 1.1.0 01may2019

*! version 1.0.0 28apr2019

Title

getregstats -- Computes all values in a regression table when only the coefficient and one other statistic is available

Syntax

getregstats
#b
[,
model(string)
se(#)
df(#)
zstat(#)
pval(#)
lcl(#)
ucl(#)
level(#)
]

#b can be specified as a coefficient or exponentiated value (e.g. OR, HR, IRR)

model(string) specifies model type that produced the estimates. Choices are "lin", "exp", "or", "hr", "irr", "rr", or "rd"; default is mod(lin)

* se(#) specifies the standard error of the estimate

df(#) specifies the degrees of freedom if #b is t-distributed (e.g. when using regress to produce estimates)

* zstat(#) specifies the z-statistic (or t-statistic when used in conjunction with df)

* pval(#) specifies the p-value

* lcl(#) specifies the lower confidence limit

* ucl(#) specifies the upper confidence limit

level(#) set confidence level; default is level(95)

* one of these values must be specified.

Description

getregstats computes all the statistics reported in a regression table when the user specifies the coefficient and one other statistic.
This is useful in situations when a minimal amount of information is available, such as values reported in a journal article, or when
those statistics are not naturally provided by some other commands in Stata, such as csi.

getregstats is an immediate command, see immed.

Remarks

Regression models produce either linear coefficients (b) or those coefficients transformed via exponentiation exp(b)
(which are presented as odds ratios, hazard ratios, relative risks, etc.). As such, specifying model(lin) will produce
estimates from any model that produces linear coefficients, and specifying model(exp) will produce
estimates from any model that produces exponentiated coefficients. All other options in model() serve only to provide
a more specific descriptor for the user-provided (b) or exp(b) value.

Options

model(#) specifies the model type that produced the estimates. model() choices are "lin","exp", "or", "hr", "irr", "rr", or "rd",
which represent the following models, accordingly: linear, exponentiated, odds ratio, hazard ratio, incidence-rate ratio, risk ratio, risk difference;
default is mod(lin).

se(#) specifies the standard error of the estimate.

df(#) specifies the degrees of freedom if #b is t-distributed (e.g. when using regress to compute estimates).

zstat(#) specifies the z-statistic associated with the #b. However, when df() is specified, zstat() represents the t-statistic,
and is reported in the table as such.

pval(#) specifies the p-value.

lcl(#) specifies the lower confidence limit.

ucl(#) specifies the upper confidence limit.

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

Examples: linear regression

Setup

. sysuse auto

Fit a linear regression with regress

. regress mpg foreign weight

Use getregstats to reproduce all estimates for foreign, specifying only se(). As regress provides estimates assuming
the t-distribution, we also specify df(71) to reproduce these results.

. getregstats -1.6500291, se(1.0759941) df(71)

Fit the same model using glm, which assumes the z-distribution

. glm mpg foreign weight

Reproduce all estimates for foreign, specifying only zstat() (note that we do not specify df()).

. getregstats -1.6500291, z(-1.5334927)

Reproduce estimates for foreign after re-estimating model using regress with eform() option.

. regress mpg foreign weight, eform(Exp. Coef.)

. getregstats .1920443, se(.20663856) df(71) mod(exp)

Example: logistic regression

Setup

. webuse lbw

Fit a logistic regression model with logistic

. logistic low age lwt i.race smoke ptl ht ui

Reproduce all estimates for age, specifying p(). We also specify that the model produces odds ratios.

. getregstats .97326361, p(.45718868) mod(or)

Same as above, but specifying that the model produces exponentiated coefficients (produces exactly the same results).

. getregstats .97326361, p(.45718868) mod(exp)

Refit the logistic regression model, specifying now that the results be report as estimated coefficients.

. logistic low age lwt i.race smoke ptl ht ui, coef

Reproduce all estimates for age, specifying p(). We now specify that the model produces linear coefficients.

. getregstats -.0271003, p(.45718868) mod(lin)

Example: Poisson regression

Setup

. webuse dollhill3

Fit a Poisson regression model with incidence-rate ratios, using poisson

. poisson deaths smokes i.agecat, exposure(pyears) irr

Reproduce all estimates for smokes, specifying lcl(). We also specify that the model produces IRRs.

. getregstats 1.4255185, lcl(1.1549837) mod(irr)

Refit the Poisson regression model with the results being report as estimated coefficients.

. poisson deaths smokes i.agecat, exposure(pyears)

Reproduce all estimates for smokes, specifying lcl(). We now specify that the model produces linear coefficients.

. getregstats .3545356, lcl(.14408623) mod(lin)

Example: Cox regression

Setup

. webuse drugtr

Fit a Cox proportional hazards model, using stcox

. stcox drug age

Reproduce all estimates for drug, specifying ucl(). We also specify that the model produces HRs.

. getregstats .10487721, ucl(.25576221) mod(hr)

Refit the Cox proportional hazards model with the results being report as estimated coefficients.

. stcox drug age, nohr

Reproduce all estimates for drug, specifying ucl(). We now specify that the model produces linear coefficients.

. getregstats -2.254965, ucl(-1.3635071) mod(lin)

Examples: Tables for epidemiologists

Setup

. webuse csxmpl

Calculate risk differences, risk ratios, etc., using cs

. cs case exp [fw=pop], or woolf

Produce all estimates for the risk difference, specifying lcl(). We also specify that the model is an RD.

. getregstats -.4196429, lcl(-.7240828) mod(rd)

Produce all estimates for the risk ratio, specifying lcl(). We also specify that the model is an RR.

. getregstats .5104167, lcl(.2814332) mod(rr)

Produce all estimates for the odds ratio, specifying lcl(). We also specify that the model is an OR.

. getregstats .1296296, lcl(.0215685) mod(or)

Stored results

getregstats stores the following in r():

Scalars

r(b) coefficient (or exponentiated coefficient) as entered by user

r(se) standard error

r(z) z or t statistic (depending on model)

r(pval) p-value

r(lcl) lower confidence limit

r(ucl) upper confidence limit

Citation of getregstats

getregstats is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden A. (2019). GETREGSTATS: Stata module for computing all values in a regression table when only the coefficient and one other statistic is available.
Statistical Software Components, Boston College Department of Economics.

Authors

Ariel Linden

President, Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also see

Online: regress, glm, poisson, logistic, binreg, stcox, cs