Time-series index | MA | ARIMA | ARIMAX
AutoRegressive represents a regularly spaced Gaussian AR(
When IncludeIntercept=false, the implementation sets
Order is restricted to 1–10, the input interval must be regular, and at least ten response values are required.
The first
DataLogLikelihood implements (AR.4), rejects nonpositive or nonfinite PointwiseDataLogLikelihood applies the same scale guard, returns
The available transforms are none, Box-Cox logarithmic (SetTransformParameters atomically rebuilds transformed state, residuals, and dependent likelihood quantities. Holdout scoring therefore uses a transform estimated without the holdout values.
Each ModelParameter contributes its configured marginal prior. Defaults are bounded uniforms: data-scaled bounds for UseJeffreysRuleForScale=true, the implementation adds
Thus LogLikelihood is JeffreysScalePrior. Bayesian estimation uses the bounded natural coordinates and sampler configuration described in Bayesian MCMC.
Weak stationarity requires every zero of
to lie outside the unit circle. The implementation checks the exact AR(1) and AR(2) inequalities; for
Predict(parameters, forecastSteps, seed) uses observed transformed lags inside the training window and recursively predicted lags afterward. With seed=-1, it returns the conditional-median path on the original scale after inverse transformation. A nonnegative seed adds independent Gaussian innovations after the ARAnalysis.CreateUncertaintyAnalysisResultsAsync() combines posterior parameter draws with seeded innovation draws, so its bands are posterior-predictive bands, not parameter-only credible bands.
GenerateRandomValues(sampleSize, seed) likewise completes the full AR recursion on transformed
model scale and inverse-transforms the completed vector exactly once. The returned length is
sampleSize; Transform.None retains the established seeded sequence bit for bit.
For nonlinear inverse transforms,
The 16-point training prefix leaves four annual observations for honest validation when no fitted transform is used.
private static ARAnalysis ConfigureAutoregressiveAnalysis()
{
double[] annualFlow =
{
112, 128, 121, 139, 151, 147, 160, 158, 171, 166,
179, 185, 181, 194, 202, 198, 211, 219, 214, 228
};
var series = new NumericsTimeSeries(
TimeInterval.OneYear,
new DateTime(2000, 1, 1),
annualFlow);
var model = new AutoRegressive(
series,
order: 1,
includeIntercept: true)
{
UseDefaultTrainingSteps = false,
UseJeffreysRuleForScale = true,
TransformType = RMC.BestFit.Models.Transform.None
};
model.TrainingTimeSteps = 16;
model.SetDefaultParameters();
return new ARAnalysis(model)
{
ForecastingTimeSteps = 4
};
}Run the analysis asynchronously, require satisfactory chain diagnostics, inspect residual ACF/PACF and time plots, and score the four untouched observations. Do not call the result evidence of hydrologic causality: AR coefficients describe serial prediction, not physical storage mechanisms.
Implementation: Models/TimeSeries/AutoRegressive.cs and Analyses/TimeSeries/ARAnalysis.cs.
Fast tests cover construction, likelihood decomposition, transforms, prediction state, generation
algebra, and analysis lifecycle. The focused generator oracle verifies inverse-transform algebra
and 1,000 model-scale moment values; the verification report records parameter-recovery results.
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] P. J. Brockwell and R. A. Davis, Introduction to Time Series and Forecasting, 3rd ed., Springer, 2016.
[2] G. E. P. Box, G. M. Jenkins, G. C. Reinsel, and G. M. Ljung, Time Series Analysis: Forecasting and Control, 5th ed., Wiley, 2015.
[3] G. E. P. Box and D. R. Cox, “An analysis of transformations,” J. R. Stat. Soc. B, vol. 26, no. 2, pp. 211–252, 1964.