ClassicalVolatilityModelBase<T>

Base Classes · AiDotNet.Finance.Volatility

Base for CLASSICAL (econometric) conditional-volatility models — GARCH and its variants — estimated by maximum likelihood, exactly as in their original papers, rather than by neural-network training. Mirrors how RegressionBase gives classical regressions the full model surface, but for the volatility interface: it implements all of IVolatilityModel generically (forecast, realized-vol, covariance/correlation, serialization, parameters) and delegates only the model-specific conditional-variance recurrence + parameter set to the concrete subclass.

Implements: IFeatureAware, IVolatilityModel<T>

Known derived types: EGarchModel<T>, Garch11Model<T>, GjrGarchModel<T>

How It Works

Estimation follows the arch package’s defaults: a constant mean (ConstantMean), so the parameter vector is [mu, volatility parameters...]; the variance recursion runs on the residuals r - mu and is seeded with arch’s backcast, an exponentially weighted average of the first min(75, n) squared residuals with weights 0.94^i; and the Gaussian quasi-log-likelihood is maximised with a derivative-free Nelder–Mead simplex over the (constrained, via transform) parameters.

All arithmetic is generic in T and runs as whole-tensor engine operations.

Properties

Property Summary
ILossFunction<T> DefaultLossFunction { get; }
bool SupportsParameterInitialization { get; }
bool SupportsTraining { get; }
bool UseNativeMode { get; }
int NumFeatures { get; }
int ParameterCount { get; } Number of free parameters, including the constant mean.
int PredictionHorizon { get; }
int SequenceLength { get; set; }
string ModelName { get; } Human-readable model name (e.g.

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
Dictionary<string, T> GetFinancialMetrics()
Dictionary<string, T> GetVolatilityMetrics()
IEnumerable<int> GetActiveFeatureIndices()
IFullModel<T, Tensor<T>, Tensor<T>> Clone()
IFullModel<T, Tensor<T>, Tensor<T>> DeepCopy()
IFullModel<T, Tensor<T>, Tensor<T>> WithParameters(Vector<T> parameters)
ModelMetadata<T> GetModelMetadata()
ModelOptions GetOptions()
T ForecastAnnualizedVol(Vector<T> returns, double periodsPerYear) One-step-ahead ANNUALIZED volatility forecast = √(variance × periodsPerYear).
T ForecastNextVariance(Vector<T> returns) One-step-ahead conditional VARIANCE forecast given the observed return history.
Tensor<T> CalculateRealizedVolatility(Tensor<T> highFrequencyReturns)
Tensor<T> ComputeCorrelationMatrix(Tensor<T> returns)
Tensor<T> ComputeCovarianceMatrix(Tensor<T> returns)
Tensor<T> EstimateCurrentVolatility(Tensor<T> recentReturns)
Tensor<T> Forecast(Tensor<T> input, double[] quantiles)
Tensor<T> ForecastVolatility(Tensor<T> historicalReturns, int horizon)
Tensor<T> Predict(Tensor<T> input)
Vector<T> GetParameters()
Vector<T> SanitizeParameters(Vector<T> parameters)
bool IsFeatureUsed(int featureIndex)
byte[] Serialize()
void Deserialize(byte[] data)
void Dispose()
void FitReturns(Vector<T> returns) Fits the model to a return series by maximum likelihood (Nelder–Mead on the Gaussian QMLE).
void LoadModel(string filePath)
void LoadState(Stream stream)
void SaveModel(string filePath)
void SaveState(Stream stream)
void SetActiveFeatureIndices(IEnumerable<int> featureIndices)
void SetParameters(Vector<T> parameters)
void Train(Tensor<T> input, Tensor<T> expectedOutput)