Allows government consumption and investment to come from multiple sectors - #1192
Allows government consumption and investment to come from multiple sectors#1192jdebacker wants to merge 18 commits into
Conversation
|
One important note on the changes in this PR: because each industry contributes to the production of This also means that When running local tests, I'm finding that all the tests that run fully through the SS solution (except for one case) pass: and that all the tests that run fully through the TPI solution (except for the new test added where the IO matrix represents multiple industries contributing to I'm going to ensure these tests pass. But then for other tests that add a new in put (usually G, such as in |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1192 +/- ##
==========================================
+ Coverage 72.71% 72.78% +0.06%
==========================================
Files 22 22
Lines 5725 5787 +62
==========================================
+ Hits 4163 4212 +49
- Misses 1562 1575 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Just one local test failing right now: |
arihantlodha-cmd
left a comment
There was a problem hiding this comment.
Focused on the new parameters and their docs and validation here, not the full production-sector derivation, so treat this as a partial review.
The io_matrix changes look clean and the docs match the code. I traced the row indexing: the description says the first I rows are consumption goods, row I is government consumption, and row I+1 is infrastructure, and that lines up exactly with how it gets used (io_matrix[:p.I] for C, io_matrix[p.I] for G, io_matrix[p.I+1] for I_g in both SS.py and aggregates). Nice that the new shape validation in parameters.py, checking (I+2, M) and that each row sums to 1, makes a bad matrix fail loudly instead of flowing through silently.
Two small things:
The row-sum check is good, but it doesn't verify entries are non-negative. A hand-built io_matrix could have a negative coefficient and still sum to 1 per row, which would be economically off but pass validation. Worth a >= 0 check while you're already validating shape and sums?
Minor: when the row-sum check fails the error just says each row must sum to 1. Naming the offending row index would make a mis-entered matrix faster to fix, but not important.
Also looked at the new p_g and p_Ig entries in model_variables.json. Labels are escape-clean and the trailing-newline fix on that file is a nice touch.
Looks good from the parameter side.
In the current OG-Core, the M-th industry produces all of the non-consumption goods: capital, government consumption, and infrastructure. This PR relaxes the assumption somewhat, allowing all industries' output to combine in producing government consumption expenditures and infrastructure goods.
Addresses Issue #985