I looked in the examples on stats models but I don't see many examples of applying cross-validation to time series.
Let's say I have something like this
`In [1]: from __future__ import print_function
In [2]: import numpy as np
In [3]: import statsmodels.api as sm
import pandas as pd
from statsmodels.tsa.arima_process import arma_generate_sample
np.random.seed(12345)
In [4]: import pandas as pd
In [5]: from statsmodels.tsa.arima_process import arma_generate_sample
In [6]: np.random.seed(12345)
In [7]: arparams = np.array([.75, -.25])
In [8]: maparams = np.array([.65, .35])
In [9]:
In [9]: arparams = np.r_[1, -arparams]
In [10]: maparam = np.r_[1, maparams]
In [11]: nobs = 250
In [12]: y = arma_generate_sample(arparams, maparams, nobs)
In [13]: dates = sm.tsa.datetools.dates_from_range('1980m1', length=nobs)
In [14]: y = pd.TimeSeries(y, index=dates)
/Users/pcoyle/anaconda3/bin/ipython:1: FutureWarning: TimeSeries is deprecated. Please use Series
#!/bin/bash /Users/pcoyle/anaconda3/bin/python.app
In [15]: arma_mod = sm.tsa.ARMA(y, order=(2,2))
In [16]: arma_res = arma_mod.fit(trend='nc', disp=-1)
In [17]: print(arma_res.summary())
ARMA Model Results
==============================================================================
Dep. Variable: y No. Observations: 250
Model: ARMA(2, 2) Log Likelihood -245.887
Method: css-mle S.D. of innovations 0.645
Date: Mon, 01 Aug 2016 AIC 501.773
Time: 17:51:51 BIC 519.381
Sample: 01-31-1980 HQIC 508.860
- 10-31-2000
==============================================================================
coef std err z P>|z| [95.0% Conf. Int.]
------------------------------------------------------------------------------
ar.L1.y 0.8411 0.403 2.089 0.038 0.052 1.630
ar.L2.y -0.2693 0.247 -1.092 0.276 -0.753 0.214
ma.L1.y 0.5352 0.412 1.299 0.195 -0.273 1.343
ma.L2.y 0.0157 0.306 0.051 0.959 -0.585 0.616
Roots
=============================================================================
Real Imaginary Modulus Frequency
-----------------------------------------------------------------------------
AR.1 1.5618 -1.1289j 1.9271 -0.0996
AR.2 1.5618 +1.1289j 1.9271 0.0996
MA.1 -1.9835 +0.0000j 1.9835 0.5000
MA.2 -32.1794 +0.0000j 32.1794 0.5000
-----------------------------------------------------------------------------`
How do I move from that example to doing cross-validation. Ideally something like cross validation with time dependence. Any suggestions?