Predicting future values of time series
You have seen how smoothing can be used to uncover important information in a series that might be hidden by noise. It might be tempting to think that smoothing is a very easy data modeling method, so why not use it to make predictions? The issue that arises is, in many cases, the process of smoothing data and aligning it to the original series means you are using information for any given point in the smoothed series that includes future values. Therefore, using such values as predictions is an example of data leakage, discussed in Chapter 9, Data Modeling – Preprocessing in the Avoiding information leakage section.
Suppose you are again analyzing the SPX index data you saw in Chapter 9, Data Modeling – Preprocessing:
- Here, you read the data, convert the dates to datetimes, and make a simple plot over a limited time range:
SPX = pd.read_csv('Datasets/spx.csv') SPX['date'] = pd.to_datetime(SPX[&apos...