I'm trying to estimate two models that are basically a probit and tobit, but not quite. To estimate the model, I have to program a custom likelihood function. However, the average marginal effects I am interested in are exactly the ones from a probit and tobit. To get these marginal effects, I know I can program them myself to get the point estimate and the delta method standard error. However, I was wondering if there was a way to trick Stata into thinking my custom program was a probit or tobit. The outline of the code I have in mind is as follows
I'm able to get margins to run. However, for probit, it doesn't give the average marginal effect of y, only the marginal effect of the latent variable, which is just the beta coefficient. And for tobit, it crashes. Are there any suggestions on what I should put in for ereturn to make this work? I've been doing esample, but I wasn't sure what other things needed to be a part of the ereturn. Thank you.
Code:
program define my_prog, eclass syntax /*....*/ ml model /*....*/ ereturn post B V ereturn local cmd "probit" ereturn /*....*/ end my_prog /*..*/ margins, dydx(/*...*/)
Comment