Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time varying unemployment probability and income #1112

Merged
merged 6 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Release Date: TBD
### Minor Changes

* Updates the lognormal-income-process constructor from `ConsIndShockModel.py` to use `IndexDistribution`. [#1024](https://github.com/econ-ark/HARK/pull/1024)
* Allows for age-varying unemployment probabilities and replacement incomes with the lognormal income process constructor. [#1112](https://github.com/econ-ark/HARK/pull/1112)

### 0.12.0

Expand Down
28 changes: 26 additions & 2 deletions HARK/ConsumptionSaving/ConsIndShockModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2695,8 +2695,32 @@ def construct_lognormal_income_process_unemployment(self):
normal_length = T_cycle
retire_length = 0

UnempPrb_list = [UnempPrb] * normal_length + [UnempPrbRet] * retire_length
IncUnemp_list = [IncUnemp] * normal_length + [IncUnempRet] * retire_length
# Unemployment parametrs can be given either as:
if all(
[
isinstance(x, float)
for x in [UnempPrb, IncUnemp, UnempPrbRet, IncUnempRet]
]
):

UnempPrb_list = [UnempPrb] * normal_length + [UnempPrbRet] * retire_length
IncUnemp_list = [IncUnemp] * normal_length + [IncUnempRet] * retire_length

elif all([isinstance(x, list) for x in [UnempPrb, IncUnemp]]):

UnempPrb_list = UnempPrb
IncUnemp_list = IncUnemp

else:

raise Exception(
"Unemployment must be specified either using floats for UnempPrb,"
+ "IncUnemp, UnempPrbRet, and IncUnempRet, in which case the "
+ "unemployment probability and income change only with retirement, or "
+ "using lists of length T_cycle for UnempPrb and IncUnemp, specifying "
+ "each feature at every age."
)

PermShkCount_list = [PermShkCount] * normal_length + [1] * retire_length
TranShkCount_list = [TranShkCount] * normal_length + [1] * retire_length

Expand Down
2 changes: 1 addition & 1 deletion HARK/ConsumptionSaving/tests/test_ConsMarkovModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def setUp(self):
init_serial_unemployment["MrkvArray"] = [MrkvArray]
init_serial_unemployment[
"UnempPrb"
] = 0 # to make income distribution when employed
] = 0.0 # to make income distribution when employed
init_serial_unemployment["global_markov"] = False
self.model = MarkovConsumerType(**init_serial_unemployment)
self.model.cycles = 0
Expand Down
2 changes: 1 addition & 1 deletion HARK/ConsumptionSaving/tests/test_modelInits.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_MarkovConsumerType(self):
init_serial_unemployment["MrkvArray"] = [MrkvArray]
init_serial_unemployment[
"UnempPrb"
] = 0 # to make income distribution when employed
] = 0.0 # to make income distribution when employed
init_serial_unemployment["global_markov"] = False
SerialUnemploymentExample = MarkovConsumerType(**init_serial_unemployment)
except:
Expand Down
62 changes: 40 additions & 22 deletions examples/ConsumptionSaving/example_ConsMarkovModel.ipynb

Large diffs are not rendered by default.