# Re: st: how to use mfx with xtlogit

 From May Boggess To statalist@hsphsun2.harvard.edu Subject Re: st: how to use mfx with xtlogit Date 12 Jul 2004 08:29:52 -0500

```On Friday, Gang Peng asked about using -mfx- after -xlogit-. He got the
following error message:

predict() expression  unsuitable for marginal effect calculation
r(119);

and is not sure what it means.

This message comes from the improvements made to -mfx- in the March 2004
update. The following FAQ explains in detail what it means:

http://www.stata.com/support/faqs/stat/mfx_unsuit.html

But let me give you the short(er) answer here. Remember that -mfx- is
calculating the partial derivatives of a function of the coefficients of
the previous estimation. The user can control what function of the
coefficients it is taking the derivative of by using the option
-predict()- on -mfx. If you don't use that option at all, the default
predict option of the preceding estimation is used.

For many commands the default predict option is the linear predictor xb.
Of course, its partial derivatives are just the coefficients of the
model and, unsurprisingly, the standard errors are just the standard
errors of the coefficients. So the output of -mfx- is exactly the same
of the output of the estimation. The point I am making here is that what
the default predict option is for a particular estimation command is not
necessarily the most likely thing we want to use when using -mfx-.

This is the case with -xtlogit, fe- (which is exactly the same
estimation as -clogit-). The default is p, the probability of success
given one success in the group (this is the same as predict option pc1
after -clogit-). As discussed in detail in the FAQ, this function
depends on more than just the coefficients and values of the covariates.
It depends on the values of the covariates in some other observations
and the number of observations in the group. This is dangerous territory
for -mfx- which takes numerical derivatives based on a number of
assumptions:
1) that the function depends only on coefficients and values of the
covariates, meaning that is does not depend on, for example, the values
of the covariates in other observations;
2) the covariates are (mathematically) independent, meaning, if I vary
one covariate it doesn't change the value of any other covariate.

Previously, it was up to the user to determine whether or not the
prediction function they were supplying to -mfx- was appropriate. With
the March 2004 update, we added some more checks and balances to protect
users from these dangerous situations as much as possible. It is a
balancing act of course, because -mfx- runs after nearly every
estimator, so must be very flexible, but it must also run as fast as
possible.

The option -diagnostics- was also added so the user could see how -mfx-
made the decision not to compute either marginal effect or standard
error was made. And if you don't agree with its decision you can still
use -force- to make it do the work anyway. This option, and what its
output means, is discussed in detail in the above FAQ, and in the
following:

http://www.stata.com/support/faqs/stat/mfx_nose.html

-- May
mmb@stata.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/
```