34 lines
965 B
Python
34 lines
965 B
Python
|
|
"""Tests for Part X empirical regressions."""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from fqbm.empirical.regressions import (
|
||
|
|
run_inflation_pass_through,
|
||
|
|
run_sovereign_spread,
|
||
|
|
run_capital_flow_sensitivity,
|
||
|
|
generate_synthetic_inflation,
|
||
|
|
generate_synthetic_spread,
|
||
|
|
generate_synthetic_capital_flow,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_inflation_pass_through():
|
||
|
|
data = generate_synthetic_inflation(50, seed=42)
|
||
|
|
res = run_inflation_pass_through(data)
|
||
|
|
assert hasattr(res, "params")
|
||
|
|
assert "dS" in res.params.index
|
||
|
|
assert res.rsquared >= 0
|
||
|
|
|
||
|
|
|
||
|
|
def test_sovereign_spread():
|
||
|
|
data = generate_synthetic_spread(50, seed=42)
|
||
|
|
res = run_sovereign_spread(data)
|
||
|
|
assert "debt_gdp" in res.params.index
|
||
|
|
assert "reserves_gdp" in res.params.index
|
||
|
|
|
||
|
|
|
||
|
|
def test_capital_flow_sensitivity():
|
||
|
|
data = generate_synthetic_capital_flow(50, seed=42)
|
||
|
|
res = run_capital_flow_sensitivity(data)
|
||
|
|
assert "rate_diff" in res.params.index
|
||
|
|
assert "risk_premium" in res.params.index
|