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.

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

 From Joerg Luedicke To statalist@hsphsun2.harvard.edu Subject Re: 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:46:08 -0500

```It does not seem to be clear (to me at least) what you are trying to
do. I also fail to see (contrary to your claim) that your first and
second -margins- call differ in any way. To me it looks like you do
the same thing twice, once with one variable, and then with another
which is a copy of the first one. Thus the -lincom- result of zero
looks perfectly reasonable to me, although I wonder how Stata lets you
refer to results from the first -margins- call after results from the
second call are -post-ed? Perhaps consider rephrasing your inquiry.

Joerg

On Mon, Mar 4, 2013 at 3:21 PM, Luca Fumarco <luca.fumarco@lnu.se> wrote:
> 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/
*
*   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/
```