help for

margeffVersion 2.2.0 (20 August 2009) -------------------------------------------------------------------------------

Obtain partial effects after estimation

margeff[compute] [ifexp] [inrange] [,at(atlist)constantdummies(varlist_1[\varlist_2..])link(log|loglog|logc|nbinomial|power #|opower #)model(stata_cmd)nooffsetnowghtoutcome(#)percentreplace]

margeffreplay[,level(#)]where

stata_cmdis 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

atlistis {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 computeanalytically 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 after1. generalized linear models (see help for glm), 2. the panel-data (

xt) version of the supported models inlcudingxtgee, 3. generalized ordered models (see help for gologit2 if installed).The default behavior of

margeffand main alternatives to the defaults can be summarized as follows:

1.By default,margeffcalculates average partial effects. Estimation of partial effects evaluated at sample means or at any other evaluation points is also possible with the help of theat(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 filecodebook. 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 forfweights,iweights, orpweights used during estimation. If you wish to apply (different) weights, however, you can specify your ownfweights,iweights, orpweights; see help weights.

5.margeffbehaves as a post-estimation command (see help postest). However, optionreplaceforcesmargeffto behave as an estimation command (see help est). This enables the use of post-estimation commands likelincomortestaftermargeff.Typed without arguments,

margeffreplays the results of the previousmargeffcomputations, provided the last use ofmargeffwas combined with thereplaceoption.

margeff replayreplays the results of the previousmargeffcomputation.

Options

at(atlist)forcesmargeffto estimate partial effects at points specified inatlist, 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.

constanthas 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 variableDvar1appears only invarlist_1then all variables appearing invarlist_1are set to zero, but variables appearing invarlist_2[\varlist_3... ] are not affected. This option should be specified so that eachvarlist_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 #)forcesmargeffto define the quantity of interest asF(xb), wherexbis the linear prediction andFis the inverse of the link function. For example, the optionlink(log)defines the quantity of interest asexp(xb).

model(stata_cmd)forcesmargeffto estimate partial effects as if the preceeding estimation command werestata_cmd.stata_cmdmust 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 asstata_cmd. It is the user's responsibility to ensure that the link functions are the same.

nooffsetcausesmargeffto ignore the offset variable during the calculations.

nowghtcausesmargeffto ignore weights used during previous estimation.

outcome(#)causesmargeffto display only one outcome. This option is useful after estimation commands listed as [group 2] models. The number specified is interpreted as follows:1.Afterbiprobit, numbers 1 2 3 and 4 refer to outcomes p00 p01 p10 p11.2.Afterologit,oprobit,gologit2andmlogit, 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.

percentcausesmargeffto display the results in a percentage form.

replacecausesmargeffto 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; or2.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

margeffis 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 keepmargeffup-to-date, visit the website http://www.uni-corvinus.hu/bartus or typenet from "http://web.uni-corvinus.hu/bartus/stata"net install margeff , replace

Examples

Illustrating the importance of the dummies( varlist_1 \ ... ) optionType 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 ageSuppose 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

AcknowledgementsSome 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 seeOnline: help for est, postest; mfx

AuthorTamas Bartus Institute of Sociology and Social Policy, Corvinus University, Budapest, Hungary URL: http://www.uni-corvinus.hu/bartus Email: tamas.bartus@uni-corvinus.hu