ARIMA may help with one series measured at set time steps. It uses past values, changes, and past errors to predict later values. This page runs a small ARIMA-style example on made-up data and checks the forecast on held-back values.
Worked Example (Simulated): Forecast Six Held-Back Values
Question: Can a model fitted to the first 42 values of a made-up series predict the last 6?
Inputs: Made-up data, seed 42. The script builds 48 values. Each change from one value to the next is linked to the change before it, with a built-in link of 0.55 plus random noise. It fits the first 42 values and saves the last 6 to check the forecast. This script fits the link by least squares on the changes. It is close to, not the same as, a packaged ARIMA fit.
import numpy as np
SEED = 42
N = 48
TRAIN_SIZE = 42
HOLDOUT_SIZE = N - TRAIN_SIZE
TRUE_PHI = 0.55 # the link built into the made-up series
rng = np.random.default_rng(SEED)
# Build the series: each change follows the one before it, plus noise.
delta = np.empty(N - 1)
delta[0] = 0.8
noise = rng.normal(loc=0.0, scale=1.5, size=N - 2)
for t in range(1, N - 1):
delta[t] = 0.8 + TRUE_PHI * (delta[t - 1] - 0.8) + noise[t - 1]
series = np.concatenate(([100.0], 100.0 + np.cumsum(delta)))
# Fit the link between changes to the training changes by least squares.
train_delta = np.diff(series[:TRAIN_SIZE])
X = np.column_stack((np.ones(len(train_delta) - 1), train_delta[:-1]))
intercept, phi = np.linalg.lstsq(X, train_delta[1:], rcond=None)[0]
# Forecast each held-out change in turn, then add it to the last level.
forecasts = []
previous_delta = train_delta[-1]
level = series[TRAIN_SIZE - 1]
for _ in range(HOLDOUT_SIZE):
next_delta = intercept + phi * previous_delta
level += next_delta
forecasts.append(level)
previous_delta = next_delta
forecasts = np.array(forecasts)
actual = series[TRAIN_SIZE:]
miss = actual - forecasts
mae = np.mean(np.abs(miss))
print(f"seed={SEED}; observations={N}; train={TRAIN_SIZE}; holdout={HOLDOUT_SIZE}")
print("fit: AR(1) on first differences, least squares (not a packaged ARIMA fit)")
print(f"built-in phi={TRUE_PHI}; estimated intercept={intercept:.3f}; "
f"estimated phi={phi:.3f}")
print("holdout actual=" + ", ".join(f"{x:.2f}" for x in actual))
print("holdout forecast=" + ", ".join(f"{x:.2f}" for x in forecasts))
print("holdout miss=" + ", ".join(f"{x:.2f}" for x in miss))
print(f"holdout MAE={mae:.2f}")
Printed output:
seed=42; observations=48; train=42; holdout=6
fit: AR(1) on first differences, least squares (not a packaged ARIMA fit)
built-in phi=0.55; estimated intercept=0.534; estimated phi=0.424
holdout actual=139.78, 142.02, 142.62, 143.66, 144.76, 146.06
holdout forecast=138.73, 139.65, 140.57, 141.49, 142.42, 143.34
holdout miss=1.05, 2.38, 2.05, 2.17, 2.34, 2.71
holdout MAE=2.12
Result: Every forecast was below the true value. The miss was 1.05 at the first step and 2.71 at the sixth, and the average miss (MAE) was 2.12. The fit found a link of 0.424; the series was built with 0.55.
Limit: The data are made up and the run is one series with six held-back values. It says little about forecasts for real business data.
Sources
- Hyndman R, Athanasopoulos G. Forecasting: Principles and Practice (3rd ed.). otexts.com/fpp3. Cited as a textbook on ARIMA forecasting.
- statsmodels developers. statsmodels: time series analysis. statsmodels.org/stable/tsa. Cited as documentation for packaged ARIMA fits.
The Challenge: Making Sense of Time-Based Data
Every business generates time series data - sales figures, website traffic, inventory levels, customer acquisition rates. The challenge isn't collecting this data; it's extracting actionable insights that drive strategic decisions. Traditional spreadsheet-based forecasting methods fall short when dealing with:
To see where your own measure is heading, with a likely range, try the free forecasting tool.
- Seasonal Patterns: Recurring patterns like holiday sales spikes or quarterly business cycles
- Trend Analysis: Long-term growth or decline trajectories hidden in noisy data
- Autocorrelation: How past values influence future outcomes in complex ways
- Confidence Intervals: Understanding the uncertainty in predictions for risk management
This is where ARIMA (AutoRegressive Integrated Moving Average) models may help, and MCP Analytics offers them through natural language interaction with Claude.
Understanding ARIMA: Past Values, Changes, and Past Errors
ARIMA uses past values, changes, and past errors. Its three parts are:
AR (AutoRegressive): Learning from the Past
The AutoRegressive component assumes that future values depend on recent past values. Think of it as asking: "How do the last few months of sales predict next month?" The AR(p) component uses p previous observations to predict the current value.
Business Example: Retail Sales Momentum
If your store's sales rise each month in the run-up to the holiday season, the AR component can pick up this momentum, so that strong sales in October help predict November.
I (Integrated): Achieving Stability
The Integrated component addresses non-stationarity - when a time series has changing means or trends over time. Differencing transforms the data to focus on period-to-period changes rather than absolute values.
Raw Data
Made-up sales figures with a trend: $100k, $110k, $125k, $140k...
First Difference
Made-up period changes: +$10k, +$15k, +$15k...
Stationary Series
Stable pattern suitable for modeling
MA (Moving Average): Smoothing Random Fluctuations
The Moving Average component models the relationship between current values and past prediction errors. It helps smooth out random fluctuations and capture the impact of external shocks on the system.
ARIMA(p, d, q) where:
- p = number of autoregressive terms (how many past values to consider)
- d = degree of differencing (how many times to difference the data)
- q = number of moving average terms (how many past errors to consider)
Example: ARIMA(2,1,1) uses:
- 2 past values for autoregression
- 1 level of differencing for stationarity
- 1 past error for moving average smoothing
Seasonal ARIMA: Capturing Business Cycles
Most business data exhibits seasonal patterns - quarterly earnings cycles, monthly sales fluctuations, or weekly website traffic patterns. Seasonal ARIMA (SARIMA) extends the basic model to handle these cyclical behaviors.
SARIMA Model Structure
A SARIMA model is denoted as ARIMA(p,d,q)(P,D,Q)[s], where the uppercase letters represent seasonal components and [s] indicates the seasonal period (e.g., 12 for monthly data with yearly seasonality).
Monthly Seasonality
Captures yearly patterns in monthly data (s=12) like holiday sales or summer tourism
Quarterly Cycles
Models quarterly business reporting cycles (s=4) for earnings forecasts
Weekly Patterns
Handles weekly cycles (s=7) in website traffic or daily sales data
Custom Periods
Adapts to any business-specific seasonal cycle or recurring pattern
Real-World Applications: ARIMA in Action
Let's examine how different industries leverage ARIMA forecasting through MCP Analytics to solve specific business challenges:
Retail: Inventory Optimization
Retail teams forecast demand to plan inventory. The worked example near the top of this page shows the method on a made-up series, not on retail data.
See It in Action
Time Series Forecasting on Retail Demand Data
Interactive 15-section report with trend decomposition, forecasts, confidence intervals, and diagnostic plots on daily sales data.
SaaS: Revenue Forecasting for Fundraising
B2B SaaS companies may use ARIMA models to create revenue forecasts for investor presentations and strategic planning:
Illustration: Mid-Stage SaaS Company
An example built to show the shape of an analysis; the business and numbers are illustrative.
In this illustration, a SaaS company forecasts monthly recurring revenue (MRR) growth for a funding pitch. No results are shown here. Any such forecast should be checked against held-back data first.
Manufacturing: Demand Planning
Manufacturing companies may use ARIMA for production planning and supply chain optimization:
- Raw Material Procurement: Forecast component demand to optimize purchasing schedules
- Capacity Planning: Predict peak production periods for workforce scheduling
- Quality Control: Monitor process variations and predict maintenance needs
The MCP Analytics Advantage: Professional Tools, Simple Interface
MCP Analytics offers ARIMA modeling through conversation. Instead of writing R or Python code, you can ask for a forecast in natural language:
Model Selection
The tool can choose ARIMA settings using:
- AIC/BIC Optimization: Statistical measures to balance model complexity and accuracy
- Out-of-Sample Testing: Out-of-sample testing on held-back data
- Stationarity Testing: Automatic differencing to achieve statistical stability
- Residual Analysis: Diagnostic checks on model assumptions
Comprehensive Diagnostics
ARIMA analyses can include diagnostic reports:
Model Performance
RMSE, MAE, and MAPE error metrics
Residual Analysis
Ljung-Box tests and autocorrelation plots for checking the fit
Seasonal Decomposition
Visual breakdown of trend, seasonal, and irregular components
Confidence Intervals
Ranges that show how uncertain a forecast is
Best Practices for ARIMA Forecasting
Data Requirements
ARIMA forecasting depends on the data:
- Sufficient History: Enough history to cover several complete seasonal cycles
- Consistent Intervals: Regular time periods without gaps
- Stable Business Context: Avoid periods with major structural changes
- Clean Data: Handle outliers and missing values appropriately
Model Interpretation
Reading ARIMA Output
ARIMA(2,1,1)(1,1,1)[12] means:
- Non-seasonal: AR(2), I(1), MA(1)
- Seasonal: AR(1), I(1), MA(1) with 12-month cycle
- Model uses 2 past values + 1 past error + seasonal components
Checking Forecasts
Check forecasts against business context:
- Sanity Checks: Do predictions align with business knowledge?
- External Factors: Consider upcoming market changes or campaigns
- Confidence Intervals: Use uncertainty ranges for scenario planning
- Model Monitoring: Update forecasts regularly as new data arrives
Advanced Techniques: Beyond Basic ARIMA
External Variables (ARIMAX)
ARIMAX models incorporate external variables as predictors:
- Marketing Spend: Include advertising budget as a predictor
- Economic Indicators: Incorporate GDP, unemployment, or interest rates
- Weather Data: Account for seasonal weather impacts
- Competitor Activity: Include market share or pricing data
Ensemble Forecasting
Combine ARIMA with other forecasting methods to compare forecasts:
- ARIMA + Linear Regression: Capture both temporal and explanatory patterns
- Multiple Seasonal Cycles: Handle both weekly and yearly seasonality
- Hierarchical Forecasting: Forecast multiple product lines simultaneously
Why Use ARIMA
Reasons teams use ARIMA:
- Provide Interpretable Results: Clear understanding of what drives predictions
- Handle Uncertainty: Confidence intervals for risk management
- Require Minimal Data Engineering: Work with raw time series data
- Scale Across Industries: Used in many fields
With MCP Analytics, you can ask for these forecasts by asking questions about your data.
Working on this for your business? See the time series forecasting tool.
About ARIMA Forecasting
ARIMA (AutoRegressive Integrated Moving Average) models are a common technique in time series analysis, used for business planning and financial analysis. MCP Analytics offers these models through natural language interaction.
Your turn
Bring your own data and the question you actually need answered.
MCP AnalyticsData science by email Send us your data and your question, and we will reply. ds@mcpanalytics.ai