# k-fold cross validation and time series

Most of the prior posts and papers I've read on this subject deal with autoregressive models but mine is currently of the form:

$$y(t+h) = X(t) + e$$

where $X$ represents the set of predictor variables that does not include $y(t)$.

I've also tried machine learning techniques with the same outcome and predictor variables.

I'd like to use k-fold cross-validation or something similar rather than just having a single training sample and holdout test sample; however, both $y$ and $X$ exhibit some degree of autocorrelation (for instance, for both variables $t$ and $t+1$ have a significant correlation). Thus, I'm wondering if it's problematic to have months randomly assigned to the folds, and if so, what the possible remedies are?

So long as the errors are uncorrelated, this is fine. See https://robjhyndman.com/publications/cv-time-series/. Although that article is specifically about autoregression, the same argument works if you can set up your model as a regression $y \sim X\beta + e$.

• Thanks for the feedback. To clarify, what if there is correlation between the errors at t and t+1, but the residual autocorrelation dies off before lag h. In this instance, I can't incorporate any of the residual information from time t into my model to improve the forecast/prediction of y(t+h); however, the observation at t used to forecast t+h and observation at t+1 used to forecast t+h+1 will not be independent. – Kman Jun 4 '18 at 19:02