
This example shows how the empirical distribution of the GMAIC as defined in [1] can be computed by means of the library.
References:
- NbbTs.dll
- NbbEco.dll
- NbbGeneralizedAirline.dll
Code:
using Nbb.TimeSeries.SimpleTS;
using Nbb.GeneralAirline;
using Nbb.SArima;// Number of simulations
int nruns = 10000;// Length of the series
int n = 150;// MA polynomial:(1+q*B)(1+bq*B^12). Building of the Airline model.
double q = -0.5, bq = -.5;
SArimaModel arima = new SArimaModelBuilder().CreateAirlineModel(12, q, bq);
double[] gmaic = new double[nruns];GeneralizedAirlineMonitor monitor = new GeneralizedAirlineMonitor();
for (int i = 0; i < nruns; ++i)
{
double[] d = new ArimaModelBuilder().Generate(arima, n);
TS ts = new TS(TSFrequency.Monthly, 1980, 0, d);
monitor.Process(ts);Nbb.GeneralAirline.LLGeneralizedAirline[] ll = monitor.Results;
// AIC for the airline model
double aic0 = ll[0].Likelihood.AIC(2);// max AIC of the 5-1(3) models
double aic1 = Double.MaxValue;
int jmax = 1;
for (int j = 1; j < ll.Length; ++j)
if (ll[j].Model != null)
{
double curaic = ll[j].Likelihood.AIC(3);
if (curaic < aic1)
{
aic1 = curaic;
jmax = j;
}
}gmaic[i] = aic0 - aic1;
}The code yields the following empirical distribution:
Distribution
PValue
Bibliography
[1] John A. D. Aston, David F. Findley,
Kellie C. Wills, and Donald E. K. Martin (2004), "Generalizations
of the Box-Jenkins Airline Model with Frequency-Specific Seasonal
Coefficients and a Generalizaton of Akaike’s MAIC", presented at 2004 NBER/NSF
Time Series Conference.