0

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)

2 Answers2

0

arch_model is a more general constructor and doesn't take the truncation argument.

If you want to use something other than the default value for truncation, then you can follow the examples here.

That's one issue with your code, but without knowing what error you received or being able to reproduce your example, it's hard to say more.

Das_Geek
  • 2,775
  • 7
  • 20
  • 26
Josh
  • 11
  • 1
0

This model isn't part of the simplified interface, and so needs to be built in parts.

from arch.univariate import ConstantMean, FIGARCH, Normal
from arch.data import sp500

rets = 100 * sp500.load()["Adj Close"].pct_change().dropna()
mod = ConstantMean(rets, volatility=FIGARCH(truncation=500), distribution=Normal())
res = mod.fit(update_freq=5)
res.summary()

This returns

                    Constant Mean - FIGARCH Model Results
==============================================================================
Dep. Variable:              Adj Close   R-squared:                       0.000
Mean Model:             Constant Mean   Adj. R-squared:                  0.000
Vol Model:                    FIGARCH   Log-Likelihood:               -6924.08
Distribution:                  Normal   AIC:                           13858.2
Method:            Maximum Likelihood   BIC:                           13890.8
                                        No. Observations:                 5030
Date:                Thu, Feb 25 2021   Df Residuals:                     5029
Time:                        09:56:30   Df Model:                            1
                                 Mean Model
============================================================================
                 coef    std err          t      P>|t|      95.0% Conf. Int.
----------------------------------------------------------------------------
mu             0.0582  1.138e-02      5.115  3.140e-07 [3.589e-02,8.048e-02]
                              Volatility Model
============================================================================
                 coef    std err          t      P>|t|      95.0% Conf. Int.
----------------------------------------------------------------------------
omega          0.0430  1.464e-02      2.934  3.348e-03 [1.426e-02,7.166e-02]
phi            0.0862  6.182e-02      1.395      0.163  [-3.491e-02,  0.207]
d              0.5072  8.634e-02      5.874  4.243e-09     [  0.338,  0.676]
beta           0.5188      0.111      4.668  3.046e-06     [  0.301,  0.737]
============================================================================

Covariance estimator: robust
Kevin S
  • 2,595
  • 16
  • 22