help for grmarg                                            - v001 28feb2011 jx 

Marginal effects and their differences from binary regressions

grmarg [if] [in] [, x(variables_and_values) rest(stat) level(#) delta bootstrap reps(#) size(#) save diff nobase all match dots 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 and stat is either mean, median, min, max, upper, lower, previous, grmean(group mean), mrmedian, grmin, grmax.


grmarg is a command that returns marginal effects, differences in marginal effects and their confidence intervals using both bootstrap and delta methods


x(variables_and_values) sets the values of independent variables for calculating predicted values (marginal effects). The list must alternate variable names and either numeric values or types of stat.

rest(stat) sets the independent variables not specified in x(variables_and_values) to one of the types of stat.

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

delta calculates confidence intervals by the delta method using analytical derivatives. This method works with cloglog, logistic, logit and probit.

bootstrap computes confidence intervals using the bootstrap method. This method takes roughly 1,000 times longer to compute than other methods. This method works with cloglog, logistic, logit, and probit.

reps(#) specifies the number of bootstrap replications to be performed. The default is 1000.

size(#) specifies the size of the samples to be drawn. The default is e(N), the same size as the estimation sample.

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

diff computes difference between current predictions and those that were saved.

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

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

match requests grmarg to resample from each category group of the dependent variable in proportion of the resample size to the original sample size.

dots requests a dot be placed on the screen at the beginning of each replication, thus providing entertainment when a large number of reps() are requested. It also prints out the percent replications finished.

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


To compute the predicted marginal effects, differences in marginal effects, and their confidence intervals using the delta method for a logit model. All independent variables are held at their means except for black and education specifed in x().

.logit vote black educ income

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

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



Authors: Jun Xu