TimeSeriesSRC.pmodmse

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

Compute the mean squared prediction error (MSE) for a fitted model.

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

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

  • u (array-like, optional) – Input sequence (required for ARX, ARMAX, BJTF models). Default [] (univariate models).

Returns:

  • mse (float) – Mean squared one-step-ahead prediction error.

  • e (ndarray) – Prediction error sequence y - yhat.

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)
>>> mse, e = ts.pmodmse(pm_est, y)

See also

pmodaic

Akaike Information Criterion.

pmodbic

Bayesian Information Criterion.