Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [0.14.4] - 2025-06-23 18:00:00

### Added

- Fixes the sign error on the remittances `RM` term in `aggregates.py`, `resource_constraint()` function.
- Added a test with positive remittances to `test_aggregates.py`, `test_resource_constraint()` function.

## [0.14.3] - 2025-04-25 10:00:00

### Added
Expand Down Expand Up @@ -383,6 +390,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Any earlier versions of OG-USA can be found in the [`OG-Core`](https://github.com/PSLmodels/OG-Core) repository [release history](https://github.com/PSLmodels/OG-Core/releases) from [v.0.6.4](https://github.com/PSLmodels/OG-Core/releases/tag/v0.6.4) (Jul. 20, 2021) or earlier.


[0.14.4]: https://github.com/PSLmodels/OG-Core/compare/v0.14.3...v0.14.4
[0.14.3]: https://github.com/PSLmodels/OG-Core/compare/v0.14.2...v0.14.3
[0.14.2]: https://github.com/PSLmodels/OG-Core/compare/v0.14.1...v0.14.2
[0.14.1]: https://github.com/PSLmodels/OG-Core/compare/v0.14.0...v0.14.1
Expand Down
2 changes: 1 addition & 1 deletion ogcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
from ogcore.txfunc import *
from ogcore.utils import *

__version__ = "0.14.3"
__version__ = "0.14.4"
4 changes: 2 additions & 2 deletions ogcore/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def resource_constraint(Y, C, G, I_d, I_g, net_capital_flows, RM):
\text{rc_error} &= \hat{Y}_t - \hat{C}_t -
\Bigl(e^{g_y}\bigl[1 + \tilde{g}_{n,t+1}\bigr]\hat{K}^d_{t+1} -
\hat{K}^d_t\Bigr) - \delta\hat{K}_t - \hat{G}_t - \hat{I}_{g,t} ... \\
&\qquad -\: \hat{\text{net capital outflows}}_t - \hat{RM}_t
&\qquad -\: \hat{\text{net capital outflows}}_t + \hat{RM}_t
\end{split}

Args:
Expand All @@ -542,7 +542,7 @@ def resource_constraint(Y, C, G, I_d, I_g, net_capital_flows, RM):
rc_error (array_like): error in the resource constraint

"""
rc_error = Y - C - I_d - I_g - G - net_capital_flows - RM
rc_error = Y - C - I_d - I_g - G - net_capital_flows + RM

return rc_error

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="ogcore",
version="0.14.3",
version="0.14.4",
author="Jason DeBacker and Richard W. Evans",
license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
description="A general equilibrium overlapping generations model for fiscal policy analysis",
Expand Down
54 changes: 45 additions & 9 deletions tests/test_aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1699,21 +1699,57 @@ def test_get_r_p(r, r_gov, p_m, K_vec, K_g, D, MPKg_vec, method, expected):
assert np.allclose(r_p_test, expected)


def test_resource_constraint():
test_data_rc = [
(
np.array([48, 55, 2, 99, 8]), # Y
np.array([33, 44, 0.4, 55, 6]), # C
np.array([4, 5, 0.01, 22, 0]), # G
np.array([20, 5, 0.6, 10, 1]), # I_d
np.array([0.0, 0.0, 0.0, 0.0, 0.0]), # I_g
np.array([0.1, 0, 0.016, -1.67, -0.477]), # net_capital_flows
np.array([0.0, 0.0, 0.0, 0.0, 0.0]), # RM1
np.array([-9.1, 1, 0.974, 13.67, 1.477]), # expected1
),
(
np.array([48, 55, 2, 99, 8]), # Y
np.array([33, 44, 0.4, 55, 6]), # C
np.array([4, 5, 0.01, 22, 0]), # G
np.array([20, 5, 0.6, 10, 1]), # I_d
np.array([0.0, 0.0, 0.0, 0.0, 0.0]), # I_g
np.array([0.1, 0, 0.016, -1.67, -0.477]), # net_capital_flows
np.array([0.0, 0.0, 0.0, 0.0, 0.03]), # RM2
np.array([-9.1, 1, 0.974, 13.67, 1.507]), # expected2
),
]


@pytest.mark.parametrize(
"Y,C,G,I_d,I_g,net_capital_flows,RM,expected",
test_data_rc,
ids=["RM=0, M=5", "RM>0, M=5"],
)
def test_resource_constraint(
Y, C, G, I_d, I_g, net_capital_flows, RM, expected
):
"""
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])
RM = np.array([0.0, 0.0, 0.0, 0.0, 0.0])
expected = np.array([-9.1, 1, 0.974, 13.67, 1.477])
# 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)

Expand Down
Loading