helppetpoisson-------------------------------------------------------------------------------

TitleEndogenous Participation Endogenous Treatment Poisson model by MSL

Basic syntax

petpoisson(Tvar=varlist1) (Pvar=varlist2) (cvar=varlist3) [ifexp] [inrange],rep(#)hvector(# # #)

Full syntax

petpoisson(Tvar=varlist1) (Pvar=varlist2) (cvar=varlist13) [ifexp] [inrange],rep(#)hvector(# # #)method(#)cluster(clustvar)constraints(clist)tracerobusthbasedmloptions

optionsDescription -----------------------------------------------------------------------------rep(#)Sets the number of random draws that will be used for calculating the simulated likelihood.hvector(# # #)Controls aspects of the simulation, all three numbers must be integers. The first number sets the number ofcolumnsthat the vector of random draws will have. The second number picks one column. Finally, the third number sets the number ofrows-from the top row onwards- to be discarded from the chosen column. For instance,rep(400)hvec(2 1 100)asks for a 500x2 random vector, to take the first column and to discard the first 100 rows. The resulting 400x1 vector is used for simulating the likelihood.method(#) Type of random draws to be used for simulating the likelihood. Option 1 is the default and indicates that Halton sequences shall be used. Option 2 indicates that a Hammersley set should be used. Finally, option 3 indicates that pseudouniform random numbers should be used.robustThe Eicker-Huber-White (sandwich) estimator of the covariance matrix is reported. This option is only valid when used together with thehabasedoption.hbasedMaximisation will be performed using analytical first derivatives and numerical second derivatives.cluster(clustvar) Clustered sandwich estimator of the covariance matrix. This option must be used together with the thehabasedoption.constraints(clist) Specifies constraints in the usual way.traceTrace.mloptionsUsual mloptions.

Description

petpoissonfits a Endogenous Participation Endogenous Treatment Poisson model for count data by Maximum Simulated Likelihood.

Important notesThe equation for the treatment variable

Tvaralways comes first, then the equation for the participation dummyPvar, and finally the equation for the main count outcome variablecvar. This order should be always observed, otherwise the model will not be correctly estimated or it will produce an error message.By default the model is fitted by the BHHH method, using analytical first derivatives and an outer product gradient (OPG) approximation of the covariance matrix. The

hbasedoption modifies this default behaviour.Simulations conducted by the author show that using less than 1,000 delivers slightly underestimated standard errors and that the coverage of the parameters is below the advertised 95%. For these reasons I strongly recommend using at least 1,000 Halton draws to simulate the likelihood.

If Stata is stopped during maximisation for any reason you'll need to drop all macros that are created by petpoisson, otherwise you'll see an error message. In that instance type: . mac drop S_s* S_cat S_x* S_n* S_eqs S_e* S_r* S_i*

Examples. use petpoisson_sdata.dta

. petpoisson (T = x1) (P = T x2) (count = T x3), rep(1600) hvec(1 1 100)

. petpoisson (T = x1) (P = T x2) (count = T x3), rep(1600) hvec(1 1 100) hbased

Marginal effects after estimation/* At the mean of explanatory variables */ . petpoisson_me [

ifexp] [inexp] /* At the mean of explanatory variables *//* MEs at the mode of explanatory variables */ . petpoisson_me, dmode

/* MEs at the # quantile of the linear predictor */ . petpoisson_me, XBQuantile(0.3)

/* ME for T when count is 2 (v.g. mode of main count) */ . petpoisson_me, cmode(T 2)

AuthorAlfonso Miranda (A.Miranda@ioe.ac.uk) as part of join work with Massimiliano Bratti.

Conditions of use

petpoissonis not an official Stata command and is an implementation of the methods discussed in Bratti and Miranda (2011). There is no warranty and the author cannot accept any responsability for the use of this software. The entire risk as to the quality and performance is with you. Should the work prove defective, you assume the cost of all necessary servicing, repair, or correction. You may distribute a complete, unmodified copy of this sofware as you received it. No modification or partial copy is allowed. Both the software and the main paper should be cited together.

Suggested citationPlease cite as:

Miranda, A. 2012. petpoisson: Stata module (Mata) to estimate an Endogenous Participation Endogenous Treatment Poisson model by MSL. Available at http://ideas.repec.org/e/pmi55.html.

Bratti, M. and Miranda, A. 2011. Endogenous treatment effects for count data models with endogenous participation or sample selection.

Health Economics20 (9):1090-1109. Available at http://onlinelibrary.wiley.com/doi/10.1002/hec.1764/abstract.

Sofware and paper should be cited together. A copy of the paper is available from the author upon request.

Webpagehttp://ideas.repec.org/e/pmi55.html