Skip to content

Commit

Permalink
Even more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwhite committed Mar 25, 2024
1 parent 4e0436c commit 428ddd5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions HARK/ConsumptionSaving/ConsRiskyAssetModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -875,6 +876,7 @@ def calc_vPPnext(S, a):
)
return solution_now


###############################################################################

def solve_one_period_ConsPortChoice(
Expand Down Expand Up @@ -1305,6 +1307,7 @@ def calc_EndOfPrd_v(S, a, z):
solution_now.ShareFunc = ShareFunc_now
return solution_now


###############################################################################

def solve_one_period_FixedShareRiskyAsset(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1635,24 +1638,22 @@ 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):
return S["PermShk"] ** (1.0 - CRRA) * vFuncNext(calc_mNrmNext(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))
)
Expand Down

0 comments on commit 428ddd5

Please sign in to comment.