Can we use bootstrap in time series case?

I use random forest for time series forecasting.I have some features:

1. lags.
2. day of year,day of week,hours,minutes.

rf = RandomForestRegressor(n_estimators=1000,n_jobs=-1,bootstrap=False).fit(X_train, y_train)

rf-function use for learning random forest.X_train-features,y_train-values of time series,n_estimators-number of trees,(bootstrap=True)=use bootstrap,(bootstrap=False)=not use bootstrap

example of X_train: Should i write bootstrap=False in this case? If not, why?

• For those of us who do not use Python, could you explain in words what the function is doing? Dec 14 '18 at 13:55
• rf-function for learning random forest.X_train-features,y_train-values of time series,n_estimators-number of trees,(bootstrap=True)=use bootstrap,(bootstrap=False)=not use bootstrap Dec 14 '18 at 14:01
• Thank you. What for and how is this bootstrap used, if specified to TRUE? You may edit the post to include new information; this way new readers will not have to dig through comments. Dec 14 '18 at 14:09
• I have a poor knowledge of the theory since I am a new to this topic.as i understand it, bootstrap is used to normalize the distribution.In a random way,n samples are formed,in which the number of objects=the number of objects in the original sample.After that, trees are built on these samples,and final forecast is the average for trees. Dec 14 '18 at 14:21
• I dont what happens inside the function when bootstrap = True. Dec 14 '18 at 14:27

Now back to your original question. I would not use bootstrapping to model a time-series. Use a cross validate sampling scheme. As Richard Hardy mentions, using a random sampling technique distorts the structure of a time series. In addition, bootstrapping can cause too many duplicated values. Poor data representation is also an issue because due to the random nature you could end up over-sampling and under-sampling certain periods in the time series. Using a cross validated approach you get a more realistic result because you are simulating producing forecasts. Simply, you split the data into training and testing $$k$$ times, with each $$k_i$$ adding the first observation in the test set to the training set. Train and test the model $$k$$ times. To get model performance, you average the testing error across the $$k$$ iterations. This simulates walking forward a forecast; this is the way forecast models are implemented out of development.