Update vFunc
using preInc and preRisky
@@ -518,26 +518,18 @@ class ConsRiskySolver(ConsIndShockSolver):
return EndOfPrdvP
- def make_EndOfPrdvFunc(self, EndOfPrdvP):
- """
- Construct the end-of-period value function for this period, storing it
- as an attribute of self for use by other methods.
-
- Parameters
- ----------
- EndOfPrdvP : np.array
- Array of end-of-period marginal value of assets corresponding to the
- asset values in self.aNrmNow.
+ def calc_ExpValueFunc(self, dstn, func, grid):
- Returns
- -------
- none
- """
+ vals = calc_expectation(dstn, func, grid)
+ nvrs = self.uinv(vals)
+ nvrsFunc = LinearInterp(grid, nvrs)
+ valueFunc = ValueFuncCRRA(nvrsFunc, self.CRRA)
- if self.IndepDstnBool:
+ return valueFunc, vals
+ def calc_preIncShkvFunc(self, vFuncNext):
def preTranShkvFunc(tran_shk, w_nrm):
- return self.vFuncNext(w_nrm + tran_shk)
+ return vFuncNext(w_nrm + tran_shk)
self.preTranShkvFunc, _ = self.calc_ExpValueFunc(
self.TranShkDstn, preTranShkvFunc, self.wNrmNext
@@ -551,8 +543,13 @@ class ConsRiskySolver(ConsIndShockSolver):
self.PermShkDstn, prePermShkvFunc, self.bNrmNext
)
+ preIncShkvFunc = self.prePermShkvFunc
+
+ return preIncShkvFunc
+
+ def calc_preRiskyShkvFunc(self, preIncShkvFunc):
def preRiskyShkvFunc(risky_shk, a_nrm):
- return self.DiscFacEff * self.prePermShkvFunc(risky_shk * a_nrm)
+ return self.DiscFacEff * preIncShkvFunc(risky_shk * a_nrm)
self.preRiskyShkvFunc, EndOfPrdv = self.calc_ExpValueFunc(
self.RiskyDstn, preRiskyShkvFunc, self.aNrmNow
@@ -560,6 +557,30 @@ class ConsRiskySolver(ConsIndShockSolver):
self.EndOfPrdvFunc = self.preRiskyShkvFunc
+ return EndOfPrdv
+
+ def make_EndOfPrdvFunc(self, EndOfPrdvP):
+ """
+ Construct the end-of-period value function for this period, storing it
+ as an attribute of self for use by other methods.
+
+ Parameters
+ ----------
+ EndOfPrdvP : np.array
+ Array of end-of-period marginal value of assets corresponding to the
+ asset values in self.aNrmNow.
+
+ Returns
+ -------
+ none
+ """
+
+ if self.IndepDstnBool:
+
+ preIncShkvFunc = self.calc_preIncShkvFunc(self.vFuncNext)
+
+ EndOfPrdv = self.calc_preRiskyShkvFunc(preIncShkvFunc)
+
else:
def v_next(shocks, a_nrm):
