**[R] mlogit postestimation** -- Postestimation tools for mlogit

__Postestimation commands__

The following postestimation commands are available after **mlogit**:

Command Description
-------------------------------------------------------------------------
**contrast** contrasts and ANOVA-style joint tests of estimates
**estat ic** Akaike's and Schwarz's Bayesian information criteria
(AIC and BIC)
**estat summarize** summary statistics for the estimation sample
**estat vce** variance-covariance matrix of the estimators (VCE)
**estat** (svy) postestimation statistics for survey data
**estimates** cataloging estimation results
* **forecast** dynamic forecasts and simulations
* **hausman** Hausman's specification test
**lincom** point estimates, standard errors, testing, and
inference for linear combinations of coefficients
* **lrtest** likelihood-ratio test
**margins** marginal means, predictive margins, marginal effects,
and average marginal effects
**marginsplot** graph the results from margins (profile plots,
interaction plots, etc.)
**nlcom** point estimates, standard errors, testing, and
inference for nonlinear combinations of coefficients
**predict** predictions, residuals, influence statistics, and
other diagnostic measures
**predictnl** point estimates, standard errors, testing, and
inference for generalized predictions
**pwcompare** pairwise comparisons of estimates
**suest** seemingly unrelated estimation
**test** Wald tests of simple and composite linear hypotheses
**testnl** Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------
* **forecast**, **hausman**, and **lrtest** are not appropriate with **svy** estimation
results. **forecast** is also not appropriate with **mi** estimation results.

__Syntax for predict__

**predict** [*type*] {*stub****** | *newvar* | *newvarlist*} [*if*] [*in*] [**,** *statistic*
__o__**utcome(***outcome***)**]

**predict** [*type*] {*stub****** | *newvarlist*} [*if*] [*in*] **,** __sc__**ores**

*statistic* Description
-------------------------------------------------------------------------
Main
__p__**r** predicted probabilities; the default
**xb** linear prediction
**stdp** standard error of the linear prediction
**stddp** standard error of the difference in two linear
predictions
-------------------------------------------------------------------------
If you do not specify **outcome()**, **pr** (with one new variable specified),
**xb**, and **stdp** assume **outcome(#1)**. You must specify **outcome()** with the
**stddp** option.
You specify one or k new variables with **pr**, where *k* is the number of
outcomes.
You specify one new variable with **xb**, **stdp**, and **stddp**.
These statistics are available both in and out of sample; type **predict**
*...* **if e(sample)** *...* if wanted only for the estimation sample.

__Menu for predict__

**Statistics > Postestimation**

__Description for predict__

**predict** creates a new variable containing predictions such as
probabilities, linear predictions, and standard errors.

__Options for predict__

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

**pr**, the default, calculates the predicted probabilities. If you do not
also specify the **outcome()** option, you specify k new variables, where
k is the number of categories of the dependent variable. Say that
you fit a model by typing **mlogit result x1 x2**, and **result** takes on
three values. Then you could type **predict p1 p2 p3** to obtain all
three predicted probabilities. If you specify the **outcome()** option,
you must specify one new variable. Say that **result** takes on the
values 1, 2, and 3. Typing **predict p1, outcome(1)** would produce the
same **p1**.

**xb** calculates the linear prediction. You must also specify the
**outcome(***outcome***)** option.

**stdp** calculates the standard error of the linear prediction. You must
also specify the **outcome(***outcome***)** option.

**stddp** calculates the standard error of the difference in two linear
predictions. You must specify the **outcome(***outcome***)** option, and here
you specify the two particular outcomes of interest inside the
parentheses, for example, **predict sed, stdp outcome(1,3)**.

**outcome(***outcome***)** specifies the outcome for which the statistic is to be
calculated. **equation()** is a synonym for **outcome()**: it does not
matter which you use. **outcome()** or **equation()** can be specified using

**#1**, **#2**, ..., where **#1** means the first category of the dependent
variable, **#2** means the second category, etc.;

the values of the dependent variable; or

the value labels of the dependent variable if they exist.

**scores** calculates equation-level score variables. The number of score
variables created will be one less than the number of outcomes in the
model. If the number of outcomes in the model were k, then

the first new variable will contain the first derivative of the log
likelihood with respect to the first equation;

the second new variable will contain the first derivative of the log
likelihood with respect to the second equation;

...

the (k-1)th new variable will contain the first derivative of the log
likelihood with respect to the (k-1)st equation.

__Syntax for margins__

**margins** [*marginlist*] [**,** *options*]

**margins** [*marginlist*] **,** __pr__**edict(***statistic *...**)** [__pr__**edict(***statistic *...**)**
...] [*options*]

*statistic* Description
-------------------------------------------------------------------------
default probabilities for each outcome
__p__**r** probability for a specified outcome
**xb** linear prediction for a specified outcome
**stdp** not allowed with **margins**
**stddp** not allowed with **margins**
-------------------------------------------------------------------------
**pr** and **xb** default to the first outcome.

Statistics not allowed with **margins** are functions of stochastic
quantities other than **e(b)**.

For the full syntax, see **[R] margins**.

__Menu for margins__

**Statistics > Postestimation**

__Description for margins__

**margins** estimates margins of response for probabilities and linear
predictions.

__Examples__

---------------------------------------------------------------------------
Setup
**. webuse sysdsn1**
**. mlogit insure age male nonwhite i.site**

Test joint significance of **2.site** and **3.site** in all equations
**. test 2.site 3.site**

Test joint significance of coefficients in **Prepaid** equation
**. test [Prepaid]**

Test joint significance of **2.site** and **3.site** in **Uninsure** equation
**. test [Uninsure]: 2.site 3.site**

Test if coefficients in **Prepaid** and **Uninsure** equations are equal
**. test [Prepaid=Uninsure]**

Predict probabilities of outcome 1 for estimation sample
**. predict p1 if e(sample), outcome(1)**

Display summary statistics of **p1**
**. summarize p1**

Compute linear prediction for **Indemnity** equation
**. predict idx1, outcome(Indemnity) xb**

---------------------------------------------------------------------------
Setup
**. sysuse auto, clear**
**. mlogit rep78 mpg displ**

Compute the predicted probability at the regressors' means for each
outcome
**. margins, atmeans**

Compute the average marginal effect of each regressor on the probability
of each of the outcomes 1-3
**. margins, dydx(*) predict(outcome(1)) predict(outcome(2))**
**predict(outcome(3))**
---------------------------------------------------------------------------