|
54 | 54 | "\n", |
55 | 55 | "In the case of MPEC also starting values for the discretized expected value function are necessary and they are set to the zero vector every time: $EV^0_1,...,EV^0_{175}=(0,...,0)$. The subscript of 175 also displays the grid size that Iskhakov et al. choose to discretize the continuous variable of mileage. The starting values of the transition probabilities are frequency based in the paper and we follow this approach in our implementation.\n", |
56 | 56 | "\n", |
57 | | - "All those ingredients can be found below in the code. Further in our code for the NFXP we specify stopping criteria for the fixed point calculation as well as the tolerance at which we switch from contraction steps to Newton-Kantorovich (N-K) steps. Here, there is a first difference in our implementation of the NFXP as there is no switching back from N-K to contraction steps implemented. Furthermore the switching tolerance is solely an absolute one. For the routine to maximize the likelihood function we rely on the BHHH implementation of estimagic which uses a combination of relative and absolute stopping tolerance which also does not exactly match the original paper. \n", |
| 57 | + "All those ingredients can be found below in the code. Further in our code for the NFXP we specify stopping criteria for the fixed point calculation as well as the tolerance at which we switch from contraction steps to Newton-Kantorovich (N-K) steps. Here, there is a first difference in our implementation of the NFXP as there is no switching back from N-K to contraction steps implemented. Furthermore the switching tolerance is solely an absolute one. For the routine to maximize the likelihood function we rely on the scipy L-BFGS-B povided by estimagic which uses a combination of relative and absolute stopping tolerance which also does not exactly match the original paper. Further the authors employ the BHHH algorithm instead of the L-BFGS-B which we will follow as well as soon as the algorithm is available on estimagic.\n", |
58 | 58 | "\n", |
59 | 59 | "For MPEC we could not rely on KNITRO as in the paper as it is not freely available. In ruspy it is possible to choose from the library of nlopt or use ipopt for MPEC (please see the References below for links to the respective documentation). For the recreation of the table in Iskhakov et al. we decided to use nlopt here. Again the stopping tolerances cannot exactly be set to those of KNITRO in the paper. Another notable difference is that we only give analytical first order derivatives to nlopt. In the paper, on top of that second order analytical derivatives are provided by using automatic differentiation and also the sparsity patterns of both order derivatives are passed in. Apart from that, though, our setup replicates the paper by using upper and lower bounds as well as a properly recentering the expected value function. \n", |
60 | 60 | "\n", |
|
137 | 137 | " },\n", |
138 | 138 | " \"optimizer\": {\n", |
139 | 139 | " \"approach\": \"NFXP\",\n", |
140 | | - " \"algorithm\": \"estimagic_bhhh\",\n", |
| 140 | + " \"algorithm\": \"scipy_L-BFGS-B\",\n", |
141 | 141 | " # implies that we use analytical first order derivatives as opposed to numerical ones\n", |
142 | 142 | " \"gradient\": \"Yes\", \n", |
143 | 143 | " },\n", |
|
320 | 320 | " <th rowspan=\"2\" valign=\"top\">0</th>\n", |
321 | 321 | " <th rowspan=\"2\" valign=\"top\">0</th>\n", |
322 | 322 | " <th>NFXP</th>\n", |
323 | | - " <td>15.2276</td>\n", |
324 | | - " <td>3.68877</td>\n", |
| 323 | + " <td>15.2277</td>\n", |
| 324 | + " <td>3.6888</td>\n", |
325 | 325 | " <td>0.0913333</td>\n", |
326 | 326 | " <td>0.4475</td>\n", |
327 | 327 | " <td>0.446</td>\n", |
328 | 328 | " <td>0.0146667</td>\n", |
329 | | - " <td>1.67625</td>\n", |
| 329 | + " <td>0.62913</td>\n", |
330 | 330 | " <td>1</td>\n", |
331 | | - " <td>18</td>\n", |
332 | | - " <td>19</td>\n", |
333 | | - " <td>400</td>\n", |
334 | | - " <td>153</td>\n", |
| 331 | + " <td>14</td>\n", |
| 332 | + " <td>15</td>\n", |
| 333 | + " <td>320</td>\n", |
| 334 | + " <td>108</td>\n", |
335 | 335 | " </tr>\n", |
336 | 336 | " <tr>\n", |
337 | 337 | " <th>MPEC</th>\n", |
|
341 | 341 | " <td>0.4475</td>\n", |
342 | 342 | " <td>0.446</td>\n", |
343 | 343 | " <td>0.0146667</td>\n", |
344 | | - " <td>0.825351</td>\n", |
| 344 | + " <td>0.642238</td>\n", |
345 | 345 | " <td>1</td>\n", |
346 | 346 | " <td>14</td>\n", |
347 | 347 | " <td>14</td>\n", |
|
352 | 352 | " <th rowspan=\"2\" valign=\"top\">1</th>\n", |
353 | 353 | " <th rowspan=\"2\" valign=\"top\">0</th>\n", |
354 | 354 | " <th>NFXP</th>\n", |
355 | | - " <td>11.9635</td>\n", |
356 | | - " <td>2.49318</td>\n", |
| 355 | + " <td>11.9636</td>\n", |
| 356 | + " <td>2.49321</td>\n", |
357 | 357 | " <td>0.091</td>\n", |
358 | 358 | " <td>0.4535</td>\n", |
359 | 359 | " <td>0.444833</td>\n", |
360 | 360 | " <td>0.0106667</td>\n", |
361 | | - " <td>1.0243</td>\n", |
| 361 | + " <td>0.746165</td>\n", |
362 | 362 | " <td>1</td>\n", |
363 | | - " <td>9</td>\n", |
364 | | - " <td>11</td>\n", |
365 | | - " <td>240</td>\n", |
366 | | - " <td>82</td>\n", |
| 363 | + " <td>14</td>\n", |
| 364 | + " <td>17</td>\n", |
| 365 | + " <td>355</td>\n", |
| 366 | + " <td>120</td>\n", |
367 | 367 | " </tr>\n", |
368 | 368 | " <tr>\n", |
369 | 369 | " <th>MPEC</th>\n", |
|
373 | 373 | " <td>0.4535</td>\n", |
374 | 374 | " <td>0.444833</td>\n", |
375 | 375 | " <td>0.0106667</td>\n", |
376 | | - " <td>0.860147</td>\n", |
| 376 | + " <td>0.573166</td>\n", |
377 | 377 | " <td>1</td>\n", |
378 | 378 | " <td>13</td>\n", |
379 | 379 | " <td>13</td>\n", |
|
385 | 385 | " <th>0</th>\n", |
386 | 386 | " <th>NFXP</th>\n", |
387 | 387 | " <td>12.2255</td>\n", |
388 | | - " <td>2.35603</td>\n", |
| 388 | + " <td>2.35604</td>\n", |
389 | 389 | " <td>0.0825</td>\n", |
390 | 390 | " <td>0.460333</td>\n", |
391 | 391 | " <td>0.444833</td>\n", |
392 | 392 | " <td>0.0121667</td>\n", |
393 | | - " <td>0.909865</td>\n", |
| 393 | + " <td>0.807471</td>\n", |
394 | 394 | " <td>1</td>\n", |
395 | | - " <td>9</td>\n", |
396 | | - " <td>11</td>\n", |
397 | | - " <td>240</td>\n", |
398 | | - " <td>82</td>\n", |
| 395 | + " <td>16</td>\n", |
| 396 | + " <td>18</td>\n", |
| 397 | + " <td>352</td>\n", |
| 398 | + " <td>124</td>\n", |
399 | 399 | " </tr>\n", |
400 | 400 | " <tr>\n", |
401 | 401 | " <th>...</th>\n", |
|
424 | 424 | " <td>0.447</td>\n", |
425 | 425 | " <td>0.448833</td>\n", |
426 | 426 | " <td>0.0123333</td>\n", |
427 | | - " <td>0.715148</td>\n", |
| 427 | + " <td>0.753175</td>\n", |
428 | 428 | " <td>1</td>\n", |
429 | 429 | " <td>13</td>\n", |
430 | 430 | " <td>13</td>\n", |
|
435 | 435 | " <th rowspan=\"2\" valign=\"top\">98</th>\n", |
436 | 436 | " <th rowspan=\"2\" valign=\"top\">0</th>\n", |
437 | 437 | " <th>NFXP</th>\n", |
438 | | - " <td>10.9554</td>\n", |
439 | | - " <td>2.19765</td>\n", |
| 438 | + " <td>10.9552</td>\n", |
| 439 | + " <td>2.19758</td>\n", |
440 | 440 | " <td>0.0913333</td>\n", |
441 | 441 | " <td>0.4465</td>\n", |
442 | 442 | " <td>0.447333</td>\n", |
443 | 443 | " <td>0.0145</td>\n", |
444 | | - " <td>1.16698</td>\n", |
| 444 | + " <td>0.86645</td>\n", |
445 | 445 | " <td>1</td>\n", |
446 | | - " <td>10</td>\n", |
447 | | - " <td>12</td>\n", |
448 | | - " <td>260</td>\n", |
449 | | - " <td>83</td>\n", |
| 446 | + " <td>14</td>\n", |
| 447 | + " <td>17</td>\n", |
| 448 | + " <td>357</td>\n", |
| 449 | + " <td>112</td>\n", |
450 | 450 | " </tr>\n", |
451 | 451 | " <tr>\n", |
452 | 452 | " <th>MPEC</th>\n", |
|
456 | 456 | " <td>0.4465</td>\n", |
457 | 457 | " <td>0.447333</td>\n", |
458 | 458 | " <td>0.0145</td>\n", |
459 | | - " <td>0.661679</td>\n", |
| 459 | + " <td>0.684407</td>\n", |
460 | 460 | " <td>1</td>\n", |
461 | 461 | " <td>12</td>\n", |
462 | 462 | " <td>12</td>\n", |
|
467 | 467 | " <th rowspan=\"2\" valign=\"top\">99</th>\n", |
468 | 468 | " <th rowspan=\"2\" valign=\"top\">0</th>\n", |
469 | 469 | " <th>NFXP</th>\n", |
470 | | - " <td>11.4836</td>\n", |
471 | | - " <td>2.33456</td>\n", |
| 470 | + " <td>11.4834</td>\n", |
| 471 | + " <td>2.33454</td>\n", |
472 | 472 | " <td>0.0941667</td>\n", |
473 | 473 | " <td>0.4485</td>\n", |
474 | 474 | " <td>0.444667</td>\n", |
475 | 475 | " <td>0.0125</td>\n", |
476 | | - " <td>1.12599</td>\n", |
| 476 | + " <td>0.861002</td>\n", |
477 | 477 | " <td>1</td>\n", |
478 | | - " <td>10</td>\n", |
479 | | - " <td>12</td>\n", |
480 | | - " <td>260</td>\n", |
481 | | - " <td>89</td>\n", |
| 478 | + " <td>14</td>\n", |
| 479 | + " <td>16</td>\n", |
| 480 | + " <td>331</td>\n", |
| 481 | + " <td>111</td>\n", |
482 | 482 | " </tr>\n", |
483 | 483 | " <tr>\n", |
484 | 484 | " <th>MPEC</th>\n", |
|
488 | 488 | " <td>0.4485</td>\n", |
489 | 489 | " <td>0.444667</td>\n", |
490 | 490 | " <td>0.0125</td>\n", |
491 | | - " <td>0.759221</td>\n", |
| 491 | + " <td>0.755911</td>\n", |
492 | 492 | " <td>1</td>\n", |
493 | 493 | " <td>13</td>\n", |
494 | 494 | " <td>13</td>\n", |
|
503 | 503 | "text/plain": [ |
504 | 504 | " RC theta_11 theta_30 theta_31 \\\n", |
505 | 505 | "Discount Factor Run Start Approach \n", |
506 | | - "0.975 0 0 NFXP 15.2276 3.68877 0.0913333 0.4475 \n", |
| 506 | + "0.975 0 0 NFXP 15.2277 3.6888 0.0913333 0.4475 \n", |
507 | 507 | " MPEC 15.2386 3.69232 0.0913333 0.4475 \n", |
508 | | - " 1 0 NFXP 11.9635 2.49318 0.091 0.4535 \n", |
| 508 | + " 1 0 NFXP 11.9636 2.49321 0.091 0.4535 \n", |
509 | 509 | " MPEC 11.9649 2.49367 0.091 0.4535 \n", |
510 | | - " 2 0 NFXP 12.2255 2.35603 0.0825 0.460333 \n", |
| 510 | + " 2 0 NFXP 12.2255 2.35604 0.0825 0.460333 \n", |
511 | 511 | "... ... ... ... ... \n", |
512 | 512 | " 97 0 MPEC 12.3231 2.66631 0.0918333 0.447 \n", |
513 | | - " 98 0 NFXP 10.9554 2.19765 0.0913333 0.4465 \n", |
| 513 | + " 98 0 NFXP 10.9552 2.19758 0.0913333 0.4465 \n", |
514 | 514 | " MPEC 10.9566 2.19815 0.0913333 0.4465 \n", |
515 | | - " 99 0 NFXP 11.4836 2.33456 0.0941667 0.4485 \n", |
| 515 | + " 99 0 NFXP 11.4834 2.33454 0.0941667 0.4485 \n", |
516 | 516 | " MPEC 11.4843 2.33482 0.0941667 0.4485 \n", |
517 | 517 | "\n", |
518 | 518 | " theta_32 theta_33 CPU Time Converged \\\n", |
519 | 519 | "Discount Factor Run Start Approach \n", |
520 | | - "0.975 0 0 NFXP 0.446 0.0146667 1.67625 1 \n", |
521 | | - " MPEC 0.446 0.0146667 0.825351 1 \n", |
522 | | - " 1 0 NFXP 0.444833 0.0106667 1.0243 1 \n", |
523 | | - " MPEC 0.444833 0.0106667 0.860147 1 \n", |
524 | | - " 2 0 NFXP 0.444833 0.0121667 0.909865 1 \n", |
| 520 | + "0.975 0 0 NFXP 0.446 0.0146667 0.62913 1 \n", |
| 521 | + " MPEC 0.446 0.0146667 0.642238 1 \n", |
| 522 | + " 1 0 NFXP 0.444833 0.0106667 0.746165 1 \n", |
| 523 | + " MPEC 0.444833 0.0106667 0.573166 1 \n", |
| 524 | + " 2 0 NFXP 0.444833 0.0121667 0.807471 1 \n", |
525 | 525 | "... ... ... ... ... \n", |
526 | | - " 97 0 MPEC 0.448833 0.0123333 0.715148 1 \n", |
527 | | - " 98 0 NFXP 0.447333 0.0145 1.16698 1 \n", |
528 | | - " MPEC 0.447333 0.0145 0.661679 1 \n", |
529 | | - " 99 0 NFXP 0.444667 0.0125 1.12599 1 \n", |
530 | | - " MPEC 0.444667 0.0125 0.759221 1 \n", |
| 526 | + " 97 0 MPEC 0.448833 0.0123333 0.753175 1 \n", |
| 527 | + " 98 0 NFXP 0.447333 0.0145 0.86645 1 \n", |
| 528 | + " MPEC 0.447333 0.0145 0.684407 1 \n", |
| 529 | + " 99 0 NFXP 0.444667 0.0125 0.861002 1 \n", |
| 530 | + " MPEC 0.444667 0.0125 0.755911 1 \n", |
531 | 531 | "\n", |
532 | 532 | " # of Major Iter. # of Func. Eval. \\\n", |
533 | 533 | "Discount Factor Run Start Approach \n", |
534 | | - "0.975 0 0 NFXP 18 19 \n", |
| 534 | + "0.975 0 0 NFXP 14 15 \n", |
535 | 535 | " MPEC 14 14 \n", |
536 | | - " 1 0 NFXP 9 11 \n", |
| 536 | + " 1 0 NFXP 14 17 \n", |
537 | 537 | " MPEC 13 13 \n", |
538 | | - " 2 0 NFXP 9 11 \n", |
| 538 | + " 2 0 NFXP 16 18 \n", |
539 | 539 | "... ... ... \n", |
540 | 540 | " 97 0 MPEC 13 13 \n", |
541 | | - " 98 0 NFXP 10 12 \n", |
| 541 | + " 98 0 NFXP 14 17 \n", |
542 | 542 | " MPEC 12 12 \n", |
543 | | - " 99 0 NFXP 10 12 \n", |
| 543 | + " 99 0 NFXP 14 16 \n", |
544 | 544 | " MPEC 13 13 \n", |
545 | 545 | "\n", |
546 | 546 | " # of Bellm. Iter. # of N-K Iter. \n", |
547 | 547 | "Discount Factor Run Start Approach \n", |
548 | | - "0.975 0 0 NFXP 400 153 \n", |
| 548 | + "0.975 0 0 NFXP 320 108 \n", |
549 | 549 | " MPEC NaN NaN \n", |
550 | | - " 1 0 NFXP 240 82 \n", |
| 550 | + " 1 0 NFXP 355 120 \n", |
551 | 551 | " MPEC NaN NaN \n", |
552 | | - " 2 0 NFXP 240 82 \n", |
| 552 | + " 2 0 NFXP 352 124 \n", |
553 | 553 | "... ... ... \n", |
554 | 554 | " 97 0 MPEC NaN NaN \n", |
555 | | - " 98 0 NFXP 260 83 \n", |
| 555 | + " 98 0 NFXP 357 112 \n", |
556 | 556 | " MPEC NaN NaN \n", |
557 | | - " 99 0 NFXP 260 89 \n", |
| 557 | + " 99 0 NFXP 331 111 \n", |
558 | 558 | " MPEC NaN NaN \n", |
559 | 559 | "\n", |
560 | 560 | "[200 rows x 12 columns]" |
|
1048 | 1048 | " <tr>\n", |
1049 | 1049 | " <th rowspan=\"2\" valign=\"top\">0.975</th>\n", |
1050 | 1050 | " <th>MPEC</th>\n", |
1051 | | - " <td>0.701</td>\n", |
| 1051 | + " <td>0.645</td>\n", |
1052 | 1052 | " <td>100.0</td>\n", |
1053 | 1053 | " <td>12.75</td>\n", |
1054 | 1054 | " <td>12.75</td>\n", |
|
1057 | 1057 | " </tr>\n", |
1058 | 1058 | " <tr>\n", |
1059 | 1059 | " <th>NFXP</th>\n", |
1060 | | - " <td>1.258</td>\n", |
| 1060 | + " <td>0.771</td>\n", |
1061 | 1061 | " <td>100.0</td>\n", |
1062 | | - " <td>11.34</td>\n", |
1063 | | - " <td>13.24</td>\n", |
1064 | | - " <td>283.9</td>\n", |
1065 | | - " <td>98.33</td>\n", |
| 1062 | + " <td>13.69</td>\n", |
| 1063 | + " <td>15.36</td>\n", |
| 1064 | + " <td>321.58</td>\n", |
| 1065 | + " <td>105.68</td>\n", |
1066 | 1066 | " </tr>\n", |
1067 | 1067 | " </tbody>\n", |
1068 | 1068 | "</table>\n", |
|
1071 | 1071 | "text/plain": [ |
1072 | 1072 | " CPU Time Converged # of Major Iter. \\\n", |
1073 | 1073 | "Discount Factor Approach \n", |
1074 | | - "0.975 MPEC 0.701 100.0 12.75 \n", |
1075 | | - " NFXP 1.258 100.0 11.34 \n", |
| 1074 | + "0.975 MPEC 0.645 100.0 12.75 \n", |
| 1075 | + " NFXP 0.771 100.0 13.69 \n", |
1076 | 1076 | "\n", |
1077 | 1077 | " # of Func. Eval. # of Bellm. Iter. # of N-K Iter. \n", |
1078 | 1078 | "Discount Factor Approach \n", |
1079 | 1079 | "0.975 MPEC 12.75 NaN NaN \n", |
1080 | | - " NFXP 13.24 283.9 98.33 " |
| 1080 | + " NFXP 15.36 321.58 105.68 " |
1081 | 1081 | ] |
1082 | 1082 | }, |
1083 | 1083 | "execution_count": 15, |
|
0 commit comments