bashtage / arch

ARCH models in Python
Other
1.29k stars 247 forks source link

Setting truncation parameter for FIGARCH results in unexpected argument #735

Closed BicycleChrist closed 3 weeks ago

BicycleChrist commented 3 weeks ago

This may be a failure of understanding on my part, if so I apologize on the front end. The line below results in a unexpected keyword argument, and from what i can tell this should work given how its explained in the docs and how other models parameters are set

arch_model(ticker_data, vol='FIGARCH',p=1, q=1, power=2, truncation=2000)

Removing the truncation parameter in this line allows me to run the model and obtain results, leading me to believe the model is just running with the default value of truncation=1000.

bashtage commented 3 weeks ago

I don't think you can set this parameter when using the simplified arch_model constructor. You need to directly construct the model using

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

ticker_data = 100 * sp500.load()["Adj Close"].pct_change().dropna()
mod = ConstantMean(ticker_data, volatility=FIGARCH(p=1,q=1,power=2,truncation=2000))
res = mod.fit()
res
                    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:               -6925.16
Distribution:                  Normal   AIC:                           13860.3
Method:            Maximum Likelihood   BIC:                           13892.9
                                        No. Observations:                 5030
Date:                Thu, Jun 27 2024   Df Residuals:                     5029
Time:                        16:05:30   Df Model:                            1
                                 Mean Model
============================================================================
                 coef    std err          t      P>|t|      95.0% Conf. Int.
----------------------------------------------------------------------------
mu             0.0587  1.137e-02      5.163  2.429e-07 [3.643e-02,8.101e-02]
                              Volatility Model
============================================================================
                 coef    std err          t      P>|t|      95.0% Conf. Int.
----------------------------------------------------------------------------
omega          0.0280  1.194e-02      2.348  1.886e-02 [4.636e-03,5.142e-02]
phi            0.0846  5.876e-02      1.440      0.150  [-3.056e-02,  0.200]
d              0.5320  9.022e-02      5.897  3.713e-09     [  0.355,  0.709]
beta           0.5407      0.108      5.024  5.049e-07     [  0.330,  0.752]
============================================================================

Covariance estimator: robust
ARCHModelResult, id: 0x7fea34971370

and

In [16]: mod.volatility.truncation
Out[16]: 2000
BicycleChrist commented 3 weeks ago

Thanks for the quick response