From 428ddd57457e2f71d37b92ce5a0fe67045be4da3 Mon Sep 17 00:00:00 2001 From: "Matthew N. White" Date: Mon, 25 Mar 2024 16:49:49 -0400 Subject: [PATCH] Even more formatting --- HARK/ConsumptionSaving/ConsRiskyAssetModel.py | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/HARK/ConsumptionSaving/ConsRiskyAssetModel.py b/HARK/ConsumptionSaving/ConsRiskyAssetModel.py index 2521e7614..71d09af16 100644 --- a/HARK/ConsumptionSaving/ConsRiskyAssetModel.py +++ b/HARK/ConsumptionSaving/ConsRiskyAssetModel.py @@ -428,8 +428,9 @@ def __init__(self, verbose=False, quiet=False, **kwds): self.solve_one_period = solve_one_period_FixedShareRiskyAsset -#################################################################################################### -#################################################################################################### + +############################################################################### +############################################################################### def solve_one_period_ConsIndShockRiskyAsset( @@ -875,6 +876,7 @@ def calc_vPPnext(S, a): ) return solution_now + ############################################################################### def solve_one_period_ConsPortChoice( @@ -1305,6 +1307,7 @@ def calc_EndOfPrd_v(S, a, z): solution_now.ShareFunc = ShareFunc_now return solution_now + ############################################################################### def solve_one_period_FixedShareRiskyAsset( @@ -1405,7 +1408,7 @@ def solve_one_period_FixedShareRiskyAsset( # Perform an alternate calculation of the absolute patience factor when returns are risky def calc_Radj(R): - R_temp = RiskyShareFixed*R + (1.0-RiskyShareFixed)*Rfree + R_temp = RiskyShareFixed * R + (1.0 - RiskyShareFixed) * Rfree return R_temp ** (1.0 - CRRA) PatFac = (DiscFacEff * expected(calc_Radj, RiskyDstn)) ** (1.0 / CRRA) @@ -1567,18 +1570,18 @@ def calc_vPPnext(S, b): # Begin by re-defining transition functions for taking expectations, which are all very simple! Z = RiskyShareFixed # for shorter notation def calc_bNrmNext(R, a): - Rport = (Z*R + (1-Z)*Rfree) + Rport = Z * R + (1 - Z) * Rfree return Rport * a def calc_vNext(R, a): return Intermed_vFunc(calc_bNrmNext(R, a)) def calc_vPnext(R, a): - Rport = (Z*R + (1-Z)*Rfree) + Rport = Z * R + (1 - Z) * Rfree return Rport * Intermed_vPfunc(calc_bNrmNext(R, a)) def calc_vPPnext(R, a): - Rport = (Z*R + (1-Z)*Rfree) + Rport = Z * R + (1 - Z) * Rfree return Rport * Rport * Intermed_vPPfunc(calc_bNrmNext(R, a)) # Calculate end-of-period marginal value of assets at each gridpoint @@ -1635,7 +1638,7 @@ def calc_vPPnext(R, a): Z = RiskyShareFixed # for shorter notation def calc_mNrmNext(S, a): Risky = S["Risky"] - Rport = Z*Risky + (1-Z)*Rfree + Rport = Z * Risky + (1 - Z) * Rfree return Rport / (PermGroFac * S["PermShk"]) * a + S["TranShk"] def calc_vNext(S, a): @@ -1643,16 +1646,14 @@ def calc_vNext(S, a): def calc_vPnext(S, a): Risky = S["Risky"] - Rport = Z*Risky + (1-Z)*Rfree - return ( - Rport * S["PermShk"] ** (-CRRA) * vPfuncNext(calc_mNrmNext(S, a)) - ) + Rport = Z * Risky + (1 - Z) * Rfree + return Rport * S["PermShk"] ** (-CRRA) * vPfuncNext(calc_mNrmNext(S, a)) def calc_vPPnext(S, a): Risky = S["Risky"] - Rport = Z*Risky + (1-Z)*Rfree + Rport = Z * Risky + (1 - Z) * Rfree return ( - (Rport ** 2) + (Rport**2) * S["PermShk"] ** (-CRRA - 1.0) * vPPfuncNext(calc_mNrmNext(S, a)) )