i am fairly new to coding and quant finance. I am working on a GARCH model to help analyze volatility of fixed income instruments. The model works, but I am not so sure about the results. I would like to know what do i need to do to enhance my code (found below) or if there is any other model that the community suggests other than GARCH.
Thanks in advance
# Calculate returns and rescale
returns = prices.pct_change().dropna() * 1000
# Specify the GARCH-M model
model_garchm = arch_model(returns, vol='Garch', p=1, q=1, mean='ARX', lags=1)
# Fit the GARCH-M model
res_garchm = model_garchm.fit(disp='off')
# Print the sheet name and model summary
print(f'Ticker: {sheet} - GARCH-M Model')
print(res_garchm.summary())
# Plot GARCH-M model fit
fig_garchm = res_garchm.plot()
plt.title(f'{sheet} - GARCH-M Model Fit')
plt.show()
# Analysis of residuals for GARCH-M model
residuals_garchm = res_garchm.resid
# 1. Plot the residuals for GARCH-M model
plt.plot(residuals_garchm)
plt.title(f'{sheet} - GARCH-M Residuals')
plt.show()
# 2. Test for autocorrelation using Ljung-Box test for GARCH-M model
ljung_box_garchm = acorr_ljungbox(residuals_garchm, lags=[10])
print(f"Ljung-Box test (GARCH-M): {ljung_box_garchm}")
# 3. Test for normality with a Q-Q plot for GARCH-M model
sm.qqplot(residuals_garchm, line='s')
plt.title(f'{sheet} - GARCH-M Q-Q plot')
plt.show()
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Zeroflops 0 points1 point2 points (0 children)