------------------------------------------------------------------------------- help formargin(This version: 05 October 2004) -------------------------------------------------------------------------------

Average marginal effects for categorical and limited dependent variable models

margin[,countdummies(Varlist_1[ \Varlist_2\ ... \Varlist_N])eformhasconsmeanmodel(stata_cmd)percentreplacetable]where stata_cmd is one of

[class 1:] probit logit logistic cloglog xtprobit xtlogit [class 2:] oprobit ologit gologit mlogit biprobit [class 3:] poisson nbreg zip zinb [class 4:] tobit cnreg intreg heckman heckprob

and

Varlist_Kincludes dummy variables where all of the dummies indicate different categories of the same underlying categorical variable.

Description

margincalculates marginal effects, and standard errors for marginal effects using the delta method. By default,margincalculates the average of partial and discrete changes over the observations.margincan also compute marginal effects at the sample means of the variables if themeanoption is specified. In either cases, calculations are restricted to the estimation sample.By default, the marginal effects calculated are as follows:

[class 1:] changes in the probability of positive outcome [class 2:] changes in the probabilities of all possible outcomes defined by the dependent variable(s) [class 3:] changes in the expected number of counts or in the incidence rate (for

zipandzinb, changes inE(y|y>0)andPr(y>0)also displayed) [class 4:] changes in the expected value of the dependent variableconditionalon the dependent variable being observed (not censored)However, if the eform option is specified,

margincalculates the changes in the value ofexp(xb), wherexbis the linear prediction.

margincan be also be used after commands that are not on the list above. For example, users may wish to obtain marginal effects after the survey version ofstata_cmd, or after their own program. This is made possible by themodel()option.

margincan be used both as an estimation command and as a post-estimation command; see help est and postest. By default,marginbehaves as a post-estimation command, i.e. it does not affect the estimation results. However, optionreplaceforcesmarginto behave as an estimation command. This enables the use of post-estimation commands likelincomortestaftermargin.Typed without arguments,

marginredisplays the marginal effects.

Options

countmodifies the calculation of marginal effects for count variables, i.e. variables that take more than two values and all of the values are integers. By default,margintreates count variables as continuous variables, thus marginal effects correspont to small changes in the independent variables. If the count option is specified, the marginal effects are changes in probabilities when the count variables increases by unity.

dummies(Varlist_1[ \Varlist_2\ ... \Varlist_N])modifies the calculation of marginal effects for dummy variables. Letxvarbe a categorical variables withK(K>2) categories. In this case, not xvar, but (K-1) dummies are included in the regression model. The estimated marginal effects for theseK-1 dummies may be misleading (see the example below). The correct result is obtained if one specifies the dummy option by including theK-1 variables invarlist_1.

eformforcesmarginto define marginal effects as changes in the value ofexp(xb), wherexbis the linear prediction.

hasconsforcesmarginto display the expected value that corresponds to the constant term. Note that this is not marginal effect (that is, change in expected value). For instance, after alogitmodel thehasconsoption adds a new line to the output showing the predicted probability of the event conditional on all explanatory variables are zero.

meanforcesmarginto compute the marginal effects at the sample means of explanatory variables.

model(stata_cmd)allows one to runmarginafter any command.stata_cmdmust be one of the commands listed above.marginwill produce correct results only if the estimation commannd issued beforemarginandstata_cmdhave exactly the same link functions, i.e. the function which links the linear combination of variables and parameters to the outcome under study. It is the user's responsibility to ensure that this condition holds.

percentcausesmarginto display the results in a percentage form.

replacecausesmarginto overwrite the estimation results left behind.

tablecausesmarginto display a table containing the descriptive statistics of individual marginal effects.

Remarks

marginis 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 keepmarginup-to-date, visit the website http://www.bkae.hu/bartus/stata or typenet from http://www.bkae.hu/bartus/statanet install margin

WarningBefore using

margin, make sure that you coded your dummy variables as 0/1 variables. Otherwise your dummies will be considered as being continuous variables, and you run the risk of obtaining misleading results.

ExamplesIllustrating 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]. marginYou will see that the marginal effects do not correspond to changes in probabilities in the 3X3 table. Only the changes in the probabilities of the third outcome approximate the true changes, namely 0.1 and 0.7. The correct results are obtained after specifying the dummies(..) option:

. margin , dummies(_I*)

AcknowledgementsSome parts of the code relies on margfx (version 30 Jul 1999 for Stata 5) written by Jonah B. Gelbach, Dept of Economics, Univ of MD at College Park.

Also seeOnline: help for est, postest; mfx

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