Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Problem with margins after logit on a person period data


From   Urmi Bhattacharya <ub3@indiana.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem with margins after logit on a person period data
Date   Wed, 8 Jun 2011 22:31:46 -0400

Hi,

I dropped one of the duration dummies durat1 and ran the following
logit regression

logit school_left childage i.childfemale i.urban i.scstobc
i.casteother i.dadp i.dadm i.momp i.momm wagep wage5 wage8 wage9 distp
dist
> m disth percapcons durat2 durat3 durat4 durat5 durat6 durat7 durat8 durat9 durat10 durat11, nolog

I then used margins as follows
margins , dydx(_all)

I got results.

However, when i used the lame logit regreesion and then used mfx, I
got the following error message

default predict() is unsuitable for marginal-effect calculation

Why would i get error with mfx and not with margin?

Best

Urmi


On Wed, Jun 8, 2011 at 8:17 PM, Richard Williams
<richardwilliams.ndu@gmail.com> wrote:
> I don't think margins likes it when you use the noconstant option. Is it
> really necessary for your model?
>
> At 05:08 PM 6/8/2011, Urmi Bhattacharya wrote:
>>
>> Dear Statalisters,
>>
>> I am running the following logit on a person-period data
>>
>> logit school_left childage i.childfemale i.urban i.scstobc
>> i.casteother i.dadp i.dadm i.momp i.momm wagep wage5 wage8 w
>> > age9 distp distm disth percapcons durat1 durat2 durat3 durat4 durat5
>> > durat6 durat7 durat8 durat9 durat10 durat11, nocon
>> > s nolog
>>
>> Logistic regression                               Number of obs   =
>>  47569
>>                                                  Wald chi2(28)   =
>> 14601.42
>> Log likelihood = -14502.393                       Prob > chi2     =
>> 0.0000
>>
>>
>> ------------------------------------------------------------------------------
>>  school_left |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
>> Interval]
>>
>> -------------+----------------------------------------------------------------
>>    childage |  -.1413654    .006069   -23.29   0.000    -.1532605
>> -.1294703
>> 1.childfem~e |   .0212387   .0306462     0.69   0.488    -.0388266
>>  .0813041
>>     1.urban |   .0124911   .0368072     0.34   0.734    -.0596497
>>  .0846319
>>   1.scstobc |   1.972676   .1234074    15.99   0.000     1.730802
>> 2.21455
>> 1.casteother |   1.883233    .125722    14.98   0.000     1.636822
>>  2.129643
>>      1.dadp |    .680585    .044327    15.35   0.000     .5937057
>>  .7674643
>>      1.dadm |   .3872552   .0506982     7.64   0.000     .2878886
>>  .4866217
>>      1.momp |   1.351053   .0835161    16.18   0.000     1.187364
>>  1.514741
>>      1.momm |   .9494066   .0918146    10.34   0.000     .7694532
>> 1.12936
>>       wagep |  -.0281962   .0061845    -4.56   0.000    -.0403176
>> -.0160748
>>       wage5 |  -.0040992   .0045604    -0.90   0.369    -.0130373
>> .004839
>>       wage8 |    .021027   .0043869     4.79   0.000     .0124289
>>  .0296251
>>       wage9 |   .0159427   .0022335     7.14   0.000     .0115652
>>  .0203203
>>       distp |  -.0355589   .0162329    -2.19   0.028    -.0673748
>> -.0037431
>>       distm |  -.0024083   .0112658    -0.21   0.831    -.0244888
>>  .0196722
>>       disth |   .0186932   .0039384     4.75   0.000      .010974
>>  .0264124
>>  percapcons |  -.0001459   .0000278    -5.26   0.000    -.0002003
>> -.0000915
>>      durat1 |  -5.771466   .1406919   -41.02   0.000    -6.047217
>> -5.495715
>>      durat2 |  -4.947835   .1222363   -40.48   0.000    -5.187414
>> -4.708256
>>      durat3 |  -4.690019   .1193602   -39.29   0.000    -4.923961
>> -4.456078
>>      durat4 |  -4.054464   .1132586   -35.80   0.000    -4.276447
>> -3.832481
>>      durat5 |  -3.055883   .1082449   -28.23   0.000    -3.268039
>> -2.843727
>>      durat6 |  -3.560284   .1130896   -31.48   0.000    -3.781936
>> -3.338633
>>      durat7 |  -2.825943   .1099477   -25.70   0.000    -3.041436
>> -2.610449
>>      durat8 |  -2.238741   .1094063   -20.46   0.000    -2.453173
>> -2.024308
>>      durat9 |  -1.427979   .1099217   -12.99   0.000    -1.643421
>> -1.212536
>>     durat10 |  -.3967904   .1152271    -3.44   0.001    -.6226313
>> -.1709495
>>     durat11 |  -2.168164   .1486318   -14.59   0.000    -2.459477
>> -1.876851
>>
>> ------------------------------------------------------------------------------
>>
>> .
>> end of do-file
>>
>> Since I am interested in the marginal effects of the variables on the
>> probability of hazard,
>>
>> I do
>>
>> margins,dydx(*)
>>
>> But this gives me the following output
>>
>>  margins,dydx(*)
>>
>> Average marginal effects                          Number of obs   =
>>  47569
>> Model VCE    : OIM
>>
>> Expression   : Pr(school_left), predict()
>> dy/dx w.r.t. : childage 1.childfemale 1.urban 1.scstobc 1.casteother
>> 1.dadp 1.dadm 1.momp 1.momm wagep wage5 wage8
>>               wage9 distp distm disth percapcons durat1 durat2 durat3
>> durat4 durat5 durat6 durat7 durat8 durat9
>>               durat10 durat11
>>
>>
>> ------------------------------------------------------------------------------
>>             |            Delta-method
>>             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf.
>> Interval]
>>
>> -------------+----------------------------------------------------------------
>>    childage |  (not estimable)
>> 1.childfem~e |  (not estimable)
>>     1.urban |  (not estimable)
>>   1.scstobc |  (not estimable)
>> 1.casteother |  (not estimable)
>>      1.dadp |  (not estimable)
>>      1.dadm |  (not estimable)
>>      1.momp |  (not estimable)
>>      1.momm |  (not estimable)
>>       wagep |  (not estimable)
>>       wage5 |  (not estimable)
>>       wage8 |  (not estimable)
>>       wage9 |  (not estimable)
>>       distp |  (not estimable)
>>       distm |  (not estimable)
>>       disth |  (not estimable)
>>  percapcons |  (not estimable)
>>      durat1 |  (not estimable)
>>      durat2 |  (not estimable)
>>      durat3 |  (not estimable)
>>      durat4 |  (not estimable)
>>      durat5 |  (not estimable)
>>      durat6 |  (not estimable)
>>      durat7 |  (not estimable)
>>      durat8 |  (not estimable)
>>      durat9 |  (not estimable)
>>     durat10 |  (not estimable)
>>     durat11 |  (not estimable)
>>
>> ------------------------------------------------------------------------------
>> Note: dy/dx for factor levels is the discrete change from the base level.
>>
>> Can someone explain what am I doing wrong? How do I get the marginal
>> effects after running the logit?
>>
>> Best
>>
>> Urmi
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW:    http://www.nd.edu/~rwilliam
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index