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

__Postestimation commands__

The following postestimation commands are of special interest after
**asroprobit**:

Command Description
-------------------------------------------------------------------------
**estat alternatives** alternative summary statistics
**estat covariance** covariance matrix of the latent-variable errors for
the alternatives
**estat correlation** correlation matrix of the latent-variable errors
for the alternatives
**estat facweights** covariance factor weights matrix
**estat mfx** marginal effects
-------------------------------------------------------------------------

The following standard postestimation commands are also available:

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)
**estimates** cataloging estimation results
**hausman** Hausman's specification test
**lincom** point estimates, standard errors, testing, and
inference for linear combinations of coefficients
**lrtest** likelihood-ratio test
**nlcom** point estimates, standard errors, testing, and
inference for nonlinear combinations of
coefficients
**predict** predicted probabilities, estimated linear predictor
and its standard error
**predictnl** point estimates, standard errors, testing, and
inference for generalized predictions
**pwcompare** pairwise comparisons of estimates
**test** Wald tests of simple and composite linear
hypotheses
**testnl** Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------

__Syntax for predict__

**predict** [*type*] *newvar* [*if*] [*in*] [**,** *statistic* **altwise**]

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

*statistic* Description
-------------------------------------------------------------------------
Main
__p__**r** probability of each ranking, by case; the default
**pr1** probability that each alternative is preferred
**xb** linear prediction
**stdp** standard error of the linear prediction
-------------------------------------------------------------------------
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 probability of each ranking. For each
case, one probability is computed for the ranks in **e(depvar)**.

**pr1** calculates the probability that each alternative is preferred.

**xb** calculates the linear prediction for each alternative.

**stdp** calculates the standard error of the linear predictor.

**altwise** specifies that alternativewise deletion be used when marking out
observations due to missing values in your variables. The default is
to use casewise deletion. The **xb** and **stdp** options always use
alternativewise deletion.

**scores** calculates the scores for each coefficient in **e(b)**. This option
requires a new variable list of length equal to the number of columns
in **e(b)**. Otherwise, use the *stub****** syntax to have **predict** generate
enumerated variables with prefix *stub*.

__Syntax for estat__

Alternative summary statistics

**estat** __alt__**ernatives**

Covariance matrix of the latent-variable errors for the alternatives

**estat** __cov__**ariance** [**,** __for__**mat(***%fmt***)** __bor__**der(***bspec***)** **left(***#***)**]

Correlation matrix of the latent-variable errors for the alternatives

**estat** __cor__**relation** [**,** __for__**mat(***%fmt***)** __bor__**der(***bspec***)** **left(***#***)**]

Covariance factor weights matrix

**estat** __facw__**eights** [**,** __for__**mat(***%fmt***)** __bor__**der(***bspec***)** **left(***#***)**]

Marginal effects

**estat** **mfx** [*if*] [*in*] [**,** *estat_mfx_options*]

*estat_mfx_options* Description
-------------------------------------------------------------------------
Main
__var__**list(***varlist***)** display marginal effects for *varlist*
**at(median** [*atlist*]**)** calculate marginal effects at these values
**rank(***ranklist***)** calculate marginal effects for the simulated
probability of these ranked alternatives

Options
__l__**evel(***#***)** set confidence interval level; default is **level(95)**
__noe__**sample** do not restrict calculation of the medians to the
estimation sample
__now__**ght** ignore weights when calculating medians
-------------------------------------------------------------------------

__Menu for estat__

**Statistics > Postestimation**

__Description for estat__

**estat alternatives** displays summary statistics about the alternatives in
the estimation sample. The command also provides a mapping between the
index numbers that label the covariance parameters of the model and their
associated values and labels for the alternative variable.

**estat covariance** computes the estimated variance-covariance matrix of the
latent-variable errors for the alternatives. The estimates are
displayed, and the variance-covariance matrix is stored in **r(cov)**.

**estat correlation** computes the estimated correlation matrix of the
latent-variable errors for the alternatives. The estimates are
displayed, and the correlation matrix is stored in **r(cor)**.

**estat facweights** displays the covariance factor weights matrix and stores
it in **r(C)**.

**estat mfx** computes the marginal effects of a simulated probability of a
set of ranked alternatives. The probability is stored in **r(pr)**, the
matrix of rankings is stored in **r(ranks)**, and the matrix of
marginal-effect statistics is stored in **r(mfx)**.

__Options for estat__

Options for **estat** are presented under the following headings:

Options for estat covariance, estat correlation, and estat facweights
Options for estat mfx

__Options for estat covariance, estat correlation, and estat facweights__

**format(***%fmt***)** sets the matrix display format. The default for **estat**
**covariance** and **estat facweights** is **format(%9.0g)**; the default for
**estat correlation** is **format(%9.4f)**.

**border(***bspec***)** sets the matrix display border style. The default is
**border(all)**. See **[P] matlist**.

**left(***#***)** sets the matrix display left indent. The default is **left(2)**.
See **[P] matlist**.

__Options for estat mfx__

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

**varlist(***varlist***)** specifies the variables for which to display marginal
effects. The default is all variables.

**at(median** [*atlist*]**)** specifies the values at which the marginal effects
are to be calculated. *atlist* is

[[*alternative***:***variable* **=** *#*] [*variable* **=** *#*] [...]]**)**

The marginal effects are calculated at the medians of the independent
variables.

After specifying the summary statistic, you can specify specific
values for variables. You can specify values for
alternative-specific variables by alternative, or you can specify one
value for all alternatives. You can specify only one value for
case-specific variables. For example, in the **wlsrank** dataset, **female**
and **score** are case-specific variables, whereas **high** and **low** are
alternative-specific variables. The following would be a legal
syntax for **estat mfx**:

**. estat mfx, at(median high=0 esteem:high=1 low=0 security:low=1**
**female=1)**

**at(median** [*atlist*]**)** has no effect on computing marginal effects for
factor variables, which are calculated as the discrete change in the
probability as the factor variable changes from the base level to the
level specified in option **at()**. If a factor level is not specified
in the **at()** option, the first level that is not the base is used.

The median computations respect any **if** or **in** qualifiers, so you can
restrict the data over which the medians are computed. You can even
restrict the values to a specific case, for example,

**. estat mfx if case==13**

**rank(***ranklist***)** specifies the ranks for the alternatives. *ranklist* is

*alternative* **=** *#* *alternative* **=** *#* [...]

The default is to rank the calculated latent variables. Alternatives
excluded from **rank()** are omitted from the analysis. You must
therefore specify at least two alternatives in **rank()**. You may have
tied ranks in the rank specification. Only the order in the ranks is
relevant.

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

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

**noesample** specifies that the whole dataset be considered instead of only
those marked in the **e(sample)** defined by the **asroprobit** command.

**nowght** specifies that weights be ignored when calculating the medians.

__Remarks__

Simulated probability marginal effects cannot be computed for a variable
that is specified in both the alternative-specific and case-specific
variable lists. Computations assume that these two variable lists are
mutually exclusive. For example, **estat mfx** exits with an error message
if your model has independent variables that are the interaction between
alternative-specific variables (*indepvars* specified in **asroprobit**) and
case-specific variables (*varlist* specified in the **casevars()** option).
Marginal effect computations can proceed if you specify a variable list
in the **varlist()** option of **estat mfx** that excludes the variables that are
used in both the alternative-specific and case-specific variable lists.

__Examples__

---------------------------------------------------------------------------
Setup
**. webuse travel**

Fit alternative-specific rank-ordered probit model
**. asroprobit choice travelcost termtime, case(id)** **alternatives(mode)**
**casevars(income)**

Obtain correlation matrix of the alternatives
**. estat correlation**

Obtain variance-covariance matrix of the alternatives
**. estat covariance**

Calculate probability alternative is chosen
**. predict p**

Calculate marginal effects for the case-specific variable **income** and the
alternative-specific variables **termtime** and **travelcost**
**. estat mfx, at(air: termtime=50 travelcost=100 income=60)**

---------------------------------------------------------------------------
Setup
**. webuse travel, clear**

Fit alternative-specific rank-ordered probit model
**. asroprobit choice travelcost termtime, case(id)** **alternatives(mode)**
**casevars(income)**

Store estimation results
**. estimates store unstructured**

Fit second alternative-specific rank-ordered probit model
**. asroprobit choice travelcost termtime, case(id)** **alternatives(mode)**
**casevars(income)** **correlation(independent)**

Perform likelihood-ratio test to compare models
**. lrtest unstructured**
---------------------------------------------------------------------------

__Stored results__

**estat mfx** stores the following in **r()**:

Scalars

**r(pr)** scalar containing the computed probability of the ranked
alternatives.

Matrices

**r(ranks)** column vector containing the alternative ranks. The
rownames identify the alternatives.

**r(mfx)** matrix containing the computed marginal effects and associated
statistics. Column 1 of the matrix contains the marginal
effects; column 2, their standard errors; column 3, their z
statistics; and columns 4 and 5, the confidence intervals.
Column 6 contains the values of the independent variables used to
compute the probabilities **r(pr)**.