Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: test difference in marginal effects for the same dummy variable, computed first as difference and then as derivative

 From Luca Fumarco To "statalist@hsphsun2.harvard.edu" Subject st: test difference in marginal effects for the same dummy variable, computed first as difference and then as derivative Date Mon, 4 Mar 2013 21:21:14 +0100

```Dear statalisters,

I would like to test whether the difference between the marginal effects of a dummy varaible, obtained first by computing the difference
and then by taking the derivative, is statistically significant. I want to implement this test in order to justify the utilization of the derivative.
The model I am suing is the probit model; my vars are y x1 x2 x3, where x1 and x2 are the dummy variables.
Below you can read the syntax I am using.

1)  First, I generate an identical dummy var, but with a different name.
gen x1bis = x1

2) Second, I regress the probit model, compute the marginal effect of x1 computing the difference, and I store the estimate
probit y i.x1 i.x2 x3, cluster(id)
margins, dydx(x1) atmeans post
matrix list e(b)
est store mfx1
estimate query

3) Third, I regress the probit model, compute the marginal effect of x1bis taking the derivatie, and I store the estimate
probit y i.x1bis i.x2 x3, cluster(id)
margins, dydx(x1bis) cont atmeans post
matrix list e(b)
est store mfx2
estimate query

4) Eventually, I test the difference
lincom _b[1.x1] - _b[1.x1bis]

Stata returns the following result:
------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1)     |      0         (omitted)     .       .               .                 .
------------------------------------------------------------------------------

As you see, I control with "estimate query" what I have actually stored and the corresponding values: _b[1.x1] and _b[1.x1bis] corresponds to the estimates
of the marginal effects computed in the two different ways, and their value is not the same.

Is there a syntax or (worse) a methodological problem in what I am doing?
Do you have any suggestion concerning a possible correction, or even concerning a different way to implement this test?

Thank you very much!
Luca
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```