Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Trend and Seasonality in Time Series | Foundations of Time Series Analysis
Time Series Forecasting with ARIMA

bookTrend and Seasonality in Time Series

Understanding the underlying components of a time series is crucial for effective forecasting. Two of the most important components are trend and seasonality. The trend represents the long-term progression of the series, showing whether the data is generally increasing, decreasing, or remaining stable over time. Seasonality refers to repeating patterns or cycles in the data that occur at regular intervals, such as daily, monthly, or yearly. Recognizing and modeling these patterns help you build more accurate forecasting models, as they allow you to account for systematic changes in the data that are not due to random noise.

Note
Definitions

Trend is the long-term movement in a time series. For example, the average global temperature has shown an upward trend over the past century.

Note
Definition

Seasonality refers to periodic fluctuations that repeat over a specific period, such as increased retail sales every December due to the holiday season.

The following plots illustrate these concepts:

  • Original Series: shows the overall data, including both trend and seasonality;
  • Decomposed Trend and Seasonality: separates the long-term movement (trend) and the repeating fluctuations (seasonality) for clearer analysis.

By identifying and understanding these components, you can improve your forecasts and avoid mistaking consistent patterns for random fluctuations.

12345678910111213141516171819202122232425262728293031
import pandas as pd import numpy as np import matplotlib.pyplot as plt # Create a synthetic time series with trend and seasonality np.random.seed(0) periods = 120 time = np.arange(periods) trend = time * 0.2 seasonality = 10 * np.sin(2 * np.pi * time / 12) noise = np.random.normal(0, 2, periods) series = trend + seasonality + noise # Plot the original series plt.figure(figsize=(12, 6)) plt.plot(time, series, label="Original Series") plt.title("Synthetic Time Series with Trend and Seasonality") plt.xlabel("Time") plt.ylabel("Value") plt.legend() plt.show() # Decompose manually into trend and seasonal components plt.figure(figsize=(12, 6)) plt.plot(time, trend, label="Trend", color="red") plt.plot(time, seasonality, label="Seasonality", color="green") plt.title("Decomposed Trend and Seasonality Components") plt.xlabel("Time") plt.ylabel("Value") plt.legend() plt.show()
copy

When you examine a time series plot, a clear upward or downward movement over time suggests the presence of a trend. Repeating patterns at fixed intervals indicate seasonality. These components are significant because failing to account for them can lead to poor forecasts, as the model might misinterpret systematic patterns as random variation.

1. Which of the following best describes a time series with a strong upward slope and repeating peaks every 12 months?

2. Fill in the blanks to plot the trend and seasonality components of the time series below.

question mark

Which of the following best describes a time series with a strong upward slope and repeating peaks every 12 months?

Select the correct answer

question-icon

Fill in the blanks to plot the trend and seasonality components of the time series below.

# Plot the trend component
plt.plot(time,
, label="Trend", color="red")

# Plot the seasonality component
plt.plot(time,
, label="Seasonality", color="green")

Click or drag`n`drop items and fill in the blanks

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 2

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Awesome!

Completion rate improved to 6.67

bookTrend and Seasonality in Time Series

Sveip for å vise menyen

Understanding the underlying components of a time series is crucial for effective forecasting. Two of the most important components are trend and seasonality. The trend represents the long-term progression of the series, showing whether the data is generally increasing, decreasing, or remaining stable over time. Seasonality refers to repeating patterns or cycles in the data that occur at regular intervals, such as daily, monthly, or yearly. Recognizing and modeling these patterns help you build more accurate forecasting models, as they allow you to account for systematic changes in the data that are not due to random noise.

Note
Definitions

Trend is the long-term movement in a time series. For example, the average global temperature has shown an upward trend over the past century.

Note
Definition

Seasonality refers to periodic fluctuations that repeat over a specific period, such as increased retail sales every December due to the holiday season.

The following plots illustrate these concepts:

  • Original Series: shows the overall data, including both trend and seasonality;
  • Decomposed Trend and Seasonality: separates the long-term movement (trend) and the repeating fluctuations (seasonality) for clearer analysis.

By identifying and understanding these components, you can improve your forecasts and avoid mistaking consistent patterns for random fluctuations.

12345678910111213141516171819202122232425262728293031
import pandas as pd import numpy as np import matplotlib.pyplot as plt # Create a synthetic time series with trend and seasonality np.random.seed(0) periods = 120 time = np.arange(periods) trend = time * 0.2 seasonality = 10 * np.sin(2 * np.pi * time / 12) noise = np.random.normal(0, 2, periods) series = trend + seasonality + noise # Plot the original series plt.figure(figsize=(12, 6)) plt.plot(time, series, label="Original Series") plt.title("Synthetic Time Series with Trend and Seasonality") plt.xlabel("Time") plt.ylabel("Value") plt.legend() plt.show() # Decompose manually into trend and seasonal components plt.figure(figsize=(12, 6)) plt.plot(time, trend, label="Trend", color="red") plt.plot(time, seasonality, label="Seasonality", color="green") plt.title("Decomposed Trend and Seasonality Components") plt.xlabel("Time") plt.ylabel("Value") plt.legend() plt.show()
copy

When you examine a time series plot, a clear upward or downward movement over time suggests the presence of a trend. Repeating patterns at fixed intervals indicate seasonality. These components are significant because failing to account for them can lead to poor forecasts, as the model might misinterpret systematic patterns as random variation.

1. Which of the following best describes a time series with a strong upward slope and repeating peaks every 12 months?

2. Fill in the blanks to plot the trend and seasonality components of the time series below.

question mark

Which of the following best describes a time series with a strong upward slope and repeating peaks every 12 months?

Select the correct answer

question-icon

Fill in the blanks to plot the trend and seasonality components of the time series below.

# Plot the trend component
plt.plot(time,
, label="Trend", color="red")

# Plot the seasonality component
plt.plot(time,
, label="Seasonality", color="green")

Click or drag`n`drop items and fill in the blanks

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 2
some-alt