# 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$.