```-------------------------------------------------------------------------------
help for _grmargd                                                     28Feb2011
-------------------------------------------------------------------------------

Marginal effects and their differences in binary regressions using the delta me
> thod for inference

_grmargd [if exp] [in range] [, x(variables_and_values) rest(stat)
nobase all level(#) save diff dydxmat(matrix_kxk)]

where variables_and_values is an alternating list of variables and either
numeric values or mean, median, min, max, upper, lower, previous.

stat is either mean, median, min, max, upper, lower, previous,
grmean(group mean), mrmedian, grmin, grmax.

Description

After estimating a binary regression model, _grmargd computes the
predicted marginal effects at specific values of the independent
variables, or differences in marginal effects at two different x vectors.
confidence intervals are available using the delta method with closed
form analytic solutions. This low utility program also provides retued
matrices (see below).

Options

save saves current values of independent variables and predictions
(marginal effects) for computing changes using the diff option.

diff computes difference between current predictions (marginal effects)
and those that were saved.

level() sets the level of the confidence interval for predicted values or
marginal effects for the commands for which these are provided. The
default is 95.

x() sets the values of independent variables for calculating predicted
values.  The list must alternate variable names and values.  The
values may be either numeric values or can be mean, median, min, max,
previous, upper, or lower.  The latter cannot be used if rest()
specifies a group summary statistic (e.g., grmean).

rest() sets the independent variables not specified in x() to their mean
(default), minimum, maximum, median when calculating predicted
values. grmean sets these independent variables to the mean
conditional on the variables and values specified in x();
grmedian,grmax, and grmin can also be used.

nobase suppresses inclusion of the base values of x in the output.

all specifies that any calculations of means, medians, etc., should use
the entire sample instead of the sample used to estimate the model.

dydxmat(matrix_kxk) supplies a matrix by users of dy/dx or dxb/dx, where
there is polynomial or interaction terms.

Returned Matrices

r(marg):  saves marginal effects.

r(margci):  saves confidence intervals for marginal effects

r(margvar): saves variance-covariance matrix for marginal effects

r(margse):  saves standard errors for marginal effects

r(dmarg):  saves differences in marginal effects when diff option is used

r(dmargci): saves confidence intervals for differences in marginal
effects when diff option is used.

Examples

To compute the predicted marginal effects and confidence intervals using
delta method for a logit in which all independent variables are held at
the mean.

.logit vote black educ income

._grmargd, x(black=1 educ=16) save

._grmargd, x(black=0 educ=16) diff

What if there is interaction terms or polynomial terms? Here is an
example.

.gen age2=age*age

.logit lfp age age2 k5 inc

._grmargd, x(age=20 age2=400) dydxmat(1, 20, 0, 0, 0 \ 0, 1, 0, 0, 0 \ 0,
0, 1, 0, 0 \ 0, 0, 0, 1, 0 \ 0, 0, 0, 0, 1)

:::

-------------------------------------------------------------------------------

Authors: Jun Xu

```