{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Experience" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the [tutorial](../tutorials/tutorial_params_options_simulate.ipynb) on `parmas`, `options`, and simulation, we simulated a population of identical individuals: The difference in their behavior was solely due to different random shocks to the reward associated with a choice. In more realistic models, individuals can differ with respect to multiple characteristics, which need to be sampled at the start of the simulation. These characteristics can be:\n", "\n", "- **Experience**. Individuals can start with nonzero years of experience for some choice.\n", "- **Lagged choices**. The previous (lagged) choice in the first period can be a subset of all choices in the model.\n", "- **Observables**. An observed characteristic, which does not change over the time-horizon of the model, is not evenly distributed in the population.\n", "\n", "Taken together, the assumptions on these characteristics are called the **initial conditions** of a model. An initial condition is also called a seed value and determines the value of a variable in the first period of a dynamic system." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "***\n", "In this tutorial we will see how to model heterogeneous initial experience with **respy**: in period $t=0$, Robinson will be allowed to have $0$, $1$, or $2$ periods of experience in fishing. In the baseline Robinson Crusoe economy, experience in fishing directly enters the pecuniary reward from fishing: In period $t$, everything else equal, a Robinson who has already been fishing for $n$ periods will enjoy a higher reward from fishing than a Robinson who has $n^* < n$ periods of experience. \n", "\n", "In more realistic models, agents accumulates educational or on-the-job experience in a similar way. However, in real panel data, individuals are typically not observed since birth, but only after they have accumulated some experience for some choice: failing to account for this heterogeneity in initial experience would result in a misspecified model. This explains why conditioning on initial experience is especially relevant in models of human capital accumulation and occupational choices." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import pandas as pd\n", "import respy as rp\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import numpy as np\n", "\n", "# Plotting style\n", "sns.set_style(\"white\")\n", "sns.set_context(\"notebook\", font_scale=1.5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The model: a simple Robinson Crusoe economy, revisited" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We revisit the basic Robinson Crusoe economy. In a nutshell, Robinson can choose between fishing and staying in the hammock every period, but he can accumulate experience in **fishing**, which makes him more productive. The pecuniary reward, or wage, from fishing is indeed:\n", "\n", "$$\n", "W_{f}=exp\\{x_{t}\\beta_{f}+ \\epsilon_{ft}\\}\n", "$$\n", "\n", "Up to now we have implicitly assumed that Robinson finds himself in a desert island without any previous experience in fishing: At period 0, each simulated Robinson has experience $x_t$ equal to 0. We want to allow for heterogeneous initial experience in fishing, such that Robinson is allowed to start with different levels of initial experience. " ] }, { "cell_type": "raw", "metadata": {}, "source": [ "
\n", " | \n", " | Experience_Fishing | \n", "Shock_Reward_Fishing | \n", "Meas_Error_Wage_Fishing | \n", "Shock_Reward_Hammock | \n", "Meas_Error_Wage_Hammock | \n", "Dense_Key | \n", "Core_Index | \n", "Choice | \n", "Wage | \n", "Discount_Rate | \n", "... | \n", "Nonpecuniary_Reward_Fishing | \n", "Wage_Fishing | \n", "Flow_Utility_Fishing | \n", "Value_Function_Fishing | \n", "Continuation_Value_Fishing | \n", "Nonpecuniary_Reward_Hammock | \n", "Wage_Hammock | \n", "Flow_Utility_Hammock | \n", "Value_Function_Hammock | \n", "Continuation_Value_Hammock | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Identifier | \n", "Period | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
0 | \n", "0 | \n", "1 | \n", "-0.035035 | \n", "1 | \n", "0.040965 | \n", "1 | \n", "0 | \n", "1 | \n", "fishing | \n", "1.326418 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "1.326418 | \n", "1.126418 | \n", "12.326832 | \n", "11.789909 | \n", "2 | \n", "NaN | \n", "2.020483 | \n", "10.410453 | \n", "8.831548 | \n", "
1 | \n", "2 | \n", "0.074254 | \n", "1 | \n", "1.506491 | \n", "1 | \n", "1 | \n", "2 | \n", "fishing | \n", "1.891040 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "1.891040 | \n", "1.691040 | \n", "11.625139 | \n", "10.456946 | \n", "2 | \n", "NaN | \n", "2.753245 | \n", "10.171667 | \n", "7.808865 | \n", "|
2 | \n", "3 | \n", "-0.354560 | \n", "1 | \n", "1.185316 | \n", "1 | \n", "2 | \n", "3 | \n", "fishing | \n", "2.060029 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "2.060029 | \n", "1.860029 | \n", "9.714609 | \n", "8.267979 | \n", "2 | \n", "NaN | \n", "2.592658 | \n", "8.459312 | \n", "6.175425 | \n", "|
3 | \n", "4 | \n", "-0.109397 | \n", "1 | \n", "-0.785877 | \n", "1 | \n", "3 | \n", "5 | \n", "fishing | \n", "3.143388 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "3.143388 | \n", "2.943388 | \n", "7.663676 | \n", "4.968724 | \n", "2 | \n", "NaN | \n", "1.607061 | \n", "5.138012 | \n", "3.716790 | \n", "|
4 | \n", "5 | \n", "-1.063705 | \n", "1 | \n", "1.245234 | \n", "1 | \n", "4 | \n", "0 | \n", "hammock | \n", "NaN | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "2.633063 | \n", "2.433063 | \n", "2.433063 | \n", "0.000000 | \n", "2 | \n", "NaN | \n", "2.622617 | \n", "2.622617 | \n", "0.000000 | \n", "|
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
999 | \n", "0 | \n", "2 | \n", "0.584099 | \n", "1 | \n", "1.611990 | \n", "1 | \n", "0 | \n", "2 | \n", "fishing | \n", "2.440126 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "2.440126 | \n", "2.240126 | \n", "17.545754 | \n", "16.111188 | \n", "2 | \n", "NaN | \n", "2.805995 | \n", "14.006409 | \n", "11.789909 | \n", "
1 | \n", "3 | \n", "-0.391274 | \n", "1 | \n", "0.371305 | \n", "1 | \n", "1 | \n", "3 | \n", "fishing | \n", "2.022558 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "2.022558 | \n", "1.822558 | \n", "15.358691 | \n", "14.248561 | \n", "2 | \n", "NaN | \n", "2.185652 | \n", "12.119751 | \n", "10.456946 | \n", "|
2 | \n", "4 | \n", "0.394125 | \n", "1 | \n", "-1.448981 | \n", "1 | \n", "2 | \n", "4 | \n", "fishing | \n", "4.043305 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "4.043305 | \n", "3.843305 | \n", "14.522757 | \n", "11.241529 | \n", "2 | \n", "NaN | \n", "1.275510 | \n", "9.130090 | \n", "8.267979 | \n", "|
3 | \n", "5 | \n", "0.531008 | \n", "1 | \n", "-0.312350 | \n", "1 | \n", "3 | \n", "4 | \n", "fishing | \n", "5.844517 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "5.844517 | \n", "5.644517 | \n", "12.035021 | \n", "6.726847 | \n", "2 | \n", "NaN | \n", "1.843825 | \n", "6.564113 | \n", "4.968724 | \n", "|
4 | \n", "6 | \n", "1.367302 | \n", "1 | \n", "1.117095 | \n", "1 | \n", "4 | \n", "6 | \n", "fishing | \n", "11.984942 | \n", "0.95 | \n", "... | \n", "-0.2 | \n", "11.984942 | \n", "11.784942 | \n", "11.784942 | \n", "0.000000 | \n", "2 | \n", "NaN | \n", "2.558547 | \n", "2.558547 | \n", "0.000000 | \n", "
5000 rows × 21 columns
\n", "