ConsHealthModel#
Classes to represent consumers who make decisions about health investment. The first model here is adapted from White (2015).
- HARK.ConsumptionSaving.ConsHealthModel.eval_health_prod(n, alpha, gamma)#
- HARK.ConsumptionSaving.ConsHealthModel.eval_marg_health_prod(n, alpha, gamma)#
- HARK.ConsumptionSaving.ConsHealthModel.calc_exp_next(shock, a, H, R, rho, alpha, gamma, funcs)#
- HARK.ConsumptionSaving.ConsHealthModel.solve_one_period_ConsBasicHealth(solution_next, DiscFac, Rfree, CRRA, HealthProdExp, HealthProdFac, DieProbMax, ShockDstn, aLvlGrid, HLvlGrid, constrained_N)#
Solve one period of the basic health investment / consumption-saving model using the endogenous grid method. Policy functions are the consumption function cFunc and the health investment function nFunc.
- Parameters:
solution_next (Curvilinear2DInterp) – Solution to the succeeding period’s problem, represented as a multi-function interpolant with entries vNvrsFunc, cFunc, and nFunc.
DiscFac (float) – Intertemporal discount factor, representing beta.
Rfree (float) – Risk-free rate of return on retained assets.
CRRA (float) – Coefficient of relative risk aversion, representing rho. Assumed to be constant across periods. Should be strictly between 0 and 1.
HealthProdExp (float) – Exponent in health production function; should be strictly b/w 0 and 1. This corresponds to alpha in White (2015).
HealthProdFac (float) – Scaling factor in health production function; should be strictly positive. This corresponds to gamma in White (2015).
DieProbMax (float) – Maximum death probability at the end of this period, if HLvl were exactly zero.
ShockDstn (DiscreteDistribution) – Joint distribution of income and depreciation values that could realize at the start of the next period.
aLvlGrid (np.array) – Grid of end-of-period assets (after all actions are accomplished).
HLvlGrid (np.array) – Grid of end-of-period post-investment health.
constrained_N (int) – Number of additional interpolation nodes to put in the mLvl dimension on the liquidity-constrained portion of the consumption function.
- Returns:
solution_now – Solution to this period’s problem, including policy functions cFunc and nFunc, as well as (marginal) value functions vFunc, dvdmFunc, and dvdhFunc.
- Return type:
- HARK.ConsumptionSaving.ConsHealthModel.make_solution_terminal_ConsBasicHealth()#
Constructor for the terminal period solution for the basic health investment model. The trivial solution is to consume all market resources and invest nothing in health. Takes no parameters because CRRA is irrelevant: pseudo-inverse value is returned rather than value, and the former is just cLvl = mLvl.
The solution representation for this model is a multiple output function that takes market resources and health capital level as inputs and returns pseudo- inverse value, consumption level, and health investment level in that order.
- HARK.ConsumptionSaving.ConsHealthModel.make_health_grid(hLvlMin, hLvlMax, hLvlCount)#
Make a uniform grid of health capital levels.
- Parameters:
- Returns:
hLvlGrid – Uniform grid of health capital levels
- Return type:
np.array
- HARK.ConsumptionSaving.ConsHealthModel.make_uniform_depreciation_dstn(T_cycle, DeprRteMean, DeprRteSpread, DeprRteCount, RNG)#
Constructor for DeprRteDstn that makes uniform distributions that vary by age.
- Parameters:
T_cycle (int) – Number of periods in the agent’s sequence or cycle.
DeprRteMean ([float]) – Age-varying list (or array) of mean depreciation rates.
DeprRteSpread ([float]) – Age-varying list (or array) of half-widths of depreciate rate distribution.
DeprRteCount (int) – Number of equiprobable nodes in each distribution.
RNG (np.random.RandomState) – Agent’s internal random number generator.
- Returns:
DeprRteDstn – List of age-dependent discrete approximations to the depreciate rate distribution.
- Return type:
- HARK.ConsumptionSaving.ConsHealthModel.combine_indep_wage_and_depr_dstns(T_cycle, WageRteDstn, DeprRteDstn, RNG)#
Combine univariate distributions of wage rate realizations and depreciation rate realizations at each age, treating them as independent.
- Parameters:
T_cycle (int) – Number of periods in the agent’s sequence of periods (cycle).
WageRteDstn ([DiscreteDistribution]) – Age-dependent list of wage rate realizations; should have length T_cycle.
DeprRteDstn ([DiscreteDistribution]) – Age-dependent list of health depreciation rate realizatiosn; should have length T_cycle.
RNG (np.random.RandomState) – Internal random number generator for the AgentType instance.
- Returns:
ShockDstn – Age-dependent bivariate distribution with joint realizations of income and health depreciation rates.
- Return type:
- HARK.ConsumptionSaving.ConsHealthModel.make_logistic_polynomial_die_prob(T_cycle, DieProbMaxCoeffs)#
Constructor for DieProbMax, the age-varying list of maximum death probabilities (if health is zero). Builds the list as the logistic function evaluated on a polynomial of model age, given polynomial coefficients. Logistic function is applied to ensure probabilities are always between zero and one.
- Parameters:
T_cycle (int) – Number of periods in the agent’s sequence of periods (cycle).
DieProbMaxCoeffs (np.array) – List or vector of polynomial coefficients for maximum death probability.
- Returns:
DieProbMax – Age-varying list of maximum death probabilities (if health were zero).
- Return type:
[float]
- HARK.ConsumptionSaving.ConsHealthModel.make_uniform_HLvl_init_dstn(HLvlInitMin, HLvlInitMax, HLvlInitCount, RNG)#
Constructor for HLvlInitDstn that builds a uniform distribution for initial health capital at model birth.
- Parameters:
- Returns:
HLvlInitDstn – Discretized uniform distribution of initial health capital level.
- Return type:
- class HARK.ConsumptionSaving.ConsHealthModel.BasicHealthConsumerType(solution_terminal=None, pseudo_terminal=True, tolerance=1e-06, verbose=1, quiet=False, seed=0, construct=True, use_defaults=True, **kwds)#
Bases:
AgentType
A class to represent consumers who can save in a risk-free asset and invest in health capital via a health production function. The model is a slight alteration of the one from White (2015), which was in turn lifted from Ludwig and Schoen. In this variation, survival probability depends on post-investment health capital, rather than next period’s health capital realization.
Each period, the agent chooses consumption $c_t$ and health investment $n_t$. Consumption yields utility via CRRA function, while investment yields additional health capital via production function $f(n_t)$. The agent faces a mortality risk that depends on their post-investment health $H_t = h_t + g(n_t)$, as well as income risk through wage rate $omega_t$ and health capital depreciation rate $delta_t$. Health capital also serves as human capital in the sense that the agent earns more income when $h_t$ is higher.
Unlike most other HARK models, this one is not normalized with respect to permanent income– indeed, there is no “permanent income” in this simple model. As parametric restrictions, the solver requires that $rho < 1$ so that utility is positive everywhere. This restriction ensures that the first order conditions are necessary and sufficient to characterize the solution when not liquidity- constrained. The liquidity constrained portion of the policy function is handled.
\[\begin{split}\newcommand{\CRRA}{\rho} \newcommand{\DiePrb}{\mathsf{D}} \newcommand{\PermGroFac}{\Gamma} \newcommand{\Rfree}{\mathsf{R}} \newcommand{\DiscFac}{\beta} \newcommand{\DeprRte}{\delta} \newcommand{\WageRte}{\omega} \begin{align*} v_t(m_t, h_t) &= \max_{c_t, n_t}u(c_t) + \DiscFac (1 - \DiePrb_{t}) v_{t+1}(m_{t+1}, h_{t+1}), \\ & \text{s.t.} \\ H_t &= h_t + g(n_t), \\ a_t &= m_t - c_t - n_t, \\ \DiePrb_t = \phi_t / (1 + H_t), \\ h_{t+1} &= (1-\DeprRte_{t+1}) H_t, \\ y_{t+1} &= \omega_{t+1} h_{t+1}, \\ m_{t+1} &= \Rfree_{t+1} a_t + y_{t+1}, \\ u(c) &= \frac{c^{1-\CRRA}}{1-\CRRA}, \\ g(n) = (\gamma / \alpha) n^{\alpha}, \\ (\WageRte_{t+1}, \DeprRte_{t+1}) \sim F_{t+1}. \end{align*}\end{split}\]- Solving Parameters:
cycles (int) – 0 specifies an infinite horizon model, 1 specifies a finite model.
T_cycle (int) – Number of periods in the cycle for this agent type.
CRRA (float, \(\rho\)) – Coefficient of Relative Risk Aversion.
Rfree (list[float], time varying, \(\mathsf{R}\)) – Risk-free interest rate by age.
DiscFac (float, \(\beta\)) – Intertemporal discount factor.
DieProbMax (list[float], time varying, \(\phi\)) – Maximum death probability by age, if $H_t=0$.
HealthProdExp (float, \(\alpha\)) – Exponent in health production function; should be strictly b/w 0 and 1.
HealthProdFac (float, \(\gamma\)) – Scaling factor in health production function; should be strictly positive.
ShockDstn (DiscreteDistribution, time varying) – Joint distribution of income and depreciation values that could realize at the start of the next period.
aLvlGrid (np.array) – Grid of end-of-period assets (after all actions are accomplished).
HLvlGrid (np.array) – Grid of end-of-period post-investment health.
- Simulation Parameters:
AgentCount (int) – Number of agents of this kind that are created during simulations.
T_age (int) – Age after which to automatically kill agents, None to ignore.
T_sim (int, required for simulation) – Number of periods to simulate.
track_vars (list[strings]) – List of variables that should be tracked when running the simulation. For this agent, the options are ‘kLvl’, ‘yLvl’, ‘mLvl’, ‘hLvl’, ‘cLvl’, ‘nLvl’, ‘WageRte’, ‘DeprRte’, ‘aLvl’, ‘HLvl’.
kLvl : Beginning-of-period capital holdings, equivalent to aLvl_{t-1}
yLvl : Labor income, the wage rate times health capital.
mLvl : Market resources, the interest factor times capital holdings, plus labor income.
hLvl : Health or human capital level at decision-time.
cLvl : Consumption level.
nLvl : Health investment level.
WageRte : Wage rate this period.
DeprRte : Health capital depreciation rate this period.
aLvl : End-of-period assets: market resources less consumption and investment.
HLvl : End-of-period health capital: health capital plus produced health.
- Attributes:
solution (list[Consumer solution object]) – Created by the
solve()
method. Finite horizon models create a list with T_cycle+1 elements, for each period in the solution. Infinite horizon solutions return a list with T_cycle elements for each period in the cycle.Visit
HARK.ConsumptionSaving.ConsIndShockModel.ConsumerSolution
for more information about the solution.history (Dict[Array]) – Created by running the
simulate()
method. Contains the variables in track_vars. Each item in the dictionary is an array with the shape (T_sim,AgentCount). VisitHARK.core.AgentType.simulate
for more information.
- default_ = {'params': {'AgentCount': 10000, 'CRRA': 0.5, 'DeprRteCount': 7, 'DeprRteMean': [0.05], 'DeprRteSpread': [0.05], 'DieProbMaxCoeffs': [0.0], 'DiscFac': 0.95, 'HLvlInitCount': 15, 'HLvlInitMax': 2.0, 'HLvlInitMin': 1.0, 'HealthProdExp': 0.35, 'HealthProdFac': 1.0, 'IncUnemp': 0.3, 'Rfree': [1.03], 'T_age': None, 'T_cycle': 1, 'UnempPrb': 0.07, 'WageRteCount': 7, 'WageRteMean': [0.1], 'WageRteStd': [0.1], 'aXtraCount': 44, 'aXtraExtra': [3e-05, 0.0001, 0.0003, 0.001, 0.003, 0.01, 0.03], 'aXtraMax': 100.0, 'aXtraMin': 1e-05, 'aXtraNestFac': 1, 'constrained_N': 7, 'constructors': {'DeprRteDstn': <function make_uniform_depreciation_dstn>, 'DieProbMax': <function make_logistic_polynomial_die_prob>, 'HLvlGrid': <function make_health_grid>, 'HLvlInitDstn': <function make_uniform_HLvl_init_dstn>, 'ShockDstn': <function combine_indep_wage_and_depr_dstns>, 'WageRteDstn': <function construct_lognormal_wage_dstn>, 'aLvlGrid': <function make_assets_grid>, 'kLvlInitDstn': <function make_lognormal_kNrm_init_dstn>, 'solution_terminal': <function make_solution_terminal_ConsBasicHealth>}, 'cycles': 1, 'hLvlCount': 50, 'hLvlMax': 50.0, 'hLvlMin': 0.0, 'kLogInitMean': -12.0, 'kLogInitStd': 0.0, 'kNrmInitCount': 15}, 'solver': <function solve_one_period_ConsBasicHealth>}#
- time_vary_ = ['Rfree', 'DieProbMax', 'ShockDstn']#
- time_inv_ = ['DiscFac', 'CRRA', 'HealthProdExp', 'HealthProdFac', 'aLvlGrid', 'HLvlGrid', 'constrained_N']#
- state_vars = ['kLvl', 'yLvl', 'mLvl', 'hLvl', 'aLvl', 'HLvl']#
- shock_vars_ = ['WageRte', 'DeprRte']#
- distributions = ['ShockDstn', 'kLvlInitDstn', 'HLvlInitDstn']#
- sim_death()#
Draw mortality shocks for all agents, marking some for death and replacement.
- Returns:
which_agents – Boolean array of size AgentCount, indicating who dies now.
- Return type:
np.array
- sim_birth(which_agents)#
Makes new consumers for the given indices. Initialized variables include kLvl and HLvl, as well as time variables t_age and t_cycle.
- Parameters:
which_agents (np.array(Bool)) – Boolean array of size self.AgentCount indicating which agents should be “born”.
- Return type:
None
- get_shocks()#
Draw wage and depreciation rate shocks for all simulated agents.
- transition()#
Find current market resources and health capital from prior health capital and the drawn shocks.
- get_controls()#
Evaluate consumption and health investment functions conditional on current state and model age, yielding controls cLvl and nLvl.
- get_poststates()#
Calculate end-of-period retained assets and post-investment health.