*! version 1.2.7 25sep2023

Title

xlincom -- Multiple linear combinations of parameters

Syntax

Single combination

xlincom [name=]exp [, options]

Multiple combinations

xlincom ([name=]exp) [([name=]exp) ...] [, options]

post post estimation results

repost add results to estimates in memory

covzero set all covariances to zero

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

df(#) use t distribution with # degrees of freedom for
computing p-values and confidence intervals

noheader suppress output header

eform exponentiated coefficients; exp(b)

or odds ratio

hr hazard ratio

shr subhazard ratio

irr incidence-rate ratio

rrr relative-risk ratio

display_options control column formats

exp is a linear expression containing
coef
eqno:coef
_b[coef]
_b[eqno:coef]
[eqno]coef
[eqno]_b[coef]

eqno is
##
name

exp is any linear combination of coefficients that is valid
syntax for lincom. An optional name may be specified to label
the transformation; name can be any valid Stata name.

Description

xlincom computes point estimates, standard errors, t or z statistics,
p-values, and confidence intervals for single or multiple linear combinations of coefficients
as well as covariances in the case of multiple combinations. nlcom can also do this,
but xlincom is much faster and offers the same syntax as lincom. xlincom
internally calls lincom for each linear combination and extracts coefficient
estimates and variances from its output. Results can be posted or reposted for exporting
with pretty table commands or testing.

Options

post posts estimation results in e().

repost adds results to the estimates in memory. If the estimates in memory are from a
single equation model, the model estimates will be prefixed with equation name "Main" and the linear combinations
will be prefixed with equation name "xlincom". In the case of a multiple equation model, the linear combinations will
be added with equation name "xlincom". This option is intended to make it easy to create tables combining
model coefficients and linear combinations of these coefficients.

covzero sets covariances to zero for speed improvements. The
transformations should not be tested against other coefficients
if this option is specified as this will yield invalid results.

level(#) specifies the confidence level. The default is level(95)
or as set by set level.

df(#) specifies that the t distribution with # degrees of
freedom be used for computing p-values and confidence intervals.
The default is to use e(df_r) degrees of freedom or the standard normal
distribution if e(df_r) is missing.

noheader suppresses the output header.

eform, or, hr, shr, irr, and rrr all report
coefficient estimates as exp(b) rather than b. Only one of these options may be
specified. or is the default after logistic. See help lincom
for more information about these options.

Examples

Example taken from help lincom

Setup

. webuse regress

. regress y x1 x2 x3

Estimate single linear combination

. xlincom x2-x1

Estimate single linear combination, label transformation

. xlincom myname = 3*x1 + 500*x3

Estimate single linear combination, label transformation and post results

. xlincom myname = 3*x1 + 500*x3 - 12, post

Estimate multiple linear combinations of coefficients, label transformations and post results

. qui regress y x1 x2 x3

. xlincom (name1 = x2-x1) (name2 = 3*x1 + 500*x3) (name3 = 3*x1 + 500*x3 - 12), post

Add sum of coefficients to a formatted table using esttab

. webuse gxmpl1

. reg gnp L(0/2).cpi

. xlincom (t = cpi) (t1 = cpi + l1.cpi) (t2 = cpi + l1.cpi + l2.cpi), repost

. esttab, eqlabels("Main" "Sum of coefficients", span)

Stored results

xlincom stores the following in r():

Scalars

r(level) confidence level

Matrices

r(table) coefficient table

If option post is specified, xlincom stores the following in e():

Scalars

e(N) number of observations

e(df_r) degrees of freedom

Macros

e(predict) xlincom_p

e(cmd) xlincom

e(properties) b V

e(depvar) dependent variable

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

Functions

e(sample) estimation sample

If option repost is specified, xlincom keeps the estimates in memory
but changes e(b) and e(V) to include coefficients and variance/covariances
of the linear combinations.

Acknowledgments

I would like to thank Roger Newson, as some of the code of xlincom
is based on the code of his command lincomest.

I would also like to thank Ben Jann, who pointed me towards the approach to add
results to the estimates in memory which led to the repost option.

Since much of xlincom's options are the same as lincom's I have
used information from the help file of lincom while making
this help file for consistency and clarity, especially for shared options.

Author

Wouter Wakker, wouter.wakker@outlook.com

Also see

lincom, nlcom, test, testnl