| name | gdp-forecasting |
| description | GDP预测模型,支持生产法、支出法与HP滤波趋势外推。适用于宏观经济预测方法的。ARIMA/HP滤波为简化实现,未做季节调整与结构断点检验,不适用于正式经济预测,不构成投资建议。 |
| version | 1.0.0 |
| author | wangyi |
gdp-forecasting
GDP 预测模型工具,支持生产法、支出法和趋势+周期分解方法对国内生产总值进行预测分析,仅使用 Python 标准库。
📌 说明:本工具基于简化模型实现,仅使用 Python 标准库。结果仅供学习参考,不构成投资建议。
脚本API
production_approach(sector_data, forecast_horizon=4)
生产法 GDP 预测。
必填: sector_data
expenditure_approach(expenditure_components, forecast_horizon=4)
支出法 GDP 预测。
必填: expenditure_components
hp_filter(series, lam=1600.0, max_iter=1000, tol=1e-08)
Hodrick-Prescott 滤波分解。
必填: series
hp_filter_forecast(historical_gdp, lam=1600.0, forecast_horizon=4)
HP滤波趋势外推预测。
必填: historical_gdp
forecast_gdp(method='hp_filter')
统一 GDP 预测接口。
调用示例
python scripts/main.py \
--method <method> \
--expenditure-components <expenditure_components> \
--forecast-horizon <forecast_horizon> \
--historical-gdp <historical_gdp> \
--lam <lam> \
--max-iter <max_iter> \
--sector-data <sector_data> \
--series <series> \
--tol <tol>