Threshold and component GARCH (p,q)-M models augmented by past inflation and targeting dummy - Python code

97 views Asked by At

I am a university student trying to replicate the paper 'Inflation and inflation uncertainty in the United Kingdom, evidence from GARCH modelling' by A. Kontonikas and I am looking for guidance regarding my work on the GARCH models. Despite exploring various methods, I have encountered challenges in obtaining all the parameters outlined in the paper. In particular, while I have successfully obtained the parameters omega, alpha 1, and beta 1, there are additional parameters highlighted in the paper such as lambda1, lamda2 etc. (as per the attached screenshot) that I am struggling to incorporate into my GARCH model. I am uncertain about how to address this discrepancy and properly integrate the variance model into our framework.

Below, I have outlined the mean and variance equations, shared my initial code, and attached the relevant outputs. I have used a slightly different dataset from the paper.

Mean equations Conditional variance models Output in the paper with the parameters I am missing highlighted Dataframe with just variables used in the OLS model GARCH by using this dataframe containing, monthly OLS model variables, in the arch_model equation

I would be very grateful for any guidance on how I might obtain the parameters for the additional terms specified in the paper and the construction of the models. Many thanks.


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

# Create a sample dataframe
data = {
    'Date': pd.date_range('1972-01-01', '2002-12-31', freq='M'),
    'Monthly_cpi': np.random.rand(372),  # Replace this with your actual Monthly_cpi data
}
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()))

# Set the 'Dummy' column
cpi_df_monthly['Dummy'] = 0
cpi_df_monthly.loc[cpi_df_monthly['Date'] > '1992-09-30', 'Dummy'] = 1

# Set up variables dataframe
cpi_df_monthly_modeldf = cpi_df_monthly[['Date', 'log_first_diff', 'xt_1', 'xt_3', 'xt_6', 'xt_12', 'Dummy']].dropna()

# Monthly model with Dummy
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())

# Set up variables dataframe for 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']

# Monthly (1,1) ARCH model
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())
0

There are 0 answers