Qiuqiong,
To answer your second question first, -mfx- saves the standard errors
in the matrix e(Xmfx_se_dydx).
Regarding your first question, if you really want to calculate the
marginal effects for each and every observation, you can do so with a
nested loop. I hope you have a fast computer and a lot of patience.
set more off
sysuse auto
mlogit rep78 mpg displacement, nolog
levels rep78, local(rlevels)
levels mpg, local(mlevels)
levels displacement, local(dlevels)
foreach r of local rlevels {
foreach m of local mlevels {
foreach d of local dlevels {
di ""
di ""
di "mfx c, pred(outcome(`r')) at(mpg=`m' displacement=`d')"
mfx c, pred(outcome(`r')) at(mpg=`m' displacement=`d')
matrix list e(Xmfx_se_dydx)
}
}
}
Two blank lines are added above each -mfx- command to make the output
easier to read. The full -mfx- command with the values for which the
marginal effects are calculated is also displayed. In addition, the
standard errors of the marginal effects are listed after the -mfx-
output.
The code above was tested in Stata 8.2. Note that -levels- only works
with integer and string variables.
Friedrich
--- [email protected] wrote:
> I am trying to calculate the marginal effects at every observation
> for a multinomial logit model. As I understood, the mfx command in
> STATA calculates the marginal effect at the mean of the independent
> variables, which is not correct for multinomial logit models since
> marginal effects are nonlinear in the independent variables. So I
> have two questions:
>
> 1. Is there an easy way to make mfx to calculate the marginal
> effect at each observation instead of manually entering the values
> for each observation?
>
> 2. Is there an easy way to calculate the standard errors of the
> marginal effects?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/