ConsIndShockPortfolioSolver(solution_next, IncomeDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool, approxRiskyDstn, RiskyCount, RiskyShareCount, RiskyShareLimitFunc, AdjustPrb, PortfolioGrid, AdjustCount, PortfolioDomain)¶
A class for solving a one period consumption-saving problem with portfolio choice. An instance of this class is created by the function solveConsPortfolio in each period.
Creates the value function for this period and adds it to the solution.
Parameters: solution (ConsumerSolution) – The solution to this single period problem, likely including the consumption function, marginal value function, etc. Returns: solution – The single period solution passed as an input, but now with the value function (defined over market resources m) as an attribute. Return type: ConsumerSolution
Calculate end-of-period marginal value of assets at each point in aNrmNow. Does so by taking a weighted sum of next period marginal values across income shocks (in a preconstructed grid self.mNrmNext).
Parameters: none – Returns: EndOfPrdvP – A 1D array of end-of-period marginal value of assets Return type: np.array
Defines the constrained portion of the consumption function as cFuncNowCnst, an attribute of self. Uses the artificial and natural borrowing constraints.
Parameters: 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. Returns: Return type: none
Construct the end-of-period value function for this period, storing it as an attribute of self for use by other methods.
Parameters: none – Returns: Return type: none
makevFunc(solution, AdjustIndex, ShareIndex)¶
Creates the value function for this period, defined over market resources m. self must have the attribute EndOfPrdvFunc in order to execute.
Parameters: solution (ConsumerSolution) – The solution to this single period problem, which must include the consumption function. Returns: vFuncNow – A representation of the value function for this period, defined over normalized market resources m: v = vFuncNow(m). Return type: ValueFunc
Prepare to calculate end-of-period marginal value by creating an array of market resources that the agent could have next period, considering the grid of end-of-period assets and the distribution of shocks he might experience next period. This method adds extra steps because it first solves the portfolio problem given the end-of-period assets to be able to get next period resources.
Parameters: none – Returns: aNrmNow – A 1D array of end-of-period assets; also stored as attribute of self. Return type: np.array
Prepare variables used to find optimal portfolio shares. Branches to either the discrete or continuous portfolio choice set.
setAndUpdateValues(solution_next, IncomeDstn, LivPrb, DiscFac)¶
Unpacks some of the inputs (and calculates simple objects based on them), storing the results in self for use by other methods. These include: income shocks and probabilities, next period’s marginal value function (etc), the probability of getting the worst income shock next period, the patience factor, human wealth, and the bounding MPCs.
- solution_next (ConsumerSolution) – The solution to next period’s one period problem.
- IncomeDstn ([np.array]) – A list containing three arrays of floats, representing a discrete approximation to the income process between the period being solved and the one immediately following (in solution_next). Order: event probabilities, permanent shocks, transitory shocks.
- LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period.
- DiscFac (float) – Intertemporal discount factor for future utility.
Returns: Return type:
LogNormalPortfolioConsumerType(cycles=1, time_flow=True, verbose=False, quiet=False, **kwds)¶
A consumer type with a portfolio choice. This agent type has log-normal return factors. Their problem is defined by a coefficient of relative risk aversion, intertemporal discount factor, interest factor, and time sequences of the permanent income growth rate, survival probability, and return factor averages and standard deviations.
A class for generating functions that draw random values from a log-normal distribution as parameterized by the input RiskyAvg and RiskyStd values. The returned function takes no argument and returns a value.
A class for generating functions that generate nodes and weights for a log- normal distribution as parameterized by the input RiskyAvg and RiskyStd values. The returned function takes a number of points to request and returns a list of lists where the first list contains the weights (probabilities) and the second list contains the values.