TimeSeriesSRC.pmodaic

TimeSeriesSRC.pmodaic(pmod, y, u=[])

Compute the Akaike Information Criterion (AIC) for a fitted model.

\[\text{AIC} = \ln(\text{MSE}) + \frac{2 k}{N}\]

where \(k\) is the number of free parameters and \(N\) is the number of data points. Lower AIC indicates a better trade-off between fit and model complexity.

Parameters:
  • pmod (pmodel) – Fitted prediction model.

  • y (array-like) – Desired output sequence.

  • u (array-like, optional) – Input sequence. Default [].

Returns:

aic – Akaike Information Criterion.

Return type:

float

Examples

>>> import pathlib, pandas as pd
>>> import TimeSeriesSRC as ts
>>> data_dir = pathlib.Path(ts.__file__).parent / 'TestData'
>>> y = pd.read_csv(data_dir / 'Series_A_Chemical_Concentration.csv').values.flatten()
>>> pm = ts.pmodel('arma', nc=[2], nd=[1], diff=[0], per=[])
>>> pm_est, trec, stat = ts.estimate(pm, y, show_plot=False, show_output=False)
>>> aic = ts.pmodaic(pm_est, y)

See also

pmodbic

Bayesian Information Criterion (penalises complexity more strongly).

selpmod

Automatic model selection using AIC/BIC grid search.