From 99a1633740b38ec01225c1ed43af6ed7bbdb5214 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 13 Jan 2021 16:27:18 -0500 Subject: [PATCH] use calcExpectation in vPP calculation in MarkovModel. #625 --- HARK/ConsumptionSaving/ConsMarkovModel.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/HARK/ConsumptionSaving/ConsMarkovModel.py b/HARK/ConsumptionSaving/ConsMarkovModel.py index 9b2807ee9..1fbc5ba51 100644 --- a/HARK/ConsumptionSaving/ConsMarkovModel.py +++ b/HARK/ConsumptionSaving/ConsMarkovModel.py @@ -17,7 +17,11 @@ PerfForesightConsumerType, ) -from HARK.distribution import DiscreteDistribution, Uniform +from HARK.distribution import ( + DiscreteDistribution, + Uniform, + calcExpectation +) from HARK.interpolation import ( CubicInterp, LowerEnvelope, @@ -321,16 +325,19 @@ def calcEndOfPrdvPP(self): End-of-period marginal marginal value of assets at each value in the grid of assets. """ + def vpp_next(shocks, a_nrm): + return shocks[0] ** (- self.CRRA - 1.0) \ + * self.vPPfuncNext(self.m_nrm_next(shocks, a_nrm)) + EndOfPrdvPP = ( self.DiscFacEff * self.Rfree * self.Rfree * self.PermGroFac ** (-self.CRRA - 1.0) - * np.sum( - self.PermShkVals_temp ** (-self.CRRA - 1.0) - * self.vPPfuncNext(self.mNrmNext) - * self.ShkPrbs_temp, - axis=0, + * calcExpectation( + self.IncomeDstn, + vpp_next, + self.aNrmNow ) ) return EndOfPrdvPP