ARIMA
ARIMAX
SARIMA
SARIMAX
Four names. One family of ideas. Learn exactly what they are, why they exist, and when the extra complexity is actually useful.
PAST → PATTERNS → FUTURE
↓ Start with the problem
First: what problem are we solving?
Suppose you have a value changing over time: sales, temperature, demand, electricity usage, website traffic, stock inventory, etc.
TIME → → → → → → → → → → → → →
The key question is not merely: "What is the average?"
The forecasting question is:
AR — AutoRegressive
Before ARIMA, understand the simplest idea: the past value can help predict the future value.
What does AR mean?
"Auto" = itself.
"Regressive" = use previous values to explain the current value.
So AR asks:
"Does my own past help predict my future?"
Temperature
Yesterday: 30°C
Today is probably not randomly 10°C.
The recent temperature contains useful information.
That is temporal memory.
MA — Moving Average
MA does something different. Instead of directly remembering past observations, it remembers past prediction errors.
Imagine this
Your model predicted:
100
Actual value:
120
Error:
+20
The model remembers that shock when making the next prediction.
Not the normal moving average
This is where beginners get ambushed. 😄
ARIMA's MA does NOT simply mean:
"average the last 7 values."
It models past forecast errors.
ARIMA = AR + I + MA
Now the pieces finally meet.
p = AR order
d = differencing order
q = MA order
AR
How much should we look at previous observations?
I
How many times should we difference the series to remove trend / achieve stationarity?
MA
How much should we use previous forecast errors?
The "I" is the important twist
Suppose:
The level keeps increasing. Instead of modelling the raw values, we can model the changes:
That is differencing.
Example
Suppose after experimentation you determine:
p = 2
d = 1
q = 1
Your model becomes:
Meaning:
- use 2 AR lags
- difference once
- use 1 past error term
ARIMAX — ARIMA + External Information
What if the past of Y is not enough? What if another variable helps explain Y?
What are we forecasting?
Example:
Ice-cream sales
What external variable helps?
Example:
Temperature
Why would temperature matter?
Because ice-cream demand is not caused only by yesterday's ice-cream demand.
A very hot day can cause demand to jump even if yesterday's sales were ordinary.
ARIMA: "What did Y do before?"
ARIMAX: "What did Y do before + what else is happening?"
Think like this
ARIMAX = internal memory + outside information
Then comes the seasonal problem.
Some time series have a repeating pattern. Every day. Every week. Every month. Every year.
PEAK → FALL → LOW → RISE → PEAK → ...
For example:
- Retail sales spike every December.
- Electricity demand repeats every day.
- Website traffic behaves differently on weekdays and weekends.
- Tourism demand repeats every summer.
Daily data with weekly seasonality → m = 7
Monthly data with yearly seasonality → m = 12
Hourly data with daily seasonality → m = 24
SARIMA — ARIMA with seasonal memory
p, d, q
Normal ARIMA behaviour.
- p → AR
- d → differencing
- q → MA
P, D, Q, m
Seasonal version of the same ideas.
- P → seasonal AR
- D → seasonal differencing
- Q → seasonal MA
- m → seasonal period
Seasonal differencing
Suppose monthly sales have a yearly pattern. Compare this January with last January:
Instead of comparing:
we compare:
That isolates the seasonal movement.
Interpretation:
- ordinary AR order = 1
- ordinary differencing = 1
- ordinary MA order = 1
- seasonal AR order = 1
- seasonal differencing = 1
- seasonal MA order = 1
- season length = 12
SARIMAX — The full family
Now combine the two extensions:
Example: Electricity Demand
You want to forecast electricity demand.
There may be:
- short-term dependence
- weekly seasonality
- temperature effects
- holidays
- working-day effects
So a SARIMAX model can use:
Interactive model selector
Answer three questions. The page will tell you which family matches the structure of your forecasting problem.
Build the model name
Pick what your data needs.
MODEL CONSTRUCTOR
Internal temporal behaviour without seasonality or external predictors.
The whole evolution in one picture
1. AR
"Past values of Y might predict future Y."
2. MA
"Past prediction errors might contain information."
3. ARIMA
"Combine AR + differencing + MA."
4. ARIMAX
"Also give me useful external variables."
5. SARIMA
"Also model repeating seasonal behaviour."
6. SARIMAX
"Give me seasonality AND external variables."
One-table cheat sheet
| Model | Core idea | Seasonality? | External X? | Use when... |
|---|---|---|---|---|
| AR | Past Y predicts future Y | No | No | Simple temporal dependence |
| MA | Past errors influence future | No | No | Short-lived shocks/errors matter |
| ARIMA | AR + differencing + MA | No | No | Trend/non-stationary series without strong seasonality |
| ARIMAX | ARIMA + external predictors | No | YES | Weather, price, promotions, etc. explain Y |
| SARIMA | ARIMA + seasonal structure | YES | No | Weekly/monthly/yearly repeating patterns |
| SARIMAX | SARIMA + external predictors | YES | YES | Seasonality + useful outside variables |
Interview flash cards
Click the card. Don't peek. 😄
What does ARIMA stand for?
CLICK TO REVEAL
Answer
AutoRegressive Integrated Moving Average.
AR + Differencing + MA
What is the X in ARIMAX?
CLICK TO REVEAL
Answer
Exogenous / external variables.
Variables outside the target series that may help forecast it.
What does m mean in SARIMA?
CLICK TO REVEAL
Answer
Seasonal period.
Weekly daily observations → m = 7
Yearly monthly observations → m = 12
Daily hourly observations → m = 24
How to explain it in an interview
ARIMA models temporal dependence using past values, differencing, and past forecast errors.
If I also have useful external variables, I use ARIMAX.
If the series contains repeating seasonal behaviour, I use SARIMA.
If it contains both seasonality and external predictors, I use SARIMAX.
↓ + X
ARIMAX
ARIMA
↓ + SEASONALITY
SARIMA
SARIMA
↓ + X
SARIMAX
No comments:
Post a Comment