VolatilityResult¶
Defined in fynance.estimator
- class VolatilityResult(params, std_errors, loglik, aic, bic, conditional_vol, std_residuals, model, dist, n_obs)[source]
Bases:
objectFitted GARCH-family volatility model (see
fit_volatility).- Attributes:
- paramsdict of str to float
Fitted parameters, keyed by name (
omega, alpha, [gamma,] beta, [nu]).- std_errorsdict of str to float
Standard error of each parameter (
NaNwhen the observed-information Hessian is not positive definite).- loglikfloat
Maximised log-likelihood.
- aic, bicfloat
Akaike / Bayesian information criteria,
2k - 2llandk ln(n) - 2llwithkparameters andnobservations.- conditional_volnumpy.ndarray
In-sample conditional standard deviation \(\sigma_t\), shape
(n_obs,).- std_residualsnumpy.ndarray
Standardized residuals \(y_t / \sigma_t\), shape
(n_obs,).- model{‘garch’, ‘gjr’, ‘egarch’}
Conditional-variance specification.
- dist{‘normal’, ‘t’}
Innovation density.
- n_obsint
Number of observations the model was fit on.
- forecast(h=1, n_sims=10_000, seed=0)[source]
Multi-step conditional-variance forecast.
Returns \(\mathbb E[\sigma_{T+k}^2 \mid \mathcal F_{T-1}]\) for
k = 1, \dots, h(T = n_obs). The one-step value is exactly the filter’s next-step variance.For garch / gjr the forecast is the closed-form recursion toward the unconditional variance: after the exact one-step step, the leverage indicator is replaced by its expectation \(\mathbb E[\mathbf 1[\varepsilon < 0]] = 1/2\) (symmetric innovations), giving persistence \(\alpha + \beta + \gamma / 2\). For egarch (log-variance form) no closed form exists, so the forecast is a seeded Monte-Carlo average over
n_simssimulated innovation paths.- Parameters:
- hint, optional
Forecast horizon (number of steps). Default 1.
- n_simsint, optional
Number of Monte-Carlo paths (egarch only). Default 10000.
- seedint, optional
Seed for the Monte-Carlo draws (egarch only). Default 0.
- Returns:
- numpy.ndarray
Variance forecasts, shape
(h,).
- simulate(T, seed=0)[source]
Simulate a return path from the fitted parameters and innovation.
Runs the fitted model’s conditional-variance recursion forward, drawing unit-variance innovations from the fitted
dist(Gaussian, or standardized Student-t withnudegrees of freedom), and returns the mean-zero simulated returns \(y_t = \sigma_t z_t\).- Parameters:
- Tint
Length of the simulated path.
- seedint, optional
Seed for the innovation draws. Default 0.
- Returns:
- numpy.ndarray
Simulated returns, shape
(T,).