help for grdiame                                            - v001 25dec2009 jx

Differences in Averaged Marginal effects in binary regressions

grdiame [if exp] [in range] [, x(variables_and_values) rest(stat) level(#) all group(grpvar_g0value_g1value)]

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.


After estimating a binary regression model, grdiame computes the differences in average marginal effects between the 1 and 0 groups coded by the group variable. grdiame uses a closed form solution with the delta method.


level() sets the level of the confidence interval for differences in group average marginal effects. 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.

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

group identifies a group indictor variable. After the group variable, specify the value for the group 0, then the value for group 1 of the group variable. This program takes a difference of AMEg1-AMEg0.

Returned Matrices

r(avgmarg): saves group average marginal effects.

r(avgmargdif): saves differences in and confidence intervals for group average marginal effects


To compute the differences in group average marginal effects and confidence intervals using delta method for a logit in which all independent variables are held at the mean, and we compare black with whites.

.logit vote black asian hispn educ income

.grdiame, group(race 1 4)

In this case, the grdiame compares group averaged marginal effects between whites (race=1) and asians (race=4).



Authors: Jun Xu