Time-series index | AR | MA | ARIMA
For transformed and differenced response ARIMAX constructs the deterministic mean
and residual dynamics
TrendType; TimeInterval; IncludeSeasonality supplies one sine/cosine harmonic; XOrderB=b includes current through
where bracketed blocks appear only when configured. Coefficients inherit the units of
Let
The implemented log likelihood is
This is a conditional Gaussian likelihood, not an exact state-space likelihood. Marginal parameter priors are bounded uniforms by default and UseJeffreysRuleForScale adds JeffreysScalePrior in pointwise metadata and consistently reject nonfinite or nonpositive innovation scales with negative infinity.
Box–Cox/Yeo–Johnson parameters are plug-in values fitted on the raw training prefix and frozen before transformation of the complete response; they are not jointly estimated and their uncertainty is not propagated. Manual transform assignment rebuilds transformed/differenced state and preserves fitted/manual provenance through persistence.
For a raw training prefix of ARIMAX forms exactly
Missing or duplicate covariate timestamps required by the training window invalidate the model; numerical evaluation returns negative infinity rather than falling back to positional matching. Extra dates outside the required window are harmless. The conditional transform Jacobian is
with the conditioning order
The conditioning rule
Trend and Fourier seasonality are not rejected when DiffOrderD>0: Validate adds a warning for each combination, because differencing already removes a trend and alters seasonal amplitude and phase, so the deterministic terms are typically redundant or weakly identified, but it leaves the model valid. The terms are then fitted on the differenced model scale as functions of the model step. With
Predict accepts optional future covariate series. Without them:
-
Nonerequires observed covariates long enough for the complete horizon and otherwise throws; -
BlockBootstrapappends blocks of length$\min(10,\lfloor N/4\rfloor)$ , bounded below by one; -
KNNappends values using$k=\max(3,\lfloor N/10\rfloor)$ ; - deterministic prediction (
seed=-1) appends the empirical covariate mean, independent of the configured stochastic extension method.
These mechanisms represent empirical continuation scenarios, not a probabilistic model fitted jointly with the response. They do not propagate parameter uncertainty in a covariate forecast model, preserve cross-covariate dependence by construction, or condition on climate/operations scenarios. For defensible engineering forecasts, provide explicit aligned future covariates or model their joint uncertainty outside BestFit and pass scenario paths realization by realization.
Predict calculates exactly ARIMAXAnalysis
combines posterior parameter and innovation draws, and its bands include whichever covariate
extension is invoked, so clearly state that scenario.
GenerateRandomValues applies the same model-step/raw-index map. Intercept, trend, Fourier
seasonality, exact-date level-covariate, AR, MA, and Gaussian innovation terms are combined on the
transformed/highest-difference scale. The completed difference path is integrated from the first
None, block-bootstrap, and KNN retain the policies above. Missing or
duplicate required generation timestamps throw instead of using position. Analysis AIC/BIC use the data log likelihood at the stored
MAP and exclude prior-density terms; they are comparable with MLE criteria only when every active
prior is constant.
AR stationarity and MA invertibility are warned using sums of absolute coefficients, not enforced by roots or reparameterization. Polynomial trends extrapolate without bound, empirical covariate extension can leave the historical support, and collinear lag blocks can make
This None prevents silent empirical extension.
private static ARIMAXAnalysis ConfigureArimaxAnalysis()
{
double[] monthlyFlow =
{
92, 105, 121, 138, 151, 144, 132, 119, 108, 101, 96, 90,
95, 109, 125, 141, 155, 148, 136, 122, 111, 103, 98, 93
};
double[] monthlyPrecipitation =
{
28, 35, 48, 61, 72, 65, 54, 43, 36, 31, 29, 26,
30, 38, 51, 64, 75, 68, 57, 46, 39, 34, 31, 28
};
var start = new DateTime(2022, 1, 1);
var response = new NumericsTimeSeries(
TimeInterval.OneMonth,
start,
monthlyFlow);
var precipitation = new NumericsTimeSeries(
TimeInterval.OneMonth,
start,
monthlyPrecipitation);
var model = new ARIMAX(response)
{
AROrderP = 1,
DiffOrderD = 0,
MAOrderQ = 1,
XOrderB = 1,
IncludeIntercept = true,
IncludeSeasonality = true,
TrendType = ARIMAX.Trend.None,
CovariateExtension =
ARIMAX.CovariateExtensionMethod.None,
UseDefaultTrainingSteps = false
};
model.TrainingTimeSteps = 20;
model.SetCovariates(
new List<NumericsTimeSeries> { precipitation });
model.SetDefaultParameters();
return new ARIMAXAnalysis(model)
{
ForecastingTimeSteps = 4
};
}The last four response/covariate observations are holdout values, not future extensions. After fitting, report predictor units, lag rationale, coefficient correlations, characteristic roots, residual ACF/variance diagnostics, holdout scores, and sensitivity to trend/seasonality/covariate choices.
Implementation: Models/TimeSeries/ARIMAX.cs; orchestration:
Analyses/TimeSeries/ARIMAXAnalysis.cs. Fast tests cover configuration, serialization, prediction
shapes, covariate extension, transformations, exact-date alignment, holdout isolation, and
likelihood decomposition. The independent R alignment oracle verifies d=0,1,2 at 1E-10.
Fast irregular conditional, logarithmic, and fixed-seed tests plus the focused analytical and
exactly 1,000-realization variance oracles verify the prediction boundary and generation-scale
identities.
The time-series verification report records independent conditional likelihood and optimum comparisons, transformed forecast/generation identities, and retained 1,000-observation recovery designs. Acceptance is tied to the exact recurrence, conditioning window, identified parameters, and forecast quantities; it is not a claim for every order, transformation, or covariate design.
[1] G. E. P. Box, G. M. Jenkins, G. C. Reinsel, and G. M. Ljung, Time Series Analysis: Forecasting and Control, 5th ed., Wiley, 2015.
[2] R. H. Shumway and D. S. Stoffer, Time Series Analysis and Its Applications, 4th ed., Springer, 2017.
[3] R. J. Hyndman and G. Athanasopoulos, Forecasting: Principles and Practice, 3rd ed., OTexts, 2021.