PSLmodels / OG-Core

An overlapping generations model framework for evaluating fiscal policies.
https://pslmodels.github.io/OG-Core/
Creative Commons Zero v1.0 Universal
65 stars 112 forks source link

Time varying ability matrix #895

Closed jdebacker closed 7 months ago

jdebacker commented 8 months ago

This PR allows one to use an ability/labor productivity matrix that varies over time. Changing the shape of the e parameter object from SxJ to TxSxJ.

codecov-commenter commented 7 months ago

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (d8a0fa4) 80.28% compared to head (5fa18cb) 80.26%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895/graphs/tree.svg?width=650&height=150&src=pr&token=98mQCVhspd&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels)](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) ```diff @@ Coverage Diff @@ ## master #895 +/- ## ========================================== - Coverage 80.28% 80.26% -0.03% ========================================== Files 18 18 Lines 4144 4175 +31 ========================================== + Hits 3327 3351 +24 - Misses 817 824 +7 ``` | [Flag](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | `80.26% <80.43%> (-0.03%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [ogcore/SS.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL1NTLnB5) | `87.67% <100.00%> (+0.08%)` | :arrow_up: | | [ogcore/TPI.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL1RQSS5weQ==) | `93.02% <100.00%> (-0.02%)` | :arrow_down: | | [ogcore/aggregates.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL2FnZ3JlZ2F0ZXMucHk=) | `100.00% <100.00%> (ø)` | | | [ogcore/parameters.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL3BhcmFtZXRlcnMucHk=) | `84.14% <100.00%> (+0.29%)` | :arrow_up: | | [ogcore/tax.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL3RheC5weQ==) | `99.45% <100.00%> (ø)` | | | [ogcore/utils.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL3V0aWxzLnB5) | `87.91% <100.00%> (+0.03%)` | :arrow_up: | | [ogcore/parameter\_plots.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL3BhcmFtZXRlcl9wbG90cy5weQ==) | `80.86% <75.00%> (+0.15%)` | :arrow_up: | | [ogcore/household.py](https://app.codecov.io/gh/PSLmodels/OG-Core/pull/895?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-b2djb3JlL2hvdXNlaG9sZC5weQ==) | `92.72% <69.56%> (-2.76%)` | :arrow_down: |
rickecon commented 7 months ago

@jdebacker. I deleted my ogcore-dev conda environment and reinstalled it in my clone of your branch. When I ran run_ogcore_example.py and got the following error:

(ogcore-dev) richardevans@Richards-MacBook-Pro-2 run_examples % python run_ogcore_example.py
Number of workers =  7
Traceback (most recent call last):
  File "/Users/richardevans/Docs/Economics/OSE/OG-Core/run_examples/run_ogcore_example.py", line 138, in <module>
    main()
  File "/Users/richardevans/Docs/Economics/OSE/OG-Core/run_examples/run_ogcore_example.py", line 77, in main
    p.e = np.tile(p.e.reshape(1, p.S, p.J), (p.T, 1, 1))
                  ^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot reshape array of size 224000 into shape (1,80,7)
jdebacker commented 7 months ago

@rickecon Noted about the example. That was for some testing and should be taken out. Will update.

jdebacker commented 7 months ago

All test we expect to pass on Python 3.11 pass locally. The three failures are the txfunc.py functions whose results vary with the version on Python/SciPy used:

=========================== short test summary info ============================
FAILED tests/test_txfunc.py::test_txfunc_est[DEP] - assert False
FAILED tests/test_txfunc.py::test_tax_func_loop - assert False
FAILED tests/test_txfunc.py::test_tax_func_estimate - assert False
========= 3 failed, 496 passed, 16819 warnings in 32781.69s (9:06:21) ==========

I was also able to run the run_ogcore_example.py script all the way through without issue.

I believe this PR is ready to merge.

rickecon commented 7 months ago

LGTM. Thanks, @jdebacker.