Time Series Analysis and Forecasting

Sunspot Observations and Time Series Evaluation

Sunspot observations, dating back to 1900, are analyzed to understand time series forecasting.

  • Data Splitting: The dataset is divided into training (70%) and testing (30%) sets. For 2800 observations, training uses 1973 observations, and testing uses 874 observations.

  • Evaluation Methods: Mentioned techniques are multiple train-test splits and walk-forward validation.

Persistant Model

Persistont Model (Naive / Zero Rule)

The persistent model uses the current value at time tt to predict the value at time t+1t+1. If the price of BRI stock is 10,00010,000 today, the prediction for tomorrow is also 10,00010,000. This serves as a baseline for evaluating other time series algorithms.

Evaluation Metrics

Metrics used for evaluation include Mean Squared Error (MSE), Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE).

Data Conversion

Data is transformed into TT and T+1T+1 pairs for prediction.

Example

  • On a sample of 100, the actual data (orange) is compared to predictions (shifted green). The RMSE is 133133, indicating a relatively large error.

  • Testing comprises 34% of the data, while training is 66%.

Auto Regression

Using daily minimum temperature data, auto-regression is employed to predict seven days ahead. A lag of 29 is used based on auto-correlation plot analysis.

The model uses past values with coefficients to predict future values (like a linear model).

  • The red line represents predictions, and the blue line represents actual values. The RMSE is 1.2251.225.

Arima Model

The ARIMA model consists of three components: Auto Regression (AR), Integration (I), and Moving Average (MA).

  • Parameters: The key hyperparameters are P, D, and Q.

    • P: Auto-regression order (lag).

    • D: Number of time differences required to make the time series stationary.

    • Q: Moving average order (residual error).

  • Stationarity: Integration involves differencing the time series data (subtracting the current observation from the previous one) to achieve stationarity.

  • Moving Average: Refers to the error of residual from the moving average.

Forecasting with ARIMA

The start_model is used with a training size of 0.66.

  • The order (PDQ) is pre-defined (though normally determined by PACF and ACF plots).

  • Red line represents predictions, and blue line represents actual values.

  • Grid search can be employed to find the best parameter configuration for ARIMA.

  • With a combination of testing, the best ARIMA configuration for the shampoo dataset is (1, 2, 2) with an RMSE of 65.

Light Transformation

Converting Time Series to Supervised Learning

Time series data can be converted into a tabular format for supervised learning.

  • For example, values at t5t-5, t4t-4, t3t-3 can be used to predict the value at t2t-2. This transforms the time series into features (X) and a label (y).

Algorithm Application

  • Once in tabular format, algorithms like linear regression, gradient boosting, or random forests can be applied.

  • Recurrent Neural Networks (RNN) and Long Short-Term Memory (LSTM) networks can directly use time series data without this conversion.

Additional Considerations

Areas for further exploration in time series analysis include:

  • Light Transformation.

  • Linear Regression.

  • Recurrent Neural Networks (RNN).

Data normalization techniques can significantly impact model performance. Linear and Non Linear Transformations can be a useful pre-processing step before comparing the algorithm performances.