Skip to content

Commit 7cae932

Browse files
authored
Merge pull request PSLmodels#1166 from marcelolafleur/alpha-FA-time-path
Extend alpha_FA to the model time path
2 parents 667e253 + ae870bb commit 7cae932

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

ogcore/default_parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,9 @@
956956
},
957957
"alpha_FA": {
958958
"title": "Foreign aid payments to domestic government as a share of GDP",
959-
"description": "Foreign aid payments to domestic government as a share of GDP.",
959+
"description": "Foreign aid payments to domestic government as a share of GDP. Set value for base year, click '+' to add value for next year. All future years not specified are set to last value entered.",
960960
"short_description": "Foreign aid as a share of GDP",
961-
"param_notation": "$\\alpha_{FA}$",
961+
"param_notation": "$\\alpha_{FA,t}$",
962962
"section_1": "Fiscal Policy Parameters",
963963
"section_2": "Fiscal Policy Parameters",
964964
"notes": "",

ogcore/parameters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def compute_default_params(self):
181181
"alpha_G",
182182
"alpha_T",
183183
"alpha_I",
184+
"alpha_FA",
184185
"alpha_bs_G",
185186
"alpha_bs_T",
186187
"alpha_bs_I",

tests/test_parameters.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ def test_compute_default_params():
3636
assert specs.alpha_G[10] == 1
3737

3838

39+
def test_alpha_FA_extended_over_time_path():
40+
# alpha_FA is a GDP-share fiscal parameter that may vary over the time
41+
# path, so it should be extrapolated to length T+S with the last value
42+
# carried forward (like alpha_G/alpha_T/alpha_I). A multi-element path
43+
# previously stayed short and broke the TPI fiscal calculations when
44+
# broadcast against Y[:T].
45+
specs = Specifications()
46+
specs.alpha_FA = np.array([0.01, 0.02, 0.03])
47+
specs.compute_default_params()
48+
assert specs.alpha_FA.shape[0] == specs.T + specs.S
49+
assert specs.alpha_FA[0] == 0.01
50+
assert specs.alpha_FA[2] == 0.03
51+
# periods beyond the entered path take the last value entered
52+
assert specs.alpha_FA[specs.T] == 0.03
53+
assert specs.alpha_FA[-1] == 0.03
54+
55+
3956
param_updates1 = {
4057
"T": 4,
4158
"S": 3,

0 commit comments

Comments
 (0)