pyhctsa.operations.model_fit.garch_compare¶
-
pyhctsa.operations.model_fit.garch_compare(y, pre_proc=
'none', pr=(1, 2, 3), qr=(1, 2, 3), random_seed=None)¶ How well GARCH models of different orders describe the changing variance of the series.
Fits a set of zero-mean GARCH(p, q) models with Gaussian innovations to the (whitened and z-scored) time series (hctsa’s
MF_GARCHcompare) and returns statistics on the goodness of fit across a range of p (the number of lagged variances) and q (the number of lagged squared innovations): summaries across the grid of fitted models, and the orders that fit best. The models are fitted as ingarch_fit(), in order of increasing p and q, each started also from its smaller neighbors (so the log-likelihood never decreases with an order). If the GARCH(min p, min q) model does not beat constant variance in the structure test ofgarch_fit(), the constant term and the residual statistics are those of constant variance (the likelihood and information criteria are always those of the fitted models). A fit with the variance constant at its floor (within 1% of the bound 1e-6; seegarch_fit()) has no likelihood maximum: a summary that such a model determines is NaN (the minimum or maximum over the models if that model attains it, the mean if any model is at the floor, an order pick if the chosen model is), and the constant and residual statistics only if the variance model is reported.- Parameters:¶
- y : array-like¶
The input time series.
- pre_proc : {'none', 'ar'}, optional¶
A preprocessing to apply:
'none'(default; the series is not detrended), or'ar', which detrends the series and applies the preprocessing that maximizes AR(2) whiteness (seegarch_fit()).- pr : array-like of int, optional¶
The model orders p to compare. Default is
(1, 2, 3).- qr : array-like of int, optional¶
The model orders q to compare. Default is
(1, 2, 3).- random_seed : int, 'default', 'none' or None, optional¶
How to seed the random draws used by the whitening, as in
garch_fit().
- Returns:¶
Statistics across the (p, q) models (the log-likelihood, AIC and BIC are per observation):
hasStructure: 1 if the structure test ofgarch_fit()is passed, otherwise 0minLLF,maxLLF,meanLLF: the log-likelihoodminBIC,maxBIC,meanBIC: the Bayesian information criterionminAIC,maxAIC,meanAIC: Akaike’s information criterionminK,maxK,meanK: the constant term of the variance equationmin_meanarchps,max_meanarchps,mean_meanarchps: across models, the mean p-value (over lags 1 to 20) of Engle’s ARCH test on the standardized residualsmin_maxarchps,max_maxarchps,mean_maxarchps: the same for the maximum p-value over the 20 lagsmin_meanlbqps,max_meanlbqps,mean_meanlbqps: across models, the mean p-value of the Ljung-Box Q-test on the squared standardized residualsmin_maxlbqps,max_maxlbqps,mean_maxlbqps: the same for the maximumbestpAIC,bestqAIC,bestpBIC,bestqBIC: the orders of the models with the minimum AIC and BIC, among the grid and the constant-variance model (orders 0, 0)Ks_vary_p,Ks_vary_q: how much the constant term varies with p and with q: the standard deviation of the constant across one order, averaged over the other
- Return type:¶
dict