Skip to content

Commit

Permalink
verb compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sidd3888 committed Nov 23, 2023
1 parent 7c99c8a commit fc93dcc
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions examples/ConsIndShockModel/KinkedRconsumerType.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,37 +97,37 @@
"source": [
"## Example parameter values to construct an instance of KinkedRconsumerType\n",
"\n",
"The parameters required to create an instance of `KinkedRconsumerType` are nearly identical to those for `IndShockConsumerType`. The only difference is that the parameter $\\verb|Rfree|$ is replaced with $\\verb|Rboro|$ and $\\verb|Rsave|$.\n",
"The parameters required to create an instance of `KinkedRconsumerType` are nearly identical to those for `IndShockConsumerType`. The only difference is that the parameter $\\verb!Rfree!$ is replaced with $\\verb!Rboro!$ and $\\verb!Rsave!$.\n",
"\n",
"While the parameter $\\verb|CubicBool|$ is required to create a valid `KinkedRconsumerType` instance, it must be set to `False`; cubic spline interpolation has not yet been implemented for this model. In the future, this restriction will be lifted.\n",
"While the parameter $\\verb!CubicBool!$ is required to create a valid `KinkedRconsumerType` instance, it must be set to `False`; cubic spline interpolation has not yet been implemented for this model. In the future, this restriction will be lifted.\n",
"\n",
"| Parameter | Description | Code | Example value | Time-varying? |\n",
"| :---: | --- | --- | --- | --- |\n",
"| $\\DiscFac$ |Intertemporal discount factor | $\\verb|DiscFac|$ | $0.96$ | |\n",
"| $\\CRRA$ |Coefficient of relative risk aversion | $\\verb|CRRA|$ | $2.0$ | |\n",
"| $\\Rfree_{boro}$ | Risk free interest factor for borrowing | $\\verb|Rboro|$ | $1.20$ | |\n",
"| $\\Rfree_{save}$ | Risk free interest factor for saving | $\\verb|Rsave|$ | $1.01$ | |\n",
"| $1 - \\DiePrb_{t+1}$ |Survival probability | $\\verb|LivPrb|$ | $[0.98]$ | $\\surd$ |\n",
"|$\\PermGroFac_{t+1}$|Permanent income growth factor| $\\verb|PermGroFac|$ | $[1.01]$ | $\\surd$ |\n",
"| $\\sigma_\\psi$ | Standard deviation of log permanent income shocks | $\\verb|PermShkStd|$ | $[0.1]$ |$\\surd$ |\n",
"| $N_\\psi$ | Number of discrete permanent income shocks | $\\verb|PermShkCount|$ | $7$ | |\n",
"| $\\sigma_\\theta$ | Standard deviation of log transitory income shocks | $\\verb|TranShkStd|$ | $[0.2]$ | $\\surd$ |\n",
"| $N_\\theta$ | Number of discrete transitory income shocks | $\\verb|TranShkCount|$ | $7$ | |\n",
"| $\\mho$ | Probability of being unemployed and getting $\\theta=\\underline{\\theta}$ | $\\verb|UnempPrb|$ | $0.05$ | |\n",
"| $\\underline{\\theta}$ | Transitory shock when unemployed | $\\verb|IncUnemp|$ | $0.3$ | |\n",
"| $\\mho^{Ret}$ | Probability of being \"unemployed\" when retired | $\\verb|UnempPrbRet|$ | $0.0005$ | |\n",
"| $\\underline{\\theta}^{Ret}$ | Transitory shock when \"unemployed\" and retired | $\\verb|IncUnempRet|$ | $0.0$ | |\n",
"| $(none)$ | Period of the lifecycle model when retirement begins | $\\verb|T_retire|$ | $0$ | |\n",
"| $(none)$ | Minimum value in assets-above-minimum grid | $\\verb|aXtraMin|$ | $0.001$ | |\n",
"| $(none)$ | Maximum value in assets-above-minimum grid | $\\verb|aXtraMax|$ | $20.0$ | |\n",
"| $(none)$ | Number of points in base assets-above-minimum grid | $\\verb|aXtraCount|$ | $48$ | |\n",
"| $(none)$ | Exponential nesting factor for base assets-above-minimum grid | $\\verb|aXtraNestFac|$ | $3$ | |\n",
"| $(none)$ | Additional values to add to assets-above-minimum grid | $\\verb|aXtraExtra|$ | $None$ | |\n",
"| $\\underline{a}$ | Artificial borrowing constraint (normalized) | $\\verb|BoroCnstArt|$ | $None$ | |\n",
"| $(none)$ |Indicator for whether $\\verb|vFunc|$ should be computed | $\\verb|vFuncBool|$ | $True$ | |\n",
"| $(none)$ |Indicator for whether $\\verb|cFunc|$ should use cubic splines | $\\verb|CubicBool|$ | $False$ | |\n",
"|$T$| Number of periods in this type's \"cycle\" | $\\verb|T_cycle|$ | $1$ | |\n",
"|(none)| Number of times the \"cycle\" occurs | $\\verb|cycles|$ | $0$ | |\n",
"| $\\DiscFac$ |Intertemporal discount factor | $\\verb!DiscFac!$ | $0.96$ | |\n",
"| $\\CRRA$ |Coefficient of relative risk aversion | $\\verb!CRRA!$ | $2.0$ | |\n",
"| $\\Rfree_{boro}$ | Risk free interest factor for borrowing | $\\verb!Rboro!$ | $1.20$ | |\n",
"| $\\Rfree_{save}$ | Risk free interest factor for saving | $\\verb!Rsave!$ | $1.01$ | |\n",
"| $1 - \\DiePrb_{t+1}$ |Survival probability | $\\verb!LivPrb!$ | $[0.98]$ | $\\surd$ |\n",
"| $\\PermGroFac_{t+1}$|Permanent income growth factor| $\\verb!PermGroFac!$ | $[1.01]$ | $\\surd$ |\n",
"| $\\sigma_\\psi$ | Standard deviation of log permanent income shocks | $\\verb!PermShkStd!$ | $[0.1]$ | $\\surd$ |\n",
"| $N_\\psi$ | Number of discrete permanent income shocks | $\\verb!PermShkCount!$ | $7$ | |\n",
"| $\\sigma_\\theta$ | Standard deviation of log transitory income shocks | $\\verb!TranShkStd!$ | $[0.2]$ | $\\surd$ |\n",
"| $N_\\theta$ | Number of discrete transitory income shocks | $\\verb!TranShkCount!$ | $7$ | |\n",
"| $\\mho$ | Probability of being unemployed and getting $\\theta=\\underline{\\theta}$ | $\\verb!UnempPrb!$ | $0.05$ | |\n",
"| $\\underline{\\theta}$ | Transitory shock when unemployed | $\\verb!IncUnemp!$ | $0.3$ | |\n",
"| $\\mho^{Ret}$ | Probability of being \"unemployed\" when retired | $\\verb!UnempPrbRet!$ | $0.0005$ | |\n",
"| $\\underline{\\theta}^{Ret}$ | Transitory shock when \"unemployed\" and retired | $\\verb!IncUnempRet!$ | $0.0$ | |\n",
"| $(none)$ | Period of the lifecycle model when retirement begins | $\\verb!T_retire!$ | $0$ | |\n",
"| $(none)$ | Minimum value in assets-above-minimum grid | $\\verb!aXtraMin!$ | $0.001$ | |\n",
"| $(none)$ | Maximum value in assets-above-minimum grid | $\\verb!aXtraMax!$ | $20.0$ | |\n",
"| $(none)$ | Number of points in base assets-above-minimum grid | $\\verb!aXtraCount!$ | $48$ | |\n",
"| $(none)$ | Exponential nesting factor for base assets-above-minimum grid | $\\verb!aXtraNestFac!$ | $3$ | |\n",
"| $(none)$ | Additional values to add to assets-above-minimum grid | $\\verb!aXtraExtra!$ | $None$ | |\n",
"| $\\underline{a}$ | Artificial borrowing constraint (normalized) | $\\verb!BoroCnstArt!$ | $None$ | |\n",
"| $(none)$ |Indicator for whether $\\verb!vFunc!$ should be computed | $\\verb!vFuncBool!$ | $True$ | |\n",
"| $(none)$ |Indicator for whether $\\verb!cFunc!$ should use cubic splines | $\\verb!CubicBool!$ | $False$ | |\n",
"| $T$| Number of periods in this type's \"cycle\" | $\\verb!T_cycle!$ | $1$ | |\n",
"| $(none)$ | Number of times the \"cycle\" occurs | $\\verb!cycles!$ | $0$ | |\n",
"\n",
"These example parameters are almost identical to those used for `IndShockExample` in the prior notebook, except that the interest rate on borrowing is 20% (like a credit card), and the interest rate on saving is 1%. Moreover, the artificial borrowing constraint has been set to `None`. The cell below defines a parameter dictionary with these example values."
]
Expand Down Expand Up @@ -272,16 +272,16 @@
"\n",
"| Description | Code | Example value |\n",
"| :---: | --- | --- |\n",
"| Number of consumers of this type | $\\verb|AgentCount|$ | $10000$ |\n",
"| Number of periods to simulate | $\\verb|T_sim|$ | $500$ |\n",
"| Mean of initial log (normalized) assets | $\\verb|aNrmInitMean|$ | $-6.0$ |\n",
"| Stdev of initial log (normalized) assets | $\\verb|aNrmInitStd|$ | $1.0$ |\n",
"| Mean of initial log permanent income | $\\verb|pLvlInitMean|$ | $0.0$ |\n",
"| Stdev of initial log permanent income | $\\verb|pLvlInitStd|$ | $0.0$ |\n",
"| Aggregrate productivity growth factor | $\\verb|PermGroFacAgg|$ | $1.0$ |\n",
"| Age after which consumers are automatically killed | $\\verb|T_age|$ | $None$ |\n",
"| Number of consumers of this type | $\\verb!AgentCount!$ | $10000$ |\n",
"| Number of periods to simulate | $\\verb!T_sim!$ | $500$ |\n",
"| Mean of initial log (normalized) assets | $\\verb!aNrmInitMean!$ | $-6.0$ |\n",
"| Stdev of initial log (normalized) assets | $\\verb!aNrmInitStd!$ | $1.0$ |\n",
"| Mean of initial log permanent income | $\\verb!pLvlInitMean!$ | $0.0$ |\n",
"| Stdev of initial log permanent income | $\\verb!pLvlInitStd!$ | $0.0$ |\n",
"| Aggregrate productivity growth factor | $\\verb!PermGroFacAgg!$ | $1.0$ |\n",
"| Age after which consumers are automatically killed | $\\verb!T_age!$ | $None$ |\n",
"\n",
"Here, we will simulate 10,000 consumers for 500 periods. All newly born agents will start with permanent income of exactly $P_t = 1.0 = \\exp(\\verb|pLvlInitMean|)$, as $\\verb|pLvlInitStd|$ has been set to zero; they will have essentially zero assets at birth, as $\\verb|aNrmInitMean|$ is $-6.0$; assets will be less than $1\\%$ of permanent income at birth.\n",
"Here, we will simulate 10,000 consumers for 500 periods. All newly born agents will start with permanent income of exactly $P_t = 1.0 = \\exp(\\verb!pLvlInitMean!)$, as $\\verb!pLvlInitStd!$ has been set to zero; they will have essentially zero assets at birth, as $\\verb!aNrmInitMean!$ is $-6.0$; assets will be less than $1\\%$ of permanent income at birth.\n",
"\n",
"These example parameter values were already passed as part of the parameter dictionary that we used to create `KinkyExample`, so it is ready to simulate. We need to set the `track_vars` attribute to indicate the variables for which we want to record a *history*."
]
Expand Down Expand Up @@ -416,7 +416,7 @@
"source": [
"We can see there's a significant point mass of consumers with *exactly* $a_t=0$; these are consumers who do not find it worthwhile to give up a bit of consumption to begin saving (because $\\Rfree_{save}$ is too low), and also are not willing to finance additional consumption by borrowing (because $\\Rfree_{boro}$ is too high).\n",
"\n",
"The smaller point masses in this distribution are due to $\\verb|HARK|$ drawing simulated income shocks from the discretized distribution, rather than the \"true\" lognormal distributions of shocks. For consumers who ended $t-1$ with $a_{t-1}=0$ in assets, there are only 8 values the transitory shock $\\theta_{t}$ can take on, and thus only 8 values of $m_t$ thus $a_t$ they can achieve; the value of $\\psi_t$ is immaterial to $m_t$ when $a_{t-1}=0$. You can verify this by changing $\\verb|TranShkCount|$ to some higher value, like 25, in the dictionary above, then running the subsequent cells; the smaller point masses will not be visible to the naked eye."
"The smaller point masses in this distribution are due to $\\verb!HARK!$ drawing simulated income shocks from the discretized distribution, rather than the \"true\" lognormal distributions of shocks. For consumers who ended $t-1$ with $a_{t-1}=0$ in assets, there are only 8 values the transitory shock $\\theta_{t}$ can take on, and thus only 8 values of $m_t$ thus $a_t$ they can achieve; the value of $\\psi_t$ is immaterial to $m_t$ when $a_{t-1}=0$. You can verify this by changing $\\verb!TranShkCount!$ to some higher value, like 25, in the dictionary above, then running the subsequent cells; the smaller point masses will not be visible to the naked eye."
]
}
],
Expand Down

0 comments on commit fc93dcc

Please sign in to comment.