|
62 | 62 | "cell_type": "markdown", |
63 | 63 | "metadata": {}, |
64 | 64 | "source": [ |
65 | | - "## Setup Estimation\n", |
66 | | - "\n", |
| 65 | + "## Setup Estimation" |
| 66 | + ] |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "markdown", |
| 70 | + "metadata": {}, |
| 71 | + "source": [ |
| 72 | + "<div class=\"alert alert-block alert-info\">\n", |
| 73 | + "**Note:** This guide was created using version 0.0.31 of estimagic and version 2.0.0 of respy. Please note that the guide is not updated regularly so using newer versions of the packages may require adjustments to the code.\n", |
| 74 | + "</div>" |
| 75 | + ] |
| 76 | + }, |
| 77 | + { |
| 78 | + "cell_type": "markdown", |
| 79 | + "metadata": {}, |
| 80 | + "source": [ |
67 | 81 | "### Configure MSM Inputs" |
68 | 82 | ] |
69 | 83 | }, |
|
906 | 920 | " replace_nans=replace_nans,\n", |
907 | 921 | " empirical_moments=empirical_moments,\n", |
908 | 922 | " weighting_matrix=weighting_matrix,\n", |
909 | | - " return_scalar=False,\n", |
| 923 | + " return_simulated_moments=True,\n", |
910 | 924 | ")" |
911 | 925 | ] |
912 | 926 | }, |
|
928 | 942 | " fig, axes = plt.subplots(3, 2, figsize=(12, 10))\n", |
929 | 943 | " axes = axes.ravel()\n", |
930 | 944 | " for i, key in enumerate(params_dict):\n", |
931 | | - " out = get_simulated_moments(params_dict[key])\n", |
932 | | - " out[\"simulated_moments\"][moment_set].plot(ax=axes[i], title=key, ylim=[ymin, ymax])\n", |
| 945 | + " _, moments = get_simulated_moments(params_dict[key])\n", |
| 946 | + " moments[moment_set].plot(ax=axes[i], title=key, ylim=[ymin, ymax])\n", |
933 | 947 | " plt.tight_layout()\n", |
934 | 948 | "\n", |
935 | 949 | " empirical_moments[moment_set].plot(ax=axes[4], title=\"Observed\", ylim=[ymin, ymax])\n", |
|
1047 | 1061 | "metadata": {}, |
1048 | 1062 | "outputs": [], |
1049 | 1063 | "source": [ |
1050 | | - "out = get_simulated_moments(params_dict[\"(4) Final result\"])" |
| 1064 | + "_, simulated_moments = get_simulated_moments(params_dict[\"(4) Final result\"])" |
1051 | 1065 | ] |
1052 | 1066 | }, |
1053 | 1067 | { |
|
1060 | 1074 | "source": [ |
1061 | 1075 | "diff = {}\n", |
1062 | 1076 | "diff[\"Choice Frequencies\"] = (\n", |
1063 | | - " empirical_moments[\"Choice Frequencies\"] - out[\"simulated_moments\"][\"Choice Frequencies\"]\n", |
| 1077 | + " empirical_moments[\"Choice Frequencies\"] - simulated_moments[\"Choice Frequencies\"]\n", |
1064 | 1078 | ")" |
1065 | 1079 | ] |
1066 | 1080 | }, |
|
1078 | 1092 | "outputs": [], |
1079 | 1093 | "source": [ |
1080 | 1094 | "diff[\"Wage Distribution\"] = (\n", |
1081 | | - " empirical_moments[\"Wage Distribution\"] - out[\"simulated_moments\"][\"Wage Distribution\"]\n", |
| 1095 | + " empirical_moments[\"Wage Distribution\"] - simulated_moments[\"Wage Distribution\"]\n", |
1082 | 1096 | ") / empirical_moments[\"Wage Distribution\"]" |
1083 | 1097 | ] |
1084 | 1098 | }, |
|
1296 | 1310 | "metadata": {}, |
1297 | 1311 | "outputs": [], |
1298 | 1312 | "source": [ |
1299 | | - "out = get_simulated_moments(rslt_constants[1])" |
| 1313 | + "_, simulated_moments = get_simulated_moments(rslt_constants[1])" |
1300 | 1314 | ] |
1301 | 1315 | }, |
1302 | 1316 | { |
|
1311 | 1325 | " title=\"Choices Empirical\", ax=axes[0, 0]\n", |
1312 | 1326 | " )\n", |
1313 | 1327 | " empirical_moments[\"Wage Distribution\"].plot(title=\"Wages Empirical\", ax=axes[0, 1])\n", |
1314 | | - " out[\"simulated_moments\"][\"Choice Frequencies\"].plot(\n", |
| 1328 | + " simulated_moments[\"Choice Frequencies\"].plot(\n", |
1315 | 1329 | " title=\"Choices Simulated\", ax=axes[1, 0]\n", |
1316 | 1330 | " )\n", |
1317 | | - " out[\"simulated_moments\"][\"Wage Distribution\"].plot(title=\"Wages Simulated\", ax=axes[1, 1])" |
| 1331 | + " simulated_moments[\"Wage Distribution\"].plot(title=\"Wages Simulated\", ax=axes[1, 1])" |
1318 | 1332 | ] |
1319 | 1333 | }, |
1320 | 1334 | { |
|
1412 | 1426 | "metadata": {}, |
1413 | 1427 | "outputs": [], |
1414 | 1428 | "source": [ |
1415 | | - "out = get_simulated_moments(rslt_refined[1])" |
| 1429 | + "_, simulated_moments = get_simulated_moments(rslt_refined[1])" |
1416 | 1430 | ] |
1417 | 1431 | }, |
1418 | 1432 | { |
|
1434 | 1448 | } |
1435 | 1449 | ], |
1436 | 1450 | "source": [ |
1437 | | - "plot_all_moments(empirical_moments, out[\"simulated_moments\"])" |
| 1451 | + "plot_all_moments(empirical_moments, simulated_moments)" |
1438 | 1452 | ] |
1439 | 1453 | }, |
1440 | 1454 | { |
|
1491 | 1505 | "name": "python", |
1492 | 1506 | "nbconvert_exporter": "python", |
1493 | 1507 | "pygments_lexer": "ipython3", |
1494 | | - "version": "3.7.10" |
| 1508 | + "version": "3.8.3" |
1495 | 1509 | }, |
1496 | 1510 | "toc": { |
1497 | 1511 | "base_numbering": 1, |
|
0 commit comments