You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

复现Kontonikas论文:含通胀与虚拟变量的GARCH-M模型参数求解求助

复现Kontonikas论文GARCH模型的参数整合问题

我是一名大学生,正在复现A. Kontonikas的论文《Inflation and inflation uncertainty in the United Kingdom, evidence from GARCH modelling》。在实现GARCH模型的过程中,我已成功求得omega、alpha 1、beta 1参数,但无法将论文中提及的lambda1、lambda2等参数整合到模型中,也不确定如何正确融入方差模型框架。

相关说明与材料:

  • 已明确均值方程、条件方差方程的形式
  • 完成了初始Python代码编写,并有相关输出(包括均值方程输出、条件方差模型输出、论文中缺失参数高亮提示、OLS模型变量数据集、arch_model运行结果)
  • 使用的数据集与论文略有不同

恳请指导如何获取这些额外参数并完成模型构建。

import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
from arch import arch_model

# 创建示例数据框
data = {
    'Date': pd.date_range('1972-01-01', '2002-12-31', freq='M'),
    'Monthly_cpi': np.random.rand(372),  # 替换为实际CPI数据
}
cpi_df_monthly = pd.DataFrame(data)
cpi_df_monthly['log_first_diff'] = 100 * (np.log(cpi_df_monthly['Monthly_cpi']) - np.log(cpi_df_monthly['Monthly_cpi'].shift()))

# 设置虚拟变量列
cpi_df_monthly['Dummy'] = 0
cpi_df_monthly.loc[cpi_df_monthly['Date'] > '1992-09-30', 'Dummy'] = 1

# 注意:xt_1、xt_3、xt_6、xt_12需替换为实际定义的变量
cpi_df_monthly_modeldf = cpi_df_monthly[['Date', 'log_first_diff', 'xt_1', 'xt_3', 'xt_6', 'xt_12', 'Dummy']].dropna()

# 带虚拟变量的月度OLS模型
monthly_model_dummy = smf.ols(
    formula="log_first_diff ~ Dummy * xt_1 + xt_3 + xt_6 + Dummy * xt_12",
    data=cpi_df_monthly_modeldf
).fit()
print(monthly_model_dummy.summary())

# 为ARCH模型准备变量数据框
cpi_df_monthly_variables = cpi_df_monthly_modeldf[['xt_1', 'xt_3', 'xt_6', 'xt_12', 'Dummy']]
cpi_df_monthly_variables['Dummy*xt_1'] = cpi_df_monthly_variables['xt_1'] * cpi_df_monthly_variables['Dummy']
cpi_df_monthly_variables['Dummy*xt_12'] = cpi_df_monthly_variables['Dummy'] * cpi_df_monthly_variables['xt_12']

# 月度(1,1)GARCH模型
mod = arch_model(
    y=cpi_df_monthly_modeldf.log_first_diff,
    x=cpi_df_monthly_variables[['xt_1', 'xt_3', 'xt_6', 'xt_12', 'Dummy*xt_1', 'Dummy*xt_12']],
    mean="ARX",
    vol='GARCH',
    p=1,
    q=1,
)
res = mod.fit(disp='off')
print(res.summary())

内容的提问来源于stack exchange,提问作者Carla

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 10:53:24