diff --git a/docs/book/content/theory/government.md b/docs/book/content/theory/government.md index 93624484d..59b4eb475 100644 --- a/docs/book/content/theory/government.md +++ b/docs/book/content/theory/government.md @@ -615,11 +615,11 @@ Note that the budget closure rule (described in Section ref{`SecUnbalGBCcloseRul (SecUnbalGBCbudgConstr)= ## Government Budget Constraint - Let the level of government debt in period $t$ be given by $D_t$. The government budget constraint requires that government revenue $Rev_t$ plus the budget deficit ($D_{t+1} - D_t$) equal expenditures on interest on the debt, government spending on public goods $G_t$, total infrastructure investments $I_{g,t}$, total pension outlays, total transfer payments to households $TR_t$, and $UBI_t$ every period $t$, + Let the level of government debt in period $t$ be given by $D_t$. The government budget constraint requires that government revenue $Rev_t$, external foreign assistance, $FA_t$, plus the budget deficit ($D_{t+1} - D_t$) equal expenditures on interest on the debt, government spending on public goods $G_t$, total infrastructure investments $I_{g,t}$, total pension outlays, total transfer payments to households $TR_t$, and $UBI_t$ every period $t$, ```{math} :label: EqUnbalGBCbudgConstr - D_{t+1} + Rev_t = (1 + r_{gov,t})D_t + G_t + I_{g,t} + Pensions_t + TR_t + UBI_t \quad\forall t + D_{t+1} + Rev_t + FA_t = (1 + r_{gov,t})D_t + G_t + I_{g,t} + Pensions_t + TR_t + UBI_t \quad\forall t ``` where $r_{gov,t}$ is the interest rate paid by the government defined in equation {eq}`EqUnbalGBC_rate_wedge` below, $G_{t}$ is government spending on public goods, $I_{g,t}$ is total government spending on infrastructure investment, $TR_{t}$ are non-pension government transfers, and $UBI_t$ is the total UBI transfer outlays across households in time $t$. All variables in {eq}`EqUnbalGBCbudgConstr` are real variables denominated in units of current-period output in industry $M$ the numeraire ($p_{M,t}=1$ for all $t$). @@ -713,8 +713,8 @@ Note that the budget closure rule (described in Section ref{`SecUnbalGBCcloseRul &\text{where}\quad g_{g,t} = \begin{cases} 1 \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\:\text{if}\quad t < T_{G1} \\ - \frac{\left[\rho_{d}\alpha_{D}Y_{t} + (1-\rho_{d})D_{t}\right] - (1+r_{gov,t})D_{t} - I_{g,t} - TR_{t} - UBI_{t} + Rev_{t}}{\alpha_g Y_t} \quad\text{if}\quad T_{G1}\leq t= p.tG1) and (t < p.tG2): @@ -124,6 +128,7 @@ def D_G_path(r, dg_fixed_values, p): * (p.rho_G * p.debt_ratio_ss * Y[t] + (1 - p.rho_G) * D[t]) - (1 + r_gov[t]) * D[t] + total_tax_revenue[t] + + foreign_aid[t] - agg_pension_outlays[t] - I_g[t - 1] - TR[t] @@ -134,6 +139,7 @@ def D_G_path(r, dg_fixed_values, p): growth[t + 1] * (p.debt_ratio_ss * Y[t]) - (1 + r_gov[t]) * D[t] + total_tax_revenue[t] + + foreign_aid[t] - agg_pension_outlays[t] - I_g[t - 1] - TR[t] @@ -152,12 +158,14 @@ def D_G_path(r, dg_fixed_values, p): + UBI_outlays[t - 1] + agg_pension_outlays[t - 1] - total_tax_revenue[t - 1] + - foreign_aid[t - 1] ) r_gov[t] = get_r_gov(r[t], D[t] / Y[t], p, method="scalar", t=t) G[t] = ( growth[t] * (p.debt_ratio_ss * Y[t]) - (1 + r_gov[t]) * D[t] + total_tax_revenue[t] + + foreign_aid[t] - agg_pension_outlays[t] - I_g[t - 1] - TR[t] @@ -171,6 +179,7 @@ def D_G_path(r, dg_fixed_values, p): + UBI_outlays[t] + agg_pension_outlays[t] - total_tax_revenue[t] + - foreign_aid[t] ) D_ratio_max = np.amax(D[: p.T] / Y[: p.T]) print("Maximum debt ratio: ", D_ratio_max) @@ -284,12 +293,14 @@ def get_G_ss( G (tuple): steady-state government spending """ + foreign_aid = p.alpha_FA * Y if p.budget_balance: G = p.alpha_G[-1] * Y else: G = ( total_tax_revenue + new_borrowing + + foreign_aid - (agg_pension_outlays + TR + debt_service + UBI_outlays + I_g) ) @@ -354,9 +365,15 @@ def get_TR( new_TR (array_like): new value of aggregate government transfers """ + foreign_aid = p.alpha_FA * Y if p.budget_balance: new_TR = ( - total_tax_revenue - agg_pension_outlays - G - UBI_outlays - I_g + total_tax_revenue + + foreign_aid + - agg_pension_outlays + - G + - UBI_outlays + - I_g ) elif p.baseline_spending: new_TR = p.alpha_bs_T[-1] * TR @@ -422,7 +439,7 @@ def get_I_g(Y, Ig_baseline, p, method="SS"): Args: Y (array_like): aggregate output Ig_baseline (array_like): public infrastructure investment in - the baseliine simulation + the baseline simulation p (OG-Core Specifications object): model parameters method (str): either 'SS' for steady-state or 'TPI' for transition path diff --git a/tests/test_aggregates.py b/tests/test_aggregates.py index 0730dd469..8a8641fc7 100644 --- a/tests/test_aggregates.py +++ b/tests/test_aggregates.py @@ -1764,22 +1764,9 @@ def test_resource_constraint( """ Test resource constraint equation. """ - # Y = np.array([48, 55, 2, 99, 8]) - # C = np.array([33, 44, 0.4, 55, 6]) - # G = np.array([4, 5, 0.01, 22, 0]) - # I_d = np.array([20, 5, 0.6, 10, 1]) - # I_g = np.zeros_like(I_d) - # net_capital_flows = np.array([0.1, 0, 0.016, -1.67, -0.477]) - # RM1 = np.array([0.0, 0.0, 0.0, 0.0, 0.0]) - # expected1 = np.array([-9.1, 1, 0.974, 13.67, 1.477]) test_RC = aggr.resource_constraint( Y, C, G, I_d, I_g, net_capital_flows, RM ) - # RM2 = np.array([0.0, 0.0, 0.0, 0.0, 0.03]) - # expected2 = np.array([-9.1, 1, 0.974, 13.67, 1.477]) - # test_RC2 = aggr.resource_constraint( - # Y, C, G, I_d, I_g, net_capital_flows, RM2 - # ) assert np.allclose(test_RC, expected) diff --git a/tests/test_fiscal.py b/tests/test_fiscal.py index 8afbc879e..d82e1f1fa 100644 --- a/tests/test_fiscal.py +++ b/tests/test_fiscal.py @@ -109,10 +109,12 @@ def test_D_G_path( "budget_balance": budget_balance, "r_gov_DY": r_gov_DY, "r_gov_DY2": r_gov_DY2, + "alpha_FA": [0.01], } p.update_specifications(new_param_values, raise_errors=False) r = np.ones(p.T + p.S) * 0.05 p.g_n = np.ones(p.T + p.S) * 0.02 + growth = (1 + p.g_n) * np.exp(p.g_y) D0_baseline = 0.59 Gbaseline[0] = 0.05 I_g = np.zeros_like(TR) @@ -130,8 +132,18 @@ def test_D_G_path( D0_baseline, ) test_tuple = fiscal.D_G_path(r, dg_fixed_values, p) + # update expected value for no-zero foreign aid + foreign_aid = p.alpha_FA[: p.T] * Y[: p.T] / (growth[1 : p.T + 1]) + # expected_tuple[0][1: p.T] = expected_tuple[0][1: p.T] + foreign_aid[0: p.T-1] # Debt + # expected_tuple[1][: p.T] = expected_tuple[1][: p.T] + (p.alpha_FA[: p.T] * Y[: p.T] / (1+growth[:p.T])) # G + # expected_tuple[2][: p.T] = expected_tuple[2][1: p.T] - (p.alpha_FA[: p.T] * Y[: p.T] / (1+growth[:p.T])) # Domestically held debt + # expected_tuple[5][: p.T] = expected_tuple[5][: p.T] - (p.alpha_FA[: p.T] * Y[: p.T] / (1+growth[:p.T])) # New borrowing + print("Foreign aid = ", foreign_aid[:10]) + print("Debt diff = ", test_tuple[0][:10] - expected_tuple[0][:10]) for i, v in enumerate(test_tuple): + print(f"Testing {i}...") + assert np.allclose(v[: p.T], expected_tuple[i][: p.T])