# Re: st: marginal effect of clogit

 From "Clive Nicholas" To statalist@hsphsun2.harvard.edu Subject Re: st: marginal effect of clogit Date Sat, 22 Sep 2007 10:48:40 +0100

```Somsupa Nopprach wrote:

>   I have read that -mfx- can not use with conditional
> logit model. So i decide to show my result by using
> the odds ratio instead of marginal effect. Do you
> think this is appropriate?

Taken from -help j_mfxunsuit-:

Predict expression unsuitable error message

A marginal effect is a derivative of a function of the coefficients and
independent variables of a model.  The mfx option predict() can be used
to specify the function to be differentiated. If this function depends on
quantities other than the coefficients and independent variables of the
model, mfx will most likely not be able to evaluate the derivative
accurately.

mfx checks for dependence on other quantities by predicting into
different observations in the dataset and checking that it obtains the
same value.  If not, it determines that the expression is unsuitable.

The mfx option diagnostics(beta) displays the results of these checks.
The option force can be used to force the calculation of the marginal
effect, although this is usually inadvisable.

>    However, I have another problem. my model also
> includes interactive terms between two dummies. and I
> also have read that the interpretation of odds ratio
> is not appropriate for interactive or multiplicative
> variables.
>   Any one knows any useful command in stata in order
> that i can solve this problem?

You have probably read the same literature on this subject as I have.
I came to the conclusion that there are no quick-fix solutions to this
problem. You either decide that running such models are 'tolerable' or
you decide that they are not.

However, one partial solution I have found helpful is to use Richard
Williams' -oglm- routine, with the use of the -het()- option. This is
downloadable from SSC. -mfx- can be used after -oglm-. See the example
below, with the error messages deliberately shown. Note that -southXt-
is the interaction term for -south- and -t0-.

. webuse union

. tsset idcode year

. xtlogit union age grade south black t0 southXt, i(id) fe
note: multiple positive outcomes within groups encountered.
note: 2744 groups (14165 obs) dropped due to all positive or
all negative outcomes.
note: black omitted due to no within-group variance.

Iteration 0:   log likelihood = -4516.2771
Iteration 1:   log likelihood = -4510.9103
Iteration 2:   log likelihood = -4510.9077
Iteration 3:   log likelihood = -4510.9077

Conditional fixed-effects logistic regression   Number of obs      =     12035
Group variable (i): idcode                      Number of groups   =      1690

Obs per group: min =         2
avg =       7.1
max =        12

LR chi2(5)         =     78.56
Log likelihood  = -4510.9077                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
union |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0707478   .0960376     0.74   0.461    -.1174825    .2589781
grade |   .0814976   .0419064     1.94   0.052    -.0006373    .1636325
south |  -1.005429   .1496154    -6.72   0.000     -1.29867   -.7121886
t0 |  -.0633121   .0967567    -0.65   0.513    -.2529516    .1263275
southXt |   .0263557   .0083166     3.17   0.002     .0100554    .0426561
------------------------------------------------------------------------------

. mfx, predict(p outcome(1))
r(303);

. mfx, predict(p) diagnostics(beta)

Predict into observation 1 = .13628032
Predict into last observation = .16871637
Predict into all observations: mean = .14042376
Predict into all observations: sd = .06756762
predict() expression p unsuitable for marginal-effect calculation
r(119);

. oglm union age grade south black t0, het(southXt)

Heteroskedastic Ordered Logistic Regression       Number of obs   =      26200
LR chi2(6)      =    1208.84
Prob > chi2     =     0.0000
Log likelihood = -13259.808                       Pseudo R2       =     0.0436

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
union        |
age |   .0278939   .0051979     5.37   0.000     .0177061    .0380816
grade |   .0783001   .0067902    11.53   0.000     .0649915    .0916087
south |  -1.021978   .0645004   -15.84   0.000    -1.148396   -.8955593
black |   .8861081   .0369666    23.97   0.000     .8136549    .9585613
t0 |  -.0223223   .0059469    -3.75   0.000    -.0339779   -.0106666
-------------+----------------------------------------------------------------
lnsigma      |
southXt |   .0060774   .0030963     1.96   0.050     8.71e-06    .0121461
-------------+----------------------------------------------------------------
/cut1 |   2.833318   .1436359    19.73   0.000     2.551797    3.114839
------------------------------------------------------------------------------

. scalar lnsigma = [lnsigma]_b[southXt]

. display "Allison's delta = " (1 - exp(lnsigma))/ exp(lnsigma)
Allison's delta = -.00605897

. mfx, predict(p outcome(1))

Marginal effects after oglm
y  = Pr(union==1) (predict, p outcome(1))
=  .20706878
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
age |   .0044708      .00083    5.39   0.000   .002846  .006095   30.4322
grade |   .0125498      .00107   11.70   0.000   .010448  .014651   12.7615
south*|  -.1558508      .00744  -20.94   0.000  -.170439 -.141263   .413015
black*|   .1576848       .0069   22.87   0.000   .144168  .171201   .274542
t0 |  -.0035778      .00094   -3.82   0.000  -.005412 -.001743   9.47137
southXt |   .0013398      .00068    1.96   0.050  -1.4e-07   .00268   3.96874
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

The postestimation code used after -oglm, het()- was kindly provided
by Richard himself. -oglm- is only a partial solution because,
together with the added code, it provides extra information in the
form of 'Allison's delta', a measure of how large or small the
disturbance variance is for one group over the other group being
compared (Allison, 1994: 193). However, it can only indicate to you
how problematic the use of comparing logit coefficients across your
two groups is likely to be in your model: it cannot 'fix' any problem
for you. In the above example, 100 * -.00605897 = -0.61, so we
conclude that the difference in disturbance variance between
'southerners' and 'nonsoutherners' is small. I wouldn't mind seeing
Richard coming onto this thread to say whether or not he plans to
incorporate the added code into -oglm-. I think it would be very
useful.

--
Clive Nicholas

[Please DO NOT mail me personally here, but at
<clivenicholas@hotmail.com>. Thanks!]

Allison P (1994) "Comparing Logit and Probit Coefficients Across
Groups", Sociological Methods and Research 28(2): 186-208.
*
*   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/
```