## Stata 15 help for heckprobit_postestimation

```
[R] heckprobit postestimation -- Postestimation tools for heckprobit

Postestimation commands

The following postestimation commands are available after heckprobit:

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
* 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
-------------------------------------------------------------------------
* hausman and lrtest are not appropriate with svy estimation results.

Syntax for predict

predict [type] newvar [if] [in] [, statistic nooffset ]

predict [type] {stub*|newvar_reg newvar_sel newvar_athrho} [if] [in],
scores

statistic          Description
-------------------------------------------------------------------------
Main
pmargin          Pr(depvar=1); the default
p11              Pr(depvar=1, depvar_s=1)
p10              Pr(depvar=1, depvar_s=0)
p01              Pr(depvar=0, depvar_s=1)
p00              Pr(depvar=0, depvar_s=0)
psel             Pr(depvar_s=1)
pcond            Pr(depvar=1 | depvar_s=1)
xb               linear prediction
stdp             standard error of the linear prediction
xbsel            linear prediction for selection equation
stdpsel          standard error of the linear prediction for selection
equation
-------------------------------------------------------------------------

These statistics are available both in and out of sample; type predict
... if e(sample) ... if wanted only for the estimation sample.

Statistics > Postestimation

Description for predict

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

Options for predict

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

pmargin, the default, calculates the univariate (marginal) predicted
probability of success Pr(depvar=1).

p11 calculates the bivariate predicted probability Pr(depvar=1,
depvar_s=1).

p10 calculates the bivariate predicted probability Pr(depvar=1,
depvar_s=0).

p01 calculates the bivariate predicted probability Pr(depvar=0,
depvar_s=1).

p00 calculates the bivariate predicted probability Pr(depvar=0,
depvar_s=0).

psel calculates the univariate (marginal) predicted probability of
selection Pr(depvar_s=1).

pcond calculates the conditional (on selection) predicted probability of
success Pr(depvar=1 | depvar_s=1) = Pr(depvar=1,
depvar_s=1)/Pr(depvar_s=1).

xb calculates the probit linear prediction.

stdp calculates the standard error of the prediction, which can be
thought of as the standard error of the predicted expected value or
mean for the observation's covariate pattern.  The standard error of
the prediction is also referred to as the standard error of the
fitted value.

xbsel calculates the linear prediction for the selection equation.

stdpsel calculates the standard error of the linear prediction for the
selection equation.

nooffset is relevant only if you specified offset(varname) for
heckprobit.  It modifies the calculations made by predict so that
they ignore the offset variable; the linear prediction is treated as
xb rather than xb + offset.

scores calculates equation-level score variables.

The first new variable will contain the derivative of the log
likelihood with respect to the regression equation.

The second new variable will contain the derivative of the log
likelihood with respect to the selection equation.

The third new variable will contain the derivative of the log
likelihood with respect to the third equation (athrho).

Syntax for margins

margins [marginlist] [, options]

margins [marginlist] , predict(statistic ...) [predict(statistic ...)
...] [options]

statistic          Description
-------------------------------------------------------------------------
pmargin            Pr(depvar=1); the default
p11                Pr(depvar=1, depvar_s=1)
p10                Pr(depvar=1, depvar_s=0)
p01                Pr(depvar=0, depvar_s=1)
p00                Pr(depvar=0, depvar_s=0)
psel               Pr(depvar_s=1)
pcond              Pr(depvar=1 | depvar_s=1)
xb                 linear prediction
xbsel              linear prediction for selection equation
stdp               not allowed with margins
stdpsel            not allowed with margins
-------------------------------------------------------------------------

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

For the full syntax, see [R] margins.

Statistics > Postestimation

Description for margins

margins estimates margins of response for probabilities and linear
predictions.

Examples

Setup
. webuse school

Fit probit model with sample selection
. heckprobit private years logptax, sel(vote=years loginc logptax)

Estimate marginal probability that private equals one
. predict pmarg

Compare to probit model with an if qualifier
. probit private years if vote==1

Calculated predicted probabilities
. predict phat

```