Hi Stack Overflow community, and thanks for reading me.
I'm a beginner in Python. In order to compute the value at risk, I have to forecast FIGARCH and calculate the daily conditional mean and standard deviation. To do that, I used the package ‘ARCH’ which contains the FIGARCH model + the following link: https://arch.readthedocs.io/en/latest/univariate/volatility.html#fractionally-integrated-fi-garch
This link specifies the parameters:
class arch.univariate.FIGARCH(p=1, q=1, power=2.0, truncation=1000)
Parameters: p ({0, 1}) – Order of the symmetric innovation q ({0, 1}) – Order of the lagged (transformed) conditional variance power (float, optional) – Power to use with the innovations, abs(e) ** power. Default is 2.0, which produces FIGARCH and related models. Using 1.0 produces FIAVARCH and related models. Other powers can be specified, although these should be strictly positive, and usually larger than 0.25. truncation (int, optional) – Truncation point to use in ARCH(∞∞) representation. Default is 1000.
This is the code I tried but it doesn’t work:
from arch.univariate import FIGARCH
mod_4 = arch_model(results, p=1, q=1, power=2.0, truncation=1000)
res_4 = mod_4.fit(update_freq=5)
q_4 = mod_4.distribution.ppf(p)
forecasts_4 = res_4.forecast()
cond_mean_4 = forecasts_4.mean
cond_var_4 = forecasts_4.variance
value_at_risk_4 = - cond_mean_4.values - np.sqrt(cond_var_4).values * q_4[None, :]
print("value_at_risk_4 =",value_at_risk_4)