help for margeff Version 2.2.0 (20 August 2009) -------------------------------------------------------------------------------
Obtain partial effects after estimation
margeff [compute] [if exp] [in range] [, at(atlist) constant dummies(varlist_1 [\ varlist_2 ..]) link(log|loglog|logc|nbinomial|power #|opower #) model(stata_cmd) nooffset nowght outcome(#) percent replace ]
margeff replay [, level(#) ]
where stata_cmd is one of
[group 1:] probit, logit, logistic, cloglog, heckprob [group 2:] oprobit, ologit, mlogit, biprobit [group 3:] poisson, nbreg, zip, zinb [group 4:] truncreg, cnreg, tobit, heckman
and atlist is { mean | median | zero [ varname = # [, varname = #] [...]] } { [mean] |[median] | [zero] varname = # [, varname = #] [...] }
and varlist_1 [\ varlist_2 ... ] are lists of dummy variables, where all dummies of a list indicate different categories of the same underlying categorical variable.
Description
margeff compute analytically estimates partial effects after estimation. Standard errors of partial effects are also estimated using the delta method. Partial effects can be obtained not only after the above listed models, but also after
1. generalized linear models (see help for glm), 2. the panel-data (xt) version of the supported models inlcuding xtgee, 3. generalized ordered models (see help for gologit2 if installed).
The default behavior of margeff and main alternatives to the defaults can be summarized as follows:
1. By default, margeff calculates average partial effects. Estimation of partial effects evaluated at sample means or at any other evaluation points is also possible with the help of the at(atlist) option. In either case, calculations are restricted to the estimation sample.
2. Partial effects are discrete partial changes in the quantities of interest as the variable under study increases by the unit of measurement. For dummy variables (variables coded 0/1) and count variables, unit of measurement is 1. For other variables, units of measurement are detected using an algorithm implemented in the official ado file codebook. This partial change approach eases computations, and approximates very well the partial changes calculated using the classic marginal effects approach.
3. Quantities of interest are defined as follows:
[group 1:] probability of positive outcome [group 2:] probabilities of all possible outcomes defined by the dependent variable(s) [group 3:] expected number of counts or the incidence rate [group 4:] expected value of dependent variable conditional on the dependent variable being observed
4. The calculations automatically adjust for fweights, iweights, or pweights used during estimation. If you wish to apply (different) weights, however, you can specify your own fweights, iweights, or pweights; see help weights.
5. margeff behaves as a post-estimation command (see help postest). However, option replace forces margeff to behave as an estimation command (see help est). This enables the use of post-estimation commands like lincom or test after margeff.
Typed without arguments, margeff replays the results of the previous margeff computations, provided the last use of margeff was combined with the replace option.
margeff replay replays the results of the previous margeff computation.
Options
at(atlist) forces margeff to estimate partial effects at points specified in atlist, instead of estimating average partial effects.
at( mean | median | zero [ varname = # [, varname = # [...]] ) specifies that the partial effects be evaluated at means, at medians of the independent variables, or at zeros. It also allows users to specify particular values for one or more independent variables, assuming that the rest are means, medians, or zeros.
at( [mean] |[median] | [zero] varname = # [, varname = #] [...] ) specifies that the partial effects be evaluated at particular values for one or more independent variables, assuming that the rest are means.
constant has the effect that quantities of interests computed at zero values of the independent variables are also displayed. Thus the constant term shows the baseline prediction.
dummies(varlist_1 [\ varlist_2 ... ]) modifies the calculation of partial effects if sets of indicator or dummy variables were included in the model. The modification is the following: if the dummy variable Dvar1 appears only in varlist_1 then all variables appearing in varlist_1 are set to zero, but variables appearing in varlist_2 [\ varlist_3 ... ] are not affected. This option should be specified so that each varlist_k ({it:k) = 1,2,...) consists of indicator or dummy variables referring to different categories of a single underlying variable.
level(#) specifies the confidence level in percent for the confidence intervals of the coefficients; see help level.
link(log|loglog|logc|nbinomial|power #|opower #) forces margeff to define the quantity of interest as F(xb), where xb is the linear prediction and F is the inverse of the link function. For example, the option link(log) defines the quantity of interest as exp(xb).
model(stata_cmd) forces margeff to estimate partial effects as if the preceeding estimation command were stata_cmd. stata_cmd must be one of the supported commands that are listed above. This option is likely to be helpful if you wish to obtain partial effects after an estimation command having the same link function as stata_cmd. It is the user's responsibility to ensure that the link functions are the same.
nooffset causes margeff to ignore the offset variable during the calculations.
nowght causes margeff to ignore weights used during previous estimation.
outcome(#) causes margeff to display only one outcome. This option is useful after estimation commands listed as [group 2] models. The number specified is interpreted as follows: 1. After biprobit, numbers 1 2 3 and 4 refer to outcomes p00 p01 p10 p11. 2. After ologit, oprobit, gologit2 and mlogit, number # refers to the #th category of the dependent variable. Thus, number 1 always indicates the lowest category. And if the dependent variable has, say, 5 categories, then number 5 indicates the highest category.
percent causes margeff to display the results in a percentage form.
replace causes margeff to overwrite the estimation results left behind. This option is useful if
1. you wish to include partial effects in publication-quality tables using either the official estimates table command or the user-written commands outreg or estout; or 2. your model contains a variable (such as age-squared) which is a mathematical transformation of another independent variable, and you wish to obtain the total effect of that variable (age) using the lincom or the nlcom command.
Remarks
margeff is a work-in-progress; comments, suggestions, bug reports are welcome! Please direct correspondence to the adress described at the end of the help file. To keep margeff up-to-date, visit the website http://www.uni-corvinus.hu/bartus or type net from "http://web.uni-corvinus.hu/bartus/stata" net install margeff , replace
Examples
Illustrating the importance of the dummies( varlist_1 \ ... ) option
Type the following commands:
. [save mydata, replace] . tabi 60 30 10 \ 20 60 20 \ 10 10 80 , replace . xi: mlogit col i.row [fw=pop] . margeff . margeff , at(mean) . margeff , at(mean) dummies(_I*)
You can see that the first and the last {margeff} commands produced the expected results. Easy calculation of the total effect of age
Suppose you wish to model employment status as a function of the usual human capital variables: gender, years of education, experience, and the square of experience. Assume further that the sample average of experience is 20. The total effect of experience on employment probabilities can be estimated as follows:
. logit employed gender edu exp exp2 . margeff, at(mean) replace . lincom exp+40*exp2
Acknowledgements
Some parts of the code are taken from the official ado-files codebook. Earlier versions of margeff relied on margfx (version 30 Jul 1999 for Stata 5) written by Jonah B. Gelbach, Dept of Economics, Univ of MD at College Park. Helpful suggestions were received from Richard Gates at StataCorp.
Also see
Online: help for est, postest; mfx
Author
Tamas Bartus Institute of Sociology and Social Policy, Corvinus University, Budapest, Hungary URL: http://www.uni-corvinus.hu/bartus Email: tamas.bartus@uni-corvinus.hu