Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Seasonal ARIMA (SARIMA) | Advanced ARIMA Techniques and Model Selection
Time Series Forecasting with ARIMA

bookSeasonal ARIMA (SARIMA)

Seasonality is a common feature in many time series datasets, where patterns repeat at regular intervals such as months, quarters, or years. While ARIMA models are powerful for capturing trends and autocorrelation, they do not directly account for these repeating seasonal effects. To address this, you can use the Seasonal ARIMA, or SARIMA, model, which extends ARIMA by explicitly modeling seasonality.

SARIMA models introduce additional parameters to handle seasonal behaviors. The seasonal component is described using the notation (P, D, Q, s), where:

  • P is the seasonal autoregressive order;
  • D is the seasonal differencing order;
  • Q is the seasonal moving average order;
  • s is the length of the seasonal cycle (for example, 12 for monthly data with yearly seasonality).

The full SARIMA model is often written as ARIMA(p, d, q)(P, D, Q, s), where (p, d, q) are the non-seasonal ARIMA parameters. This allows you to capture both regular and seasonal patterns in your data, providing a more accurate and flexible forecasting framework for time series with pronounced seasonality.

Note
Definition

SARIMA, or Seasonal Autoregressive Integrated Moving Average, is a statistical model designed to forecast time series data that exhibits both non-seasonal and seasonal patterns. SARIMA is especially useful when your data shows repeating cycles, such as monthly sales or quarterly demand, making it a common choice in fields like retail, finance, and meteorology.

123456789101112131415161718192021222324252627282930313233
import pandas as pd import numpy as np from statsmodels.tsa.statespace.sarimax import SARIMAX import matplotlib.pyplot as plt # Generate synthetic seasonal data np.random.seed(42) periods = 100 seasonal_period = 12 time = np.arange(periods) seasonal = 10 * np.sin(2 * np.pi * time / seasonal_period) trend = 0.5 * time noise = np.random.normal(0, 2, periods) y = 50 + trend + seasonal + noise data = pd.Series(y, index=pd.date_range("2020-01-01", periods=periods, freq="ME")) # Specify and fit a SARIMA model: (1, 1, 1) non-seasonal, (1, 1, 1, 12) seasonal model = SARIMAX(data, order=(1, 1, 1), seasonal_order=(1, 1, 1, 12)) results = model.fit(disp=False) # Forecast the next 24 periods forecast = results.get_forecast(steps=24) forecast_index = pd.date_range(data.index[-1] + pd.offsets.MonthEnd(), periods=24, freq="ME") forecast_series = pd.Series(forecast.predicted_mean, index=forecast_index) # Plot original data and forecast plt.figure(figsize=(12, 6)) plt.plot(data, label="Observed") plt.plot(forecast_series, label="SARIMA Forecast", color="red") plt.legend() plt.title("SARIMA: Seasonal Time Series Forecast") plt.show()
copy
question mark

Which of the following best describes the structure of a SARIMA model's parameters?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 1

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Awesome!

Completion rate improved to 6.67

bookSeasonal ARIMA (SARIMA)

Свайпніть щоб показати меню

Seasonality is a common feature in many time series datasets, where patterns repeat at regular intervals such as months, quarters, or years. While ARIMA models are powerful for capturing trends and autocorrelation, they do not directly account for these repeating seasonal effects. To address this, you can use the Seasonal ARIMA, or SARIMA, model, which extends ARIMA by explicitly modeling seasonality.

SARIMA models introduce additional parameters to handle seasonal behaviors. The seasonal component is described using the notation (P, D, Q, s), where:

  • P is the seasonal autoregressive order;
  • D is the seasonal differencing order;
  • Q is the seasonal moving average order;
  • s is the length of the seasonal cycle (for example, 12 for monthly data with yearly seasonality).

The full SARIMA model is often written as ARIMA(p, d, q)(P, D, Q, s), where (p, d, q) are the non-seasonal ARIMA parameters. This allows you to capture both regular and seasonal patterns in your data, providing a more accurate and flexible forecasting framework for time series with pronounced seasonality.

Note
Definition

SARIMA, or Seasonal Autoregressive Integrated Moving Average, is a statistical model designed to forecast time series data that exhibits both non-seasonal and seasonal patterns. SARIMA is especially useful when your data shows repeating cycles, such as monthly sales or quarterly demand, making it a common choice in fields like retail, finance, and meteorology.

123456789101112131415161718192021222324252627282930313233
import pandas as pd import numpy as np from statsmodels.tsa.statespace.sarimax import SARIMAX import matplotlib.pyplot as plt # Generate synthetic seasonal data np.random.seed(42) periods = 100 seasonal_period = 12 time = np.arange(periods) seasonal = 10 * np.sin(2 * np.pi * time / seasonal_period) trend = 0.5 * time noise = np.random.normal(0, 2, periods) y = 50 + trend + seasonal + noise data = pd.Series(y, index=pd.date_range("2020-01-01", periods=periods, freq="ME")) # Specify and fit a SARIMA model: (1, 1, 1) non-seasonal, (1, 1, 1, 12) seasonal model = SARIMAX(data, order=(1, 1, 1), seasonal_order=(1, 1, 1, 12)) results = model.fit(disp=False) # Forecast the next 24 periods forecast = results.get_forecast(steps=24) forecast_index = pd.date_range(data.index[-1] + pd.offsets.MonthEnd(), periods=24, freq="ME") forecast_series = pd.Series(forecast.predicted_mean, index=forecast_index) # Plot original data and forecast plt.figure(figsize=(12, 6)) plt.plot(data, label="Observed") plt.plot(forecast_series, label="SARIMA Forecast", color="red") plt.legend() plt.title("SARIMA: Seasonal Time Series Forecast") plt.show()
copy
question mark

Which of the following best describes the structure of a SARIMA model's parameters?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 1
some-alt