Induced-investment equation - calc_dy_inv_induced
- Dominant language
- Python
- Stars
- 5
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Induced-investment equation: inconsistency in the floor logic in calc_dy_inv_induced:
# ! limit; we need this for sectors that go into zero and then back
investment.loc[investment['dk'] > investment['dk_base'] * 3, 'dk'] = investment['dk_base'] * 3
investment.loc[investment['dk'] + investment['dk_base'] < investment['dk_base'] * 0.1, 'dk'] = investment['dk_base'] * 0.1
dk is a delta (ΔI) — it gets added to dk_base downstream (dk_base_new = dk_induced + dk_base + dk_recyc at model_class.py:1588), not used as a level on its own.
The floor's condition checks the total: dk_base + dk < dk_base * 0.1. That looks like the intended guard for sectors collapsing to near-zero.
But the assignment sets dk (the delta) to dk_base * 0.1, not the total. So when the floor triggers, the resulting level becomes:
dk_base_new = dk_base + dk = dk_base + 0.1*dk_base = 1.1 * dk_base
That's a 10% increase over last year, not a floor at 10% of last year — the opposite of what the condition seems to be testing for.
If the intent was "don't let investment fall below 10% of its previous level," I think the assignment should be:
investment.loc[investment['dk'] + investment['dk_base'] < investment['dk_base'] * 0.1, 'dk'] = investment['dk_base'] * 0.1 - investment['dk_base']
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate calc_dy_inv_induced and read model_class.py around line 1588 to confirm how dk is combined with dk_base. Check the floor behavior for sectors approaching zero against the stated 10%-of-previous-level intent; done means the resulting investment level respects that floor without breaking the upper limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100