Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: problem with Margin command and interaction graph in fixed effect logistic regression
From
Alfonso Sánchez-Peñalver <[email protected]>
To
Stata List <[email protected]>
Subject
Re: st: problem with Margin command and interaction graph in fixed effect logistic regression
Date
Thu, 31 Oct 2013 12:15:03 -0400
Hi Nahla,
I believe you are right in thinking that margins is not reporting the margins because you are estimating the model without a constant. I tried the following simple example:
------------------ begin code -----------------------
sysuse cancer.dta, clear
logit died i.drug##c.age studytime, noconst
margins drug, at(studytime=(10(5)30))
------------------- end code -----------------------
I get the following results:
Predictive margins Number of obs = 48
Model VCE : OIM
Expression : Pr(died), predict()
1._at : studytime = 10
2._at : studytime = 15
3._at : studytime = 20
4._at : studytime = 25
5._at : studytime = 30
Delta-method
Margin Std. Err. z P>z [95% Conf. Interval]
_at#drug
1 1 . (not estimable)
1 2 . (not estimable)
1 3 . (not estimable)
2 1 . (not estimable)
2 2 . (not estimable)
2 3 . (not estimable)
3 1 . (not estimable)
3 2 . (not estimable)
3 3 . (not estimable)
4 1 . (not estimable)
4 2 . (not estimable)
4 3 . (not estimable)
5 1 . (not estimable)
5 2 . (not estimable)
5 3 . (not estimable)
I then do the -logit- estimtion without the -nonconst- option, and run the same -margins- command and get:
Predictive margins Number of obs = 48
Model VCE : OIM
Expression : Pr(died), predict()
1._at : studytime = 10
2._at : studytime = 15
3._at : studytime = 20
4._at : studytime = 25
5._at : studytime = 30
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at#drug |
1 1 | .9465649 .0518676 18.25 0.000 .8449063 1.048224
1 2 | .4488331 .149976 2.99 0.003 .1548854 .7427807
1 3 | .6152748 .182977 3.36 0.001 .2566464 .9739032
2 1 | .9333187 .0662422 14.09 0.000 .8034864 1.063151
2 2 | .3948395 .1327874 2.97 0.003 .1345811 .6550979
2 3 | .5688943 .1510893 3.77 0.000 .2727648 .8650238
3 1 | .9171489 .0877723 10.45 0.000 .7451183 1.089179
3 2 | .3431901 .1379768 2.49 0.013 .0727605 .6136197
3 3 | .5217416 .1263294 4.13 0.000 .2741405 .7693427
4 1 | .8975889 .1181116 7.60 0.000 .6660946 1.129083
4 2 | .2948301 .1565933 1.88 0.060 -.0120872 .6017474
4 3 | .4745012 .1173863 4.04 0.000 .2444282 .7045742
5 1 | .8741791 .1585532 5.51 0.000 .5634206 1.184938
5 2 | .2504701 .177148 1.41 0.157 -.0967337 .5976738
5 3 | .4278449 .1277973 3.35 0.001 .1773668 .6783231
------------------------------------------------------------------------------
So clearly, the noconst is the issue here. You have not explained which command you are using for your fixed effects logistic estimation, so I am not sure why it is running the estimation without a constant. Could you be a little more specific about the command you are using?
Best,
Alfonso
On Oct 31, 2013, at 10:29 AM, Nahla Betelmal <[email protected]> wrote:
> Dear Statalist members,
>
> I am facing difficulty in getting the margins and plotting the
> interaction graph in a fixed-effect logistic regression. I believe
> this is due to the fact that fixed effect logistic regression does not
> report an intercept. I wonder if there is a way to get around this to
> produce the graph.
>
> In the regression there is three interactions ( Dummy variable with
> Continuous variable in each interaction)
>
>
> Conditional (fixed-effects) logistic regression Number of obs = 9941
>
> Wald chi2(34) = 681.92
>
> Prob > chi2 = 0.0000
> Log pseudolikelihood = -3651.0306 Pseudo
> R2 = 0.1458
>
> (Std. Err. adjusted for
> 1220 clusters in firm)
> ---------------------------------------------------------------------------------------------
> | Robust
> To | Coef. Std. Err. z P>|z|
> [95% Conf. Interval]
> ----------------------------+----------------------------------------------------------------
> 1.DV | .1529853 .1576329 0.97 0.332
> -.1559694 .4619401
> |
> DVr#c.IVA |
> 0 | .1643871 .0829615 1.98 0.048
> .0017855 .3269886
> 1 | .2475583 .091258 2.71 0.007
> .068696 .4264206
> |
> DV#c.IVB |
> 0 | .1423918 .1179659 1.21 0.227
> -.088817 .3736007
> 1 | .4909195 .1660735 2.96 0.003
> .1654214 .8164176
> |
> DVr#c.IVC |
> 0 | .5103285 .104731 4.87 0.000
> .3050596 .7155974
> 1 | .5350398 .1325409 4.04 0.000
> .2752644 .7948152
>
>
> I tried to get each interaction alone first, but did not work
>
> . margins DV, at( IVA=(-1.1(0.1)1.7))
> default predict option not appropriate with margins
> r(322);
>
>
> I tried all together
>
> . margins OC_2year, at((mean) IVA (mean) IVB (mean) IVC)
> default predict option not appropriate with margins
> r(322);
>
>
> Many thanks in advance
>
> Nahla Betelmal
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/