By default, estat mfx
calculates the marginal effects at the mean values of the covariates (MEM). This special MEM uses an overall average for each case-specific covariate, and the choice-specific averages for the covariates that characterize the alternatives. The manual and help-files could be a lot clearer on this point.
Your finite difference of predictions way sounds like an average marginal effect (AME), and not a MEM. Since the expected value function is non-linear, the AME and the MEM will usually be fairly different.
You can use the code below to illustrate my claim and replicate what estat mfx
is doing under the hood:
cls
webuse choice, clear
qui asclogit choice dealer, case(id) alternatives(car) casevars(income i.sex)
/* discrete MEMs */
estat mfx, varlist(sex) k(1)
table car, c(mean dealer mean income) row format(%16.0g)
estat mfx, varlist(sex) k(1) at(income = 42.096611022949 American:dealer = 18.976270675659 Japan:dealer = 7.5423727035522 Europe:dealer = 3.4610168933868)
/* By Hand */
bys car: egen double mean_dealer = mean(dealer)
replace income = 42.096611022949
replace dealer = 18.976270675659 if car=="American":nation
replace dealer = 7.5423727035522 if car=="Japan":nation
replace dealer = 3.4610168933868 if car=="Europe":nation
replace sex = 0
predict double p0, k(1)
replace sex = 1
predict double p1, k(1)
gen double diff = p1 - p0
table car, c(mean diff) format(%9.6f)
Here's the output:
. webuse choice, clear
. qui asclogit choice dealer, case(id) alternatives(car) casevars(income i.sex)
.
. /* discrete MEMs */
. estat mfx, varlist(sex) k(1)
Pr(choice = American|1 selected) = .62729282
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | .040054 .06418 0.62 0.533 -.085735 .165844 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
Pr(choice = Japan|1 selected) = .2929863
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | -.110364 .058198 -1.90 0.058 -.22443 .003702 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
Pr(choice = Europe|1 selected) = .07972088
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | .07031 .038236 1.84 0.066 -.004632 .145252 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
variable base
sex 0
. table car, c(mean dealer mean income) row format(%16.0g)
----------------------------------------------
nationali |
ty of car | mean(dealer) mean(income)
----------+-----------------------------------
American | 18.976270675659 42.096611022949
Japan | 7.5423727035522 42.096611022949
Europe | 3.4610168933868 42.096611022949
|
Total | 9.9932203292847 42.096611022949
----------------------------------------------
. estat mfx, varlist(sex) k(1) at(income = 42.096611022949 American:dealer = 18.976270675659 Japan:dealer = 7.542372703552
> 2 Europe:dealer = 3.4610168933868)
Pr(choice = American|1 selected) = .62729282
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | .040054 .06418 0.62 0.533 -.085735 .165844 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
Pr(choice = Japan|1 selected) = .2929863
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | -.110364 .058198 -1.90 0.058 -.22443 .003702 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
Pr(choice = Europe|1 selected) = .07972088
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
casevars |
1.sex | .07031 .038236 1.84 0.066 -.004632 .145252 0
-------------------------------------------------------------------------------
dp/dx for factor levels is the discrete change from the base level
variable base
sex 0
.
. /* By Hand */
. bys car: egen double mean_dealer = mean(dealer)
. replace income = 42.096611022949
(885 real changes made)
. replace dealer = 18.976270675659 if car=="American":nation
variable dealer was byte now float
(295 real changes made)
. replace dealer = 7.5423727035522 if car=="Japan":nation
(295 real changes made)
. replace dealer = 3.4610168933868 if car=="Europe":nation
(295 real changes made)
. replace sex = 0
(648 real changes made)
. predict double p0, k(1)
(option pr assumed; Pr(car))
. replace sex = 1
(885 real changes made)
. predict double p1, k(1)
(option pr assumed; Pr(car))
. gen double diff = p1 - p0
. table car, c(mean diff) format(%9.6f)
----------------------
nationali |
ty of car | mean(diff)
----------+-----------
American | 0.040054
Japan | -0.110364
Europe | 0.070310
----------------------