ConsRiskyAssetModel#

This file contains a class that adds a risky asset with a log-normal return factor to IndShockConsumerType. This class is not a fully specified model and therefore has no solution or simulation methods. It is meant as a container of methods for dealing with risky assets that will be useful to models what will inherit from it.

class HARK.ConsumptionSaving.ConsRiskyAssetModel.FixedPortfolioShareRiskyAssetConsumerType(verbose=False, quiet=False, **kwds)#

Bases: IndShockRiskyAssetConsumerType

time_vary_ = ['LivPrb', 'PermGroFac', 'RiskyShareFixed']#
class HARK.ConsumptionSaving.ConsRiskyAssetModel.IndShockRiskyAssetConsumerType(verbose=False, quiet=False, **kwds)#

Bases: IndShockConsumerType

A consumer type that has access to a risky asset for his savings. The risky asset has lognormal returns that are possibly correlated with his income shocks.

There is a friction that prevents the agent from adjusting his portfolio at any given period with an exogenously given probability. The meaning of “adjusting his portfolio” depends on the particular model.

get_Adjust()#

Sets the attribute Adjust as a boolean array of size AgentCount, indicating whether each agent is able to adjust their risky portfolio share this period. Uses the attribute AdjustPrb to draw from a Bernoulli distribution.

Parameters:

None

Return type:

None

get_Rfree()#

Calculates realized return factor for each agent, using the attributes Rfree, RiskyNow, and ShareNow. This method is a bit of a misnomer, as the return factor is not riskless, but would more accurately be labeled as Rport. However, this method makes the portfolio model compatible with its parent class.

Parameters:

None

Returns:

Rport – Array of size AgentCount with each simulated agent’s realized portfolio return factor. Will be used by get_states() to calculate mNrmNow, where it will be mislabeled as “Rfree”.

Return type:

np.array

get_Risky()#

Draws a new risky return factor.

Parameters:

None

Return type:

None

get_shocks()#

Draw idiosyncratic income shocks, just as for IndShockConsumerType, then draw a single common value for the risky asset return. Also draws whether each agent is able to adjust their portfolio this period.

Parameters:

None

Return type:

None

initialize_sim()#

Initialize the state of simulation attributes. Simply calls the same method for IndShockConsumerType, then initializes the new states/shocks Adjust and Share.

Parameters:

None

Return type:

None

pre_solve()#

Method that is run automatically just before solution by backward iteration. Solves the (trivial) terminal period and does a quick check on the borrowing constraint and MaxKinks attribute (only relevant in constrained, infinite horizon problems).

shock_vars_ = ['PermShk', 'TranShk', 'Adjust', 'Risky']#
time_inv_ = ['CRRA', 'DiscFac', 'BoroCnstArt', 'BoroCnstArt', 'vFuncBool', 'CubicBool', 'PortfolioBisect']#
update()#

Update the income process, the assets grid, and the terminal solution.

Parameters:

None

Return type:

None

update_AdjustDstn()#

Checks and updates the exogenous probability of the agent being allowed to rebalance his portfolio/contribution scheme. It can be time varying.

Parameters:

None.

Return type:

None.

update_RiskyDstn()#

Creates the attributes RiskyDstn from the primitive attributes RiskyAvg, RiskyStd, and RiskyCount, approximating the (perceived) distribution of returns in each period of the cycle.

Parameters:

None

Return type:

None

update_ShareGrid()#

Creates the attribute ShareGrid as an evenly spaced grid on [0.,1.], using the primitive parameter ShareCount.

Parameters:

None

Return type:

None

update_ShareLimit()#

Creates the attribute ShareLimit, representing the limiting lower bound of risky portfolio share as mNrm goes to infinity.

Parameters:

None

Return type:

None

update_ShockDstn()#

Combine the income shock distribution (over PermShk and TranShk) with the risky return distribution (RiskyDstn) to make a new attribute called ShockDstn.

Parameters:

None

Return type:

None

HARK.ConsumptionSaving.ConsRiskyAssetModel.RiskyAssetConsumerType#

alias of IndShockRiskyAssetConsumerType

HARK.ConsumptionSaving.ConsRiskyAssetModel.solve_one_period_ConsIndShockRiskyAsset(solution_next, IncShkDstn, RiskyDstn, ShockDstn, LivPrb, DiscFac, CRRA, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool, IndepDstnBool)#

Solves one period of a consumption-saving model with idiosyncratic shocks to permanent and transitory income, with one risky asset and CRRA utility.

Parameters:
  • solution_next (ConsumerSolution) – The solution to next period’s one period problem.

  • IncShkDstn (Distribution) – Discrete distribution of permanent income shocks and transitory income shocks. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • RiskyDstn (Distribution) – Distribution of risky asset returns. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • ShockDstn (Distribution) – Joint distribution of permanent income shocks, transitory income shocks, and risky returns. This is only used if the input IndepDstnBool is False, indicating that income and return distributions can’t be assumed to be independent.

  • LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period.

  • DiscFac (float) – Intertemporal discount factor for future utility.

  • CRRA (float) – Coefficient of relative risk aversion.

  • PermGroFac (float) – Expected permanent income growth factor at the end of this period.

  • BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. If it is less than the natural borrowing constraint, then it is irrelevant; BoroCnstArt=None indicates no artificial bor- rowing constraint.

  • aXtraGrid (np.array) – Array of “extra” end-of-period asset values– assets above the absolute minimum acceptable level.

  • vFuncBool (boolean) – An indicator for whether the value function should be computed and included in the reported solution.

  • CubicBool (boolean) – An indicator for whether the solver should use cubic or linear interpolation.

  • IndepDstnBool (bool) – Indicator for whether the income and risky return distributions are in- dependent of each other, which can speed up the expectations step.

Returns:

solution_now – Solution to this period’s consumption-saving problem with income risk.

Return type:

ConsumerSolution

HARK.ConsumptionSaving.ConsRiskyAssetModel.solve_one_period_ConsPortChoice(solution_next, ShockDstn, IncShkDstn, RiskyDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, ShareGrid, ShareLimit, vFuncBool, IndepDstnBool)#

Solve one period of a consumption-saving problem with portfolio allocation between a riskless and risky asset. This function handles only the most fundamental portfolio choice problem: frictionless reallocation of the portfolio each period as a continuous choice.

Parameters:
  • solution_next (PortfolioSolution) – Solution to next period’s problem.

  • ShockDstn (Distribution) – Joint distribution of permanent income shocks, transitory income shocks, and risky returns. This is only used if the input IndepDstnBool is False, indicating that income and return distributions can’t be assumed to be independent.

  • IncShkDstn (Distribution) – Discrete distribution of permanent income shocks and transitory income shocks. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • RiskyDstn (Distribution) – Distribution of risky asset returns. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period.

  • DiscFac (float) – Intertemporal discount factor for future utility.

  • CRRA (float) – Coefficient of relative risk aversion.

  • Rfree (float) – Risk free interest factor on end-of-period assets.

  • PermGroFac (float) – Expected permanent income growth factor at the end of this period.

  • BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. In this model, it is required to be zero.

  • aXtraGrid (np.array) – Array of “extra” end-of-period asset values– assets above the absolute minimum acceptable level.

  • ShareGrid (np.array) – Array of risky portfolio shares on which to define the interpolation of the consumption function when Share is fixed. Also used when the risky share choice is specified as discrete rather than continuous.

  • ShareLimit (float) – Limiting lower bound of risky portfolio share as mNrm approaches infinity.

  • vFuncBool (boolean) – An indicator for whether the value function should be computed and included in the reported solution.

  • IndepDstnBool (bool) – Indicator for whether the income and risky return distributions are in- dependent of each other, which can speed up the expectations step.

Returns:

solution_now – Solution to this period’s problem.

Return type:

PortfolioSolution

HARK.ConsumptionSaving.ConsRiskyAssetModel.solve_one_period_FixedShareRiskyAsset(solution_next, IncShkDstn, RiskyDstn, ShockDstn, LivPrb, DiscFac, Rfree, CRRA, PermGroFac, BoroCnstArt, aXtraGrid, RiskyShareFixed, vFuncBool, CubicBool, IndepDstnBool)#

Solves one period of a consumption-saving model with idiosyncratic shocks to permanent and transitory income, with one risky asset and CRRA utility.

Parameters:
  • solution_next (ConsumerSolution) – The solution to next period’s one period problem.

  • IncShkDstn (Distribution) – Discrete distribution of permanent income shocks and transitory income shocks. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • RiskyDstn (Distribution) – Distribution of risky asset returns. This is only used if the input IndepDstnBool is True, indicating that income and return distributions are independent.

  • ShockDstn (Distribution) – Joint distribution of permanent income shocks, transitory income shocks, and risky returns. This is only used if the input IndepDstnBool is False, indicating that income and return distributions can’t be assumed to be independent.

  • LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period.

  • DiscFac (float) – Intertemporal discount factor for future utility.

  • Rfree (float) – Risk free interest factor on end-of-period assets.

  • CRRA (float) – Coefficient of relative risk aversion.

  • PermGroFac (float) – Expected permanent income growth factor at the end of this period.

  • BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. If it is less than the natural borrowing constraint, then it is irrelevant; BoroCnstArt=None indicates no artificial bor- rowing constraint.

  • aXtraGrid (np.array) – Array of “extra” end-of-period asset values– assets above the absolute minimum acceptable level.

  • RiskyShareFixed (float) – Fixed fraction of end-of-period assets that are allocated to the risky asset.

  • vFuncBool (boolean) – An indicator for whether the value function should be computed and included in the reported solution.

  • CubicBool (boolean) – An indicator for whether the solver should use cubic or linear interpolation.

  • IndepDstnBool (bool) – Indicator for whether the income and risky return distributions are in- dependent of each other, which can speed up the expectations step.

Returns:

solution_now – Solution to this period’s consumption-saving problem with income risk.

Return type:

ConsumerSolution