Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: logit results not matching with ml


From   Tulika Narayan <[email protected]>
To   statalist <[email protected]>
Subject   st: logit results not matching with ml
Date   Wed, 18 Jul 2007 17:30:56 -0400

Hello,

Stata version 8.0

I am trying to run a non linear logit but before I do that, just to test my
work I wrote the logit using stata's ml command but cannot get it to
replacate the logit results. In fact the likelihood does not even converge.

Here is the logit command I use

logit green_present water_eda mixing_zone i_human temp_avg  sal_avg oxy_avg
coll_bottom   oth_crab   shell_present pol_flow

The results

Iteration 0:   log likelihood = -37.362775
Iteration 1:   log likelihood =  -21.42294
Iteration 2:   log likelihood = -19.458412
Iteration 3:   log likelihood = -18.924528
Iteration 4:   log likelihood = -18.641708
Iteration 5:   log likelihood =  -18.61557
Iteration 6:   log likelihood = -18.615379

Logit estimates                                   Number of obs   =
58
                                                   LR chi2(10)     =
37.49
                                                   Prob > chi2     =
0.0000
Log likelihood = -18.615379                       Pseudo R2       =
0.5018

------------------------------------------------------------------------------
green_pres~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
water_edac~a |   .0093596   .0085614     1.09   0.274    -.0074204
0261396
  mixing_zone |  -.0115959   .0109941    -1.05   0.292    -.0331439
009952
      i_human |  -.4338438   .4151365    -1.05   0.296    -1.247496
3798089
     temp_avg |  -.5166932   .2147708    -2.41   0.016    -.9376362
-.0957502
      sal_avg |  -.0085234   .0685798    -0.12   0.901    -.1429375
1258906
      oxy_avg |  -.4012752   .4969768    -0.81   0.419    -1.375332
5727814
  coll_bottom |  -.1368686   .0534403    -2.56   0.010    -.2416096
-.0321276
     oth_crab |  -.8857099   .5262265    -1.68   0.092    -1.917095
145675
shell_pres~t |   .5593585   .4635706     1.21   0.228    -.3492232
1.46794
     pol_flow |   4.28e-07   4.20e-07     1.02   0.308    -3.95e-07    1.25
e-06
        _cons |   16.81088   7.657698     2.20   0.028     1.802072
31.8197
------------------------------------------------------------------------------

note: 0 failures and 1 success completely determined.

Here is the equivalent ml command.

capture program drop mymle1
program define mymle1

       version 8.0
       args lnf  theta1
       quietly replace `lnf' = exp(`theta1')/(1+exp(`theta1')) if $ML_y1 ==
1
       quietly replace `lnf' = 1/(1+exp(`theta1'))  if $ML_y1  == 0

end

local x1 "water_eda mixing_zone i_human temp_avg  sal_avg oxy_avg
coll_bottom   oth_crab   shell_present pol_flow"
ml model lf mymle1 (green_present  = `x1')
ml search


  ml maximize, difficult

Results

initial:       log likelihood =         29
alternative:   log likelihood =  31.204268
rescale:       log likelihood =         38
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 0:   log likelihood =         38  (not concave)
Iteration 1:   log likelihood =  40.018216  (not concave)
Iteration 2:   log likelihood =  42.041076  (not concave)
Iteration 3:   log likelihood =  43.042035  (not concave)
Iteration 4:   log likelihood =  43.042049  (not concave)
Iteration 5:   log likelihood =  43.042098  (not concave)
Iteration 6:   log likelihood =  43.042103  (not concave)
Iteration 7:   log likelihood =  43.042104  (not concave)

                                                   Number of obs   =
58
                                                   Wald chi2(0)    =
.
Log likelihood =  43.042104                       Prob > chi2     =
.

------------------------------------------------------------------------------
green_pres~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
water_edac~a |   .7304996          .        .       .            .
.
  mixing_zone |  -45.97343          .        .       .            .
.
      i_human |   .9961338          .        .       .            .
.
     temp_avg |   3.576235          .        .       .            .
.
      sal_avg |   10.37114          .        .       .            .
.
      oxy_avg |   2.229273          .        .       .            .
.
  coll_bottom |   -.008225          .        .       .            .
.
     oth_crab |   .0822529          .        .       .            .
.
shell_pres~t |   .3959996          .        .       .            .
.
     pol_flow |   .0000723          .        .       .            .
.
        _cons |   64.28164          .        .       .            .
.
------------------------------------------------------------------------------


To help out the program, I gave the initial values from my logit

ml init _cons =16.81 water_ = 0.009 mixing_zone = -0.115 i_human = -0.4338
temp_avg =-0.516 sal_avg = -0.008 oxy_avg =-.401 coll_bott =-.136 oth_crab
=-.885 shell_p = 0.559 pol_flow = 0.00000428
ml maximize, difficult

here are the results;

Iteration 548: log likelihood =  50.644631  (backed up)
Iteration 549: log likelihood =  50.998166
Iteration 550: log likelihood =  50.999718
Iteration 551: log likelihood =  50.999727
Iteration 552: log likelihood =  50.999729  (backed up)

                                                   Number of obs   =
58
                                                   Wald chi2(10)   =
0.03
Log likelihood =  50.999729                       Prob > chi2     =
1.0000

------------------------------------------------------------------------------
green_pres~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
water_edac~a |   .1632521   6.509305     0.03   0.980    -12.59475
12.92125
  mixing_zone |  -.6579379   16.14404    -0.04   0.967    -32.29968
30.98381
      i_human |  -10.32971   355.4003    -0.03   0.977    -706.9014
686.242
     temp_avg |  -2.120966   122.1783    -0.02   0.986    -241.5861
237.3442
      sal_avg |   1.818757   73.21652     0.02   0.980     -141.683
145.3205
      oxy_avg |   -10.8222   758.9438    -0.01   0.989    -1498.325
1476.68
  coll_bottom |  -2.091746   65.72668    -0.03   0.975    -130.9137
126.7302
     oth_crab |  -1.069122   299.9436    -0.00   0.997    -588.9478
586.8096
shell_pres~t |   5.361836   86.95624     0.06   0.951    -165.0693
175.7929
     pol_flow |   .0000152   .0004314     0.04   0.972    -.0008304
0008608
        _cons |   159.9001   7109.956     0.02   0.982    -13775.36
14095.16
-----------------------------------


Could any point out what I am doing wrong?

Thanks

Best,
Tulika
____________________________________
Tulika A. Narayan, Ph.D.
Environment & Resources Division
Abt Associates Inc.
4800 Montgomery Lane, Suite 600
Bethesda, MD 20814
Phone: (301) 347 5549  Fax: (301) 652 7530
____________________________________
-----------------------------------------
This message may contain privileged and confidential information intended
solely for the addressee. Please do not read, disseminate or copy it unless
you are the intended recipient.  If this message has been received in
error, we kindly ask that you notify the sender immediately by return email
and delete all copies of the message from your system. Thank you.
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index