## Stata 15 help for nlcom

```
[R] nlcom -- Nonlinear combinations of estimators

Syntax

Nonlinear combination of estimators -- one expression

nlcom [name:]exp [, options]

Nonlinear combinations of estimators -- more than one expression

nlcom ([name:]exp) [([name:]exp) ...] [, options]

options           Description
-------------------------------------------------------------------------
level(#)          set confidence level; default is level(95)
iterate(#)        maximum number of iterations
post              post estimation results
display_options   control column formats and line width

df(#)             use t distribution with # degrees of freedom for
computing p-values and confidence intervals
-------------------------------------------------------------------------
noheader and df(#) do not appear in the dialog box.

The second syntax means that if more than one expression is specified,
each must be surrounded by parentheses.  The optional name is any valid
Stata name and labels the transformations.

exp is a possibly nonlinear expression containing
_b[coef]
_b[eqno:coef]
[eqno]coef
[eqno]_b[coef]

eqno is
##
name

coef identifies a coefficient in the model.  coef is typically a variable
name, a level indicator, an interaction indicator, or an interaction
involving continuous variables.  Level indicators identify one level of a
factor variable and interaction indicators identify one combination of
levels of an interaction; see fvvarlist.  coef may contain time-series
operators; see tsvarlist.

Distinguish between [], which are to be typed, and [], which indicate
optional arguments.

Statistics > Postestimation

Description

nlcom computes point estimates, standard errors, test statistics,
significance levels, and confidence intervals for (possibly) nonlinear
combinations of parameter estimates after any Stata estimation command,
including survey estimation.  Results are displayed in the usual table
format used for displaying estimation results.  Calculations are based on
the "delta method", an approximation appropriate in large samples.

Options

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

iterate(#) specifies the maximum number of iterations used to find the
optimal step size in calculating numerical derivatives of the
transformation(s) with respect to the original parameters.  By
default, the maximum number of iterations is 100, but convergence is
usually achieved after only a few iterations.  You should rarely have
to use this option.

post causes nlcom to behave like a Stata estimation (eclass) command.
When post is specified, nlcom will post the vector of transformed
estimators and its estimated variance-covariance matrix to e(). This
option, in essence, makes the transformation permanent.  Thus you
could, after posting, treat the transformed estimation results in the
same way as you would treat results from other Stata estimation
commands.  For example, after posting, you could redisplay the
results by typing nlcom without any arguments, or use test to perform
simultaneous tests of hypotheses on linear combinations of the
transformed estimators.

Specifying post clears out the previous estimation results, which can
be recovered only by refitting the original model or by storing the
estimation results before running nlcom and then restoring them; see
[R] estimates store.

display_options:  cformat(%fmt), pformat(%fmt), sformat(%fmt), and
nolstretch; see [R] estimation options.

The following options are available with nlcom but are not shown in the
dialog box:

df(#) specifies that the t distribution with # degrees of freedom be used
for computing p-values and confidence intervals.

Comparison with lincom

nlcom is a generalization of lincom that allows the estimation of
nonlinear transformations of model parameters.  In cases where you are
estimating one transformation and that transformation is linear, use
lincom; it is faster.  However, when estimating more than one linear
transformation or combinations of linear and nonlinear transformations,
using nlcom has the added benefit that you can obtain the
variance-covariance matrix (which is stored in r(V)) of the joint
transformation.  lincom does not allow the simultaneous estimation of
multiple linear combinations.

Remark on the manipulability of nonlinear Wald tests

In contrast to likelihood-ratio tests, different -- mathematically
equivalent -- formulations of a hypothesis may lead to different results
for a nonlinear Wald test (lack of "invariance"). For instance, the two
hypotheses

H0: coefficient = 0

H0: exp(coefficient) - 1 = 0

are mathematically equivalent expressions but do not yield the same test
statistic and p-value. In extreme cases, under one formulation, one would
reject H0, whereas under an equivalent formulation one would not reject
H0.

Examples

---------------------------------------------------------------------------
Setup
. webuse regress

Fit linear regression model
. regress y x1 x2 x3

Estimate the product of the coefficients on x2 and x3
. nlcom _b[x2]*_b[x3]

Estimate the ratios of the coefficients on x1 and x2 and on x2 and x3
jointly and post results to e()
. nlcom (ratio1: _b[x1]/_b[x2]) (ratio2: _b[x2]/_b[x3]), post

Test whether the two ratios from above are equal
. test _b[ratio1] = _b[ratio2]

---------------------------------------------------------------------------
Setup
. webuse sysdsn3

Fit maximum-likelihood multinomial logit model
. mlogit insure age male nonwhite site2 site3

Estimate the ratio of the coefficients on the male dummy in the Prepaid
and Uninsure equations
. nlcom [Prepaid]_b[male] / [Uninsure]_b[male]
---------------------------------------------------------------------------

Stored results

nlcom stores the following in r():

Scalars
r(N)                number of observations
r(df_r)             residual degrees of freedom

Matrices
r(b)                vector of transformed coefficients
r(V)                estimated variance-covariance matrix of the
transformed coefficients

If post is specified, nlcom also stores the following in e():

Scalars
e(N)                number of observations
e(df_r)             residual degrees of freedom
e(N_strata)         number of strata L, if used after svy
e(N_psu)            number of sampled PSUs n, if used after svy
e(rank)             rank of e(V)

Macros
e(cmd)              nlcom
e(predict)          program used to implement predict
e(properties)       b V

Matrices
e(b)                vector of transformed coefficients
e(V)                estimated variance-covariance matrix of the
transformed coefficients
e(V_srs)            simple-random-sampling-without-replacement
(co)variance hat V_srswor, if svy
e(V_srswr)          simple-random-sampling-with-replacement
(co)variance hat V_srswr, if svy and fpc()
e(V_msp)            misspecification (co)variance hat V_msp, if svy and
available

Functions
e(sample)           marks estimation sample

```