Guide to Time Series Evaluation with Python — 1: Evaluation Techniques and Baseline Model Time Series Components Naive Prediction Random Walk Understanding if the Data is Stationary Autocorrelation Function When Data Transformation is Applied: Dickey-Fuller Test Results and ACF Plot Baseline Model References

-

Time series evaluation is a technique utilized in various industries, equivalent to stock market prediction, product price forecasting, weather forecasting, cryptocurrency prediction, etc., to forecast future values based on historical data.

Time series will be recorded in minute, hourly, day by day, monthly, etc. intervals.

In this text, we are going to examine the characteristics of time series using the last 1-year Google stock closing data. Yow will discover the codes on the github repo.

The graph below represents the changes in stock prices over time. By examining the graph, we are able to observe that there was an upward trend in recent times.

Google closing prices change over time

All time series will be divided into three components:

  1. Slow-moving changes that occur in time series.
  2. Patterns of variation that repeat at specific time intervals. These will be weekly, monthly, yearly, etc. Seasonal changes indicate deviations from the trend in specific directions.
  3. Unusual events that occur in the information, equivalent to a sudden increase in heart rate for an individual during exercise. These cause random errors and are also known as “white noise.”

The visualization of the above components is known as “decomposition.”

Decompositon of information

When examining the graphs, an increasing trend will be observed in recent times. Moreover, there’s seasonality in the information. If there have been no seasonality in the information, the “Seasonal” graph would proceed as a straight line ranging from 0.

Before trying complex models with time series data, it’s important to ascertain a straightforward baseline model for comparison. This baseline model mustn’t involve complex calculations and mustn’t require much time. As a baseline model, we are able to consider:

  • For instance, if now we have day by day stock data and we would like to predict the following 7 days, we are able to use the arithmetic mean by taking the typical of the previous 7 days because the prediction for the following 7 days.
  • Again, considering stock data, if the date we would like to predict is 20.01.2023, we’d use the worth observed on 19.01.2023 because the prediction for 20.01.2023.

When creating these models (predictions), we also can note their scores equivalent to MSE (Mean Squared Error), MAPE (Mean Absolute Percentage Error), etc., with the intention to measure how a lot better our future complex models perform in comparison with these baseline models.

Random Walk represents a journey that happens randomly, because the name suggests. On this model, the worth of the following step is decided randomly based on the worth of the present step. The values obtained at each step are typically determined by random variables which are independent and have the identical distribution.

Using past data to predict future values on this process shouldn’t be meaningful because of the random nature of the method.

To find out whether the method is a random walk, specific analyses must be conducted. These analyses and their order are shown within the figure below. Let’s now examine the meaning of those steps.

Figure from Time series forecasting in python — Marco Peixerio

Models used for time series forecasting, equivalent to MA, AR, ARMA, are designed to work with stationary data.

A stationary process is a process whose statistical properties don’t change over time. If the mean, variance, and autocorrelation of a time series don’t change over time, then the information is taken into account to be stationary.

ASK DUKE

What are your thoughts on this topic?
Let us know in the comments below.

0 0 votes
Article Rating
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

0
Would love your thoughts, please comment.x
()
x