# test difference in marginal effects for a dummy variable, different computations

#### lukeskywalker84

##### New Member

I have a Stata problem.

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 these results: Coef. = 0 and Std. Err. = (omitted), while z, P|z| and CI = .

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!