Skip to content

Commit

Permalink
all params in bequest are scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlujan91 committed Mar 20, 2024
1 parent 6b943e9 commit 01745f8
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions HARK/ConsumptionSaving/ConsBequestModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@


class BequestWarmGlowConsumerType(IndShockConsumerType):
time_inv_ = IndShockConsumerType.time_inv_ + [
"BeqCRRA",
"BeqShift",
]

time_vary_ = IndShockConsumerType.time_vary_ + [
"BeqFac",
]
time_inv_ = IndShockConsumerType.time_inv_ + ["BeqCRRA", "BeqShift", "BeqFac"]

def __init__(self, **kwds):
params = init_wealth_in_utility.copy()
Expand All @@ -68,14 +61,8 @@ def update_parameters(self):
if not isinstance(self.BeqCRRA, (int, float)):
raise ValueError("Bequest CRRA parameter must be a single value.")

if isinstance(self.BeqFac, (int, float)):
self.BeqFac = [self.BeqFac] * self.T_cycle
elif len(self.BeqFac) == 1:
self.BeqFac *= self.T_cycle
elif len(self.BeqFac) != self.T_cycle:
raise ValueError(
"Bequest relative value parameter must be a single value or a list of length T_cycle",
)
if not isinstance(self.BeqFac, (int, float)):
raise ValueError("Bequest relative value parameter must be a single value.")

if not isinstance(self.BeqShift, (int, float)):
raise ValueError("Bequest Stone-Geary parameter must be a single value.")
Expand Down Expand Up @@ -117,15 +104,7 @@ def update_solution_terminal(self):


class BequestWarmGlowPortfolioType(PortfolioConsumerType):
time_inv_ = IndShockConsumerType.time_inv_ + [
"BeqCRRA",
"BeqShift",
"DiscreteShareBool",
]

time_vary_ = IndShockConsumerType.time_vary_ + [
"BeqFac",
]
time_inv_ = IndShockConsumerType.time_inv_ + ["BeqCRRA", "BeqShift", "BeqFac"]

def __init__(self, **kwds):
params = init_portfolio_bequest.copy()
Expand All @@ -145,14 +124,8 @@ def update_parameters(self):
if not isinstance(self.BeqCRRA, (int, float)):
raise ValueError("Bequest CRRA parameter must be a single value.")

if isinstance(self.BeqFac, (int, float)):
self.BeqFac = [self.BeqFac] * self.T_cycle
elif len(self.BeqFac) == 1:
self.BeqFac *= self.T_cycle
elif len(self.BeqFac) != self.T_cycle:
raise ValueError(
"Bequest relative value parameter must be a single value or a list of length T_cycle",
)
if not isinstance(self.BeqFac, (int, float)):
raise ValueError("Bequest relative value parameter must be a single value.")

if not isinstance(self.BeqShift, (int, float)):
raise ValueError("Bequest Stone-Geary parameter must be a single value.")
Expand Down

0 comments on commit 01745f8

Please sign in to comment.