*! version 1.1.0: 18apr2022

help rbiprobit margdecgithub.com/cobanomics/rbiprobit

also see: rbiprobit postestimation

Title

rbiprobit margdec -- Marginal means, predictive margins, and marginal effects after rbiprobit

Syntax

rbiprobit margdec [if] [in] [weight] [,
response_options
options]

response_options

Main
effect(effecttype) specify type of effect for margins;
effecttype may be total, direct, or indirect; default is total

predict(pred_opt) estimate
margins for predict, pred_opt

dydx(varlist) estimate
marginal effect of variables in varlist

eyex(varlist) estimate
elasticities of variables in varlist

dyex(varlist) estimate
semielasticity -- d(y)/d(lnx)

eydx(varlist) estimate
semielasticity -- d(lny)/d(x)

SE
vce(delta) estimate SEs using delta method; the default

vce(unconditional) estimate SEs allowing for sampling of covariates

Advanced
noweights ignore weights specified in estimation

noesample do not restrict rbiprobit margdec to the estimation sample

force estimate margins despite potential problems

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

post post margins and their VCE as estimation results

display_options control
columns and column formats, row spacing, line width, and
factor-variable labeling

Time-series operators are allowed if they were used in the estimation.

pweights, fweights, and iweights are allowed; see weight.

Description

Margins are statistics calculated from predictions of a previously fit
model by rbiprobit at fixed values of some covariates and averaging or otherwise
integrating over the remaining covariates.

The rbiprobit margdec command estimates margins of responses for
specified values of independent variables in indepvars and indepvars_en and
presents the results as a table.

Capabilities include estimated marginal means, least-squares means, average
and conditional marginal and partial effects (which may be reported as
derivatives or as elasticities), average and conditional adjusted
predictions, and predictive margins.

For estimation of margins of responses for specified values of the treatment
variable depvar_en, please use rbiprobit tmeffects. rbiprobit margdec
won't deliver results in this case.

Links to PDF documentation of Stata's margins command

Quick start

Remarks and examples

Methods and formulas

The above sections are not included in this help file.

Options

Warning: The option descriptions are brief and use jargon. Skip to
Remarks and examples in [R] margins
if you are reading about margins for the first time.

Main

effect(effecttype) specifies the effecttype for the margins. Once independent
variables are parts of indepvars and indepvars_en, marginal effects can be
splitted into a direct and an indirect marginal effect.

effect(total): rbiprobit margdec reports derivatives of the response with
respect to varlist in dydx(varlist), eyex(varlist),
dyex(varlist), or eydx(varlist), considering the incorporation of varlist
in indepvars and/or indepvars_en.

effect(direct): rbiprobit margdec reports derivatives of the response with
respect to varlist from dydx(varlist), eyex(varlist),
dyex(varlist), or eydx(varlist), considering only the incorporation of
varlist in indepvars and not taking into account the appearance of
varlist in indepvars_en.

effect(indirect): rbiprobit margdec reports derivatives of the response with
respect to varlist from dydx(varlist), eyex(varlist),
dyex(varlist), or eydx(varlist), considering only the incorporation of
varlist in indepvars_en and not taking into account the appearance of
varlist in indepvars.

Differentiation between effectypes is not approriate for predictions pmarg1,
pmarg2, xb1 and xb2. These predictions can't combined with
effect(direct) or effect(indirect).

predict(pred_opt) specifies the response. If predict() is not specified,
the response will be the default prediction that would be produced by predict
after rbiprobit. predict(pred_opt) specifies the option to be specified
with the predict command to produce the variable that will be used as the
response. For example, after estimation by rbiprobit, you could specify
predict(pmarg1) to obtain the marginal probability rather than the
predict command's default, the joint predicted probability p11.

In contrast to margins command, multiple predict() options are not
allowed with rbiprobit margdec.

dydx(varlist), eyex(varlist), dyex(varlist), and eydx(varlist)
request that rbiprobit margdec report derivatives of the response with respect
to varlist rather than on the response itself. eyex(), dyex(), and
eydx() report derivatives as elasticities; see
Expressing derivatives as elasticities in [R] margins.

In contrast to margins command, multiple dydx(), eyex(), dyex(),
or eydx() options are not allowed with rbiprobit margdec.

SE

vce(delta) and vce(unconditional) specify how the VCE and, correspondingly,
standard errors are calculated.

vce(delta) is the default. The delta method is applied to the formula
for the response and the VCE of the estimation command. This method assumes that
values of the covariates used to calculate the response are
given or that the data are given.

vce(unconditional) specifies that the covariates that are not fixed
be treated in a way that accounts for their having been sampled. The VCE
is estimated using the linearization method. This method allows for
heteroskedasticity or other violations of distributional assumptions and
allows for correlation among the observations in the same manner as
vce(robust) and vce(cluster ...), which
may have been specified with rbiprobit.

Advanced

noweights specifies that any weights specified on the previous estimation command
be ignored by rbiprobit margdec. By default, rbiprobit margdec uses the
weights specified in rbiprobit to average responses and to compute summary
statistics. If weights are specified on the rbiprobit margdec command,
they override previously specified weights, making it unnecessary to specify noweights.
The noweights option is not allowed after svy estimation when the
vce(unconditional) option is specified.

noesample specifies that rbiprobit margdec not restrict its computations to the
estimation sample used by the previous estimation command. See
Example 15: Margins evaluated out of sample in [R] margins.

With the default delta-method VCE, noesample margins may
be estimated on samples other
than the estimation sample; such results are valid under the
assumption that the data used are treated as being given.

You can specify noesample and vce(unconditional) together, but
if you do, you should be sure that the data in memory correspond
to the original e(sample). To show that you understand that,
you must also specify the force option. Be aware that making
the vce(unconditional) calculation on a sample different from
the estimation sample would be equivalent to
estimating the coefficients on one set of data and computing the scores
used by the linearization on another set; see [P] _robust.

force instructs rbiprobit margdec to proceed in some situations where it would
otherwise issue an error message because of apparent violations of
assumptions. Do not be casual about specifying force. You need to
understand and fully evaluate the statistical issues. For an example
of the use of force, see
Using margins after the estimates use command in [R] margins.

Reporting

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

post
causes rbiprobit margdec to behave like a Stata estimation (e-class) command.
rbiprobit margdec posts the vector of estimated margins along with the
estimated variance-covariance matrix to e(), so you can treat the
estimated margins just as you would results from any other estimation
command. For example, you could use test to perform simultaneous tests
of hypotheses on the margins, or you could use lincom to create linear
combinations. See
Example 10: Testing margins -- contrasts of margins in [R] margins.

display_options:
noci,
nopvalues,
vsquish,
nofvlabel,
fvwrap(#),
fvwrapon(style),
cformat(%fmt),
pformat(%fmt),
sformat(%fmt), and
nolstretch.

noci
suppresses confidence intervals from being reported in the coefficient table.

nopvalues
suppresses p-values and their test statistics from being reported in the
coefficient table.

vsquish
specifies that the blank space separating factor-variable terms or
time-series-operated variables from other variables in the model be suppressed.

nofvlabel displays factor-variable level values rather than attached value
labels. This option overrides the fvlabel setting; see
[R] set showbaselevels.

fvwrap(#) allows long value labels to wrap the first #
lines in the coefficient table. This option overrides the
fvwrap setting; see [R] set showbaselevels.

fvwrapon(style) specifies whether value labels that wrap will break
at word boundaries or break based on available space.

fvwrapon(word), the default, specifies that value labels break at
word boundaries.

fvwrapon(width) specifies that value labels break based on available
space.

This option overrides the fvwrapon setting; see
[R] set showbaselevels.

cformat(%fmt) specifies how to format margins, standard errors, and
confidence limits in the table of estimated margins.

pformat(%fmt) specifies how to format p-values in the table of estimated margins.

sformat(%fmt) specifies how to format test statistics in the
table of estimated margins.

nolstretch specifies that the width of the table of estimated margins
not be automatically widened to accommodate longer variable names. The default,
lstretch, is to automatically widen the table of estimated margins up to
the width of the Results window. To change the default, use
set lstretch off. nolstretch is not shown in the dialog
box.

Examples

Setup

. webuse class10

. rbiprobit graduate = income i.roommate i.hsgpagrp,
endog(program = i.campus i.scholar income i.hsgpagrp)

Compute total, direct, and indirect average marginal effects of income
on the joint probability Pr(depvar=1, depvar_en=1)

. rbiprobit margdec, dydx(income) predict(p11) effect(total)

. rbiprobit margdec, dydx(income) predict(p11) effect(direct)

. rbiprobit margdec, dydx(income) predict(p11) effect(indirect)

Compute indirect average marginal effects of all independent variables
on the joint probability Pr(depvar=1, depvar_en=0) and plot the results

. rbiprobit margdec, dydx(*) predict(p10) effect(direct)

. marginsplot

Compute average marginal effects of hsgpagrp on the marginal probabilities

. rbiprobit margdec, dydx(hsgpagrp) predict(pmarg1)

. rbiprobit margdec, dydx(hsgpagrp) predict(pmarg2)

Stored results

rbiprobit margdec stores the following in r():

Scalars

r(N) number of observations

r(k_predict) number of predict() options

r(k_margins) number of terms in marginlist

r(k_by) number of subpopulations

r(k_at) number of at() options

r(level) confidence level of confidence intervals

Macros

r(cmd) margins

r(cmdline) command as typed

r(est_cmd) e(cmd) from original estimation results

r(est_cmdline) e(cmdline) from original estimation results

r(title) title in output

r(model_vce) vcetype from estimation command

r(vce) vcetype specified in vce()

r(vcetype) title used to label Std. Err.

r(predict#_opts) the #th predict() option

r(predict#_label) label from the #th predict() option

r(expression) response expression

r(xvars) varlist from dydx(), dyex(),
eydx(), or eyex()

r(derivatives) "", "dy/dx", "dy/ex", "ey/dx", "ey/ex"

r(emptycells) empspec from emptycells()

r(mcmethod) method from mcompare()

Matrices

r(b) estimates

r(V) variance-covariance matrix of the estimates

r(Jacobian) Jacobian matrix

r(_N) sample size corresponding to each margin estimate

r(chainrule) chain rule information from the fitted model

r(error) margin estimability codes;

0 means estimable,

8 means not estimable

r(table) matrix
containing the margins with their standard errors, test statistics,
p-values, and confidence intervals

rbiprobit margdec with the post option also stores the following in e():

Scalars

e(N) number of observations

e(k_predict) number of predict() options

e(k_margins) number of terms in marginlist

e(k_by) number of subpopulations

e(k_at) number of at() options

Macros

e(cmd) margins

e(cmdline) command as typed

e(est_cmd) e(cmd) from original estimation results

e(est_cmdline) e(cmdline)
from original estimation results

e(title) title in estimation output

e(model_vce) vcetype from estimation command

e(vce) vcetype specified in vce()

e(properties) b V, or just b if nose is specified

e(predict#_opts) the #th predict() option

e(predict#_label) label from the #th predict() option

e(expression) prediction expression

e(xvars) varlist from dydx(), dyex(),
eydx(), or eyex()

e(derivatives) "", "dy/dx", "dy/ex", "ey/dx", "ey/ex"

e(emptycells) empspec from emptycells()

Matrices

e(b) estimates

e(V) variance-covariance matrix of the estimates

e(Jacobian) Jacobian matrix

e(_N) sample size corresponding to each margin estimate

e(error) error code corresponding to e(b)

e(chainrule) chain rule information from the fitted model

Functions

e(sample) marks estimation sample

Author

Mustafa Coban

Institute for Employment Research (Germany)

email: mustafa.coban@iab.de

github: github.com/cobanomics

webpage: mustafacoban.de

Also see

Online: help for
rbiprobit, rbiprobit postestimation, margins