I'm using heckprob, and my model includes some quadratic terms. When
displaying the marginal effects using mfx compute, Stata displays separate
terms (obviously) for the linear and quadratic terms of the variable. That
is it treats x1 and x2 as separate variables and does not understand that
x2 = x1^2.
In displaying marginal effects of heckprob (or probit or logit or whatever)
it seems one would be interested in the "total" marginal effect, not
individual effects on the linear and quadratic terms.
Getting the total marginal effect is not so difficult, theoretically: the
total marginal effect (Mt) for a variable x is:
Mt = M1 + 2*xbar*M2
where M1 is the marginal effect for the linear term, M2 is the marginal
effect of the squared term, and xbar is the value of x at which mfx is
evaluated.
However, how does one calculate the standard error for this estimate? I've
looked all over and haven't found a straightforward approach. Second,
since the "real" marginal effect of the variable in question is incorrect
in the mfx output, doesn't this actually influence the calculations for
*all* the marginal effects? [My understanding is that the calculations of
the SEs for each marginal effect depend on values of the other marginal
effects.] If so, then the output of mfx compute is suspect whenever one is
using quadratic terms.