Dear Statalist Community,
I have a question regarding the estimation of a degenerated nested logit. After some research it looks this question has been previously asked, but never answered. The problem is how to estimate a degenerated nested logit model using the
command.
I am trying to estimate the choice between studying and not studying and among those individuals that study I want to see which major they pick. The problem is that when I run the nlogit command the iteration never converges. Here I include the code, the error, and the data used:
Error:
Data:
I have a question regarding the estimation of a degenerated nested logit. After some research it looks this question has been previously asked, but never answered. The problem is how to estimate a degenerated nested logit model using the
Code:
nlogit
I am trying to estimate the choice between studying and not studying and among those individuals that study I want to see which major they pick. The problem is that when I run the nlogit command the iteration never converges. Here I include the code, the error, and the data used:
Code:
nlogit major_choosen fulltime incwage || graduated: aveparinc asvab|| majornlsy:, noconstant case(CHILD_ID)
Code:
nlogit major_choosen fulltime incwage || graduated: aveparinc asvab|| majornlsy:, noconstant case(CHILD_ID) note: 4518 cases dropped because they have only one alternative note: 9 cases (72 obs) dropped due to no positive outcome or multiple positive outcomes per case note: alternatives variable graduated does not vary tree structure specified for the nested logit model graduated N majornlsy N k ----------------------------------------- 1 19984 --- 1 2498 461 |- 2 2498 287 |- 3 2498 74 |- 4 2498 182 |- 5 2498 336 |- 6 2498 301 |- 7 2498 344 +- 8 2498 513 ----------------------------------------- total 19984 2498 k = number of times alternative is chosen N = number of observations at each level Iteration 0: log likelihood = -5112.1413 Iteration 1: log likelihood = -5112.1413 (backed up) Iteration 2: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 3: log likelihood = -5112.1413 Iteration 4: log likelihood = -5112.1413 (backed up) Iteration 5: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 6: log likelihood = -5112.1413 Iteration 7: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 8: log likelihood = -5112.1413 Iteration 9: log likelihood = -5112.1413 (backed up) Iteration 10: log likelihood = -5112.1413 BFGS stepping has contracted, resetting BFGS Hessian Iteration 11: log likelihood = -5112.1413 Iteration 12: log likelihood = -5112.1413 (backed up) Iteration 13: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 14: log likelihood = -5112.1413 (backed up) Iteration 15: log likelihood = -5112.1413 (backed up) Iteration 16: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 17: log likelihood = -5112.1413 Iteration 18: log likelihood = -5112.1413 (backed up) Iteration 19: log likelihood = -5112.1413 BFGS stepping has contracted, resetting BFGS Hessian Iteration 20: log likelihood = -5112.1413 Iteration 21: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 22: log likelihood = -5112.1413 Iteration 23: log likelihood = -5112.1413 (backed up) Iteration 24: log likelihood = -5112.1413 BFGS stepping has contracted, resetting BFGS Hessian Iteration 25: log likelihood = -5112.1413 (backed up) Iteration 26: log likelihood = -5112.1413 (backed up) Iteration 27: log likelihood = -5112.1413 (backed up) BFGS stepping has contracted, resetting BFGS Hessian Iteration 28: log likelihood = -5112.1413 (backed up) cannot compute an improvement -- flat region encountered
Data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int CHILD_ID float(aveparinc majornlsy) long asvab float(major_choosen graduated) double incwage float fulltime 6442 42468.9 0 69594 1 0 2477947.6363109956 .6811227 1363 39041.33 0 . 0 0 2475614.6363109956 .76 5337 33880.56 0 51223 0 0 2477947.6363109956 .6811227 4682 61228.8 0 4327 0 0 2477947.6363109956 .6811227 1901 63756.65 0 22738 0 0 2475614.6363109956 .76 4913 14391.074 0 84222 0 0 2477947.6363109956 .6811227 2826 28034.84 0 4301 0 0 2477947.6363109956 .6811227 3706 207782.1 0 54640 0 0 2477947.6363109956 .6811227 2014 85208.3 0 . 0 0 2477947.6363109956 .6811227 3996 19798.475 0 9246 0 0 2477947.6363109956 .6811227 5253 69565.18 0 . 0 0 2477947.6363109956 .6811227 8507 21434.74 0 2791 1 0 2477947.6363109956 .6811227 4978 19003.559 0 . 0 0 2477947.6363109956 .6811227 2260 27118.07 0 . 0 0 2477947.6363109956 .6811227 2257 51945.52 0 68920 0 0 2477947.6363109956 .6811227 8737 94262.81 0 . 1 0 2477947.6363109956 .6811227 5459 135520.44 0 20045 0 0 2477947.6363109956 .6811227 8866 23671.387 0 2469 1 0 2477947.6363109956 .6811227 7430 47726.38 0 8111 1 0 2477947.6363109956 .6811227 2475 164773.2 0 42842 0 0 2477947.6363109956 .6811227 5350 58495.14 0 43093 0 0 2477947.6363109956 .6811227 2325 65226.93 0 79063 0 0 2477947.6363109956 .6811227 570 113373.6 0 23397 0 0 2475614.6363109956 .76 1851 56678.73 0 22172 0 0 2475614.6363109956 .76 5354 55927.88 0 83148 0 0 2477947.6363109956 .6811227 6222 111944.81 0 . 1 0 2477947.6363109956 .6811227 6106 78628.3 0 15702 1 0 2477947.6363109956 .6811227 3350 45844.54 0 31770 0 0 2477947.6363109956 .6811227 5748 35796.688 0 29464 0 0 2477947.6363109956 .6811227 5356 90411.89 0 92504 0 0 2477947.6363109956 .6811227 830 85270.59 0 . 0 0 2475614.6363109956 .76 5860 18420.164 0 91935 0 0 2477947.6363109956 .6811227 5461 46120.61 0 16956 0 0 2477947.6363109956 .6811227 8614 38790.08 0 88622 1 0 2477947.6363109956 .6811227 8027 87894.8 0 246 1 0 2477947.6363109956 .6811227 8392 3951.8706 0 14114 1 0 2477947.6363109956 .6811227 3664 155395.27 0 27237 0 0 2477947.6363109956 .6811227 2412 84936.23 0 78371 0 0 2477947.6363109956 .6811227 7530 43385.97 0 37374 1 0 2477947.6363109956 .6811227 3209 13328.985 0 . 0 0 2477947.6363109956 .6811227 1766 49116.71 0 58786 0 0 2475614.6363109956 .76 6086 24570.23 0 3500 1 0 2477947.6363109956 .6811227 3266 81100.61 0 66661 0 0 2477947.6363109956 .6811227 3357 47456.62 0 . 0 0 2477947.6363109956 .6811227 2098 11791.878 0 . 0 0 2477947.6363109956 .6811227 126 101610.46 0 35303 0 0 2475614.6363109956 .76 3255 74073.14 0 61634 0 0 2477947.6363109956 .6811227 5365 16137.865 0 51804 0 0 2477947.6363109956 .6811227 2809 16883.371 0 20392 0 0 2477947.6363109956 .6811227 711 174788.55 0 70421 0 0 2475614.6363109956 .76 2122 48045.61 0 43902 0 0 2477947.6363109956 .6811227 4713 102375.9 0 1229 0 0 2477947.6363109956 .6811227 8632 . 0 . 1 0 2477947.6363109956 .6811227 1648 70232.336 0 73517 0 0 2475614.6363109956 .76 620 11520.572 0 . 0 0 2475614.6363109956 .76 7310 11621.348 0 8004 1 0 2477947.6363109956 .6811227 3866 45132.78 0 . 0 0 2477947.6363109956 .6811227 1254 85763.32 0 100000 0 0 2475614.6363109956 .76 160 14758.596 0 5463 0 0 2475614.6363109956 .76 7923 54932.95 0 8616 1 0 2477947.6363109956 .6811227 6777 19185.533 0 27137 1 0 2477947.6363109956 .6811227 8549 10000.21 0 12739 1 0 2477947.6363109956 .6811227 4933 22503.564 0 31111 0 0 2477947.6363109956 .6811227 1139 . 0 . 0 0 2475614.6363109956 .76 7250 12936.018 0 . 1 0 2477947.6363109956 .6811227 8563 43412.52 0 24562 1 0 2477947.6363109956 .6811227 4339 66045.8 0 9643 0 0 2477947.6363109956 .6811227 3355 48482.49 0 77827 0 0 2477947.6363109956 .6811227 9010 52539.33 0 61144 1 0 2477947.6363109956 .6811227 866 44267.98 0 . 0 0 2475614.6363109956 .76 460 13438.627 0 2010 0 0 2475614.6363109956 .76 6441 78058.16 0 81785 1 0 2477947.6363109956 .6811227 7580 12215.717 0 5279 1 0 2477947.6363109956 .6811227 16 16879.293 0 44451 0 0 2475614.6363109956 .76 5414 55741.36 0 10238 0 0 2477947.6363109956 .6811227 1196 100057.4 0 . 0 0 2475614.6363109956 .76 4500 68907.555 0 23712 0 0 2477947.6363109956 .6811227 8272 14226.229 0 0 1 0 2477947.6363109956 .6811227 1833 68641.164 0 39234 0 0 2475614.6363109956 .76 2930 104045.34 0 49980 0 0 2477947.6363109956 .6811227 1347 81293.16 0 98307 0 0 2475614.6363109956 .76 5507 55387.07 0 25489 0 0 2477947.6363109956 .6811227 582 21938.99 0 8072 0 0 2475614.6363109956 .76 1737 39426.21 0 32699 0 0 2475614.6363109956 .76 8116 81471.6 0 62873 1 0 2477947.6363109956 .6811227 29 47374.48 0 . 0 0 2475614.6363109956 .76 3351 190708.66 0 48686 0 0 2477947.6363109956 .6811227 2502 8659.459 0 1386 0 0 2477947.6363109956 .6811227 5381 43799.02 0 69813 0 0 2477947.6363109956 .6811227 3108 21424.52 0 578 0 0 2477947.6363109956 .6811227 5382 40366.96 0 70490 0 0 2477947.6363109956 .6811227 7661 41641.71 0 135 1 0 2477947.6363109956 .6811227 4772 74203.05 0 73298 0 0 2477947.6363109956 .6811227 4773 56703.79 0 42185 0 0 2477947.6363109956 .6811227 7075 11630.74 0 14863 1 0 2477947.6363109956 .6811227 1013 90906.92 0 68139 0 0 2475614.6363109956 .76 7518 10855.753 0 9994 1 0 2477947.6363109956 .6811227 7832 11371.735 0 16329 1 0 2477947.6363109956 .6811227 5385 99861.23 0 38264 0 0 2477947.6363109956 .6811227 3942 28150.586 0 . 0 0 2477947.6363109956 .6811227 end