I'm currently working with cv.glmnet and it is my understanding that you should not use normal cross validation for time series data. Is it possible to use the foldid argument with cv.glmnet in order to accomplish cross validation with time series data?
No, it won't be reasonable to use
cv.glmnet for cross validation on time series data. A good explanation how CV should look like on time series data can be found here:
In short, a standard CV would skip time points randomly and thus destroy the temporal relationships you want to identify. (I assume that your samples are your time points, since you didn't give details on your data.)
They recommend to use the
forecast package in R. Unfortunately, I don't know of a LASSO implementation of cross validation for time series data.
For time series cross validation, you can use caret library in R.
See the following for further reference.