DATA4400
Data-Driven Forecasting
Prophet for Business Forecasting
Lesson 6

DATA4400 Course Roadmap

This course spans 12 weeks, covering fundamental to advanced forecasting techniques. Week 6 focuses on Prophet, a powerful tool for business forecasting.

Week 1
Forecasting Foundations & Data Preparation
Week 2
Generative AI & Moving Averages
Week 3
Stationarity & Correlation Analysis
Week 4
Introductory Forecasting Methods
Week 5
Assessment 1: Group Presentation
Week 6
Prophet for Business Forecasting
Week 7
ARIMA & SARIMA Modelling
Week 8
VAR & Multivariate Methods
Week 9
Regression Models & Assessment 2
Week 10
End-to-End Forecasting Solutions
Week 11
Adaptive Forecasting Methods
Week 12
Assessment 3

Lesson Learning Outcomes

By the end of this lesson, you will be able to:

1 Analyse the Prophet forecasting method and understand its core components
2 Analyse and apply model evaluation metrics (RMSE, MAPE, MSE)
3 Understand model selection criteria using information criteria (AIC, BIC)
Why These Skills Matter

Prophet is widely used in industry for business forecasting. Understanding how to implement, evaluate, and select forecasting models is essential for making data-driven business decisions.

Recap: Forecasting Methods You Have Learned

Before introducing Prophet, let us review the forecasting methods covered in previous weeks. Each method has specific strengths and ideal use cases.

Naïve Method

Ŷt+1 = Yt

Uses the last observation as the forecast

Moving Average

Ŷt+1 = (1/k) Σ Yt-i

Averages the last k observations

Exponential Smoothing

Ŷt+1 = αYt + (1-α)Ŷt

Weights recent observations more heavily

Where Does Prophet Fit In?

Prophet addresses limitations of traditional methods while maintaining interpretability. Here is how each method compares:

Method Handles Trend Handles Seasonality Handles Holidays Missing Data Complexity
Naïve No No No Poor Very Low
Moving Average Lags behind No No Poor Low
Exponential Smoothing Basic No* No Moderate Low
Holt-Winters Yes Yes No Moderate Medium
Prophet Yes (flexible) Yes (multiple) Yes Excellent Medium

*Simple Exponential Smoothing does not handle seasonality; Holt-Winters (Triple Exponential Smoothing) does.

Choosing the Right Method

Each forecasting method has scenarios where it excels. Understanding when to use each method is crucial for effective forecasting.

Use Naïve/Moving Average when:
• Data has no clear pattern
• Quick baseline forecast needed
• Very short-term predictions
Use Exponential Smoothing when:
• Data has trend but no seasonality
• Recent data is more important
• Simple, interpretable model needed
Use Holt-Winters when:
• Clear trend AND seasonality exist
• Single seasonal pattern (weekly OR yearly)
• No irregular holidays to model
Use Prophet when:
• Multiple seasonalities (weekly AND yearly)
• Holidays/events affect the data
• Missing data or outliers present
• Non-linear growth patterns exist
Key Insight

Prophet is not always better. For simple data without holidays or multiple seasonalities, simpler methods like Holt-Winters may perform equally well with less computational cost. Always start simple and add complexity only when needed.

What is Prophet?

Prophet is a forecasting procedure developed by Facebook's (now Meta's) Core Data Science team. It is designed specifically for business time series that exhibit strong seasonal patterns.

Core Characteristics

Prophet uses an additive model where non-linear trends are combined with:

  • Yearly seasonality (annual patterns)
  • Weekly seasonality (day-of-week effects)
  • Daily seasonality (time-of-day effects)
  • Holiday effects (special events)

When Prophet Works Best

  • Strong seasonal effects
  • Several seasons of historical data
  • Trend shifts over time
  • Known irregular events (holidays)
  • Missing data points
  • Large outliers in the data
Open Source Availability

Prophet is open source and available for download on CRAN (for R) and PyPI (for Python), as well as through Exploratory.io.

Prophet Advantages

Accurate and Fast

  • Used across Meta for reliable forecasts
  • Outperforms other approaches in most business cases
  • Uses Stan (probabilistic programming language) for fast computation

Fully Automated

  • Provides reasonable forecasts with no manual effort
  • Robust to outliers and missing data
  • Handles dramatic changes in time series

Tunable Forecasts

  • Many user-adjustable parameters
  • Human-interpretable settings
  • Incorporate domain knowledge easily

Multiple Platforms

  • Available in R and Python
  • Same underlying Stan code
  • Also available in Exploratory.io (menu-driven)

Knowledge Check

Quiz 1: Comparing Forecasting Methods
A retail company has 3 years of daily sales data with strong Christmas and Easter effects, weekly patterns, and some missing values due to system outages. Which method would be MOST appropriate?

The Prophet Forecasting Model

Prophet uses a decomposable time series model with three main components. The model is expressed as:

y(t) = g(t) + s(t) + h(t) + εt

Understanding Each Component

g(t)
Trend
+
s(t)
Seasonality
+
h(t)
Holidays
+
εt
Error
Component Description Example
g(t) - Trend Piecewise linear or logistic growth curve for modelling non-periodic changes Long-term growth in user adoption
s(t) - Seasonality Periodic changes (weekly, yearly patterns) Higher sales during December
h(t) - Holidays Effects of holidays with irregular schedules (user-provided) Easter, Black Friday sales spikes
εt - Error Accounts for unusual changes not captured by the model Random fluctuations, unexpected events

Visualising Prophet Components

The following chart demonstrates how Prophet decomposes a time series into its components. The final forecast is the sum of trend, seasonality, and holiday effects.

Key Insight

By separating the time series into interpretable components, Prophet makes it easier to understand what is driving changes in your data. This is particularly valuable for business stakeholders who need to explain forecasts.

Ideal Use Cases for Prophet

Not all forecasting problems benefit equally from Prophet. The tool is specifically optimised for business forecasting scenarios with the following characteristics:

Ideal Use Cases

  • Historical data available: At least one year of hourly, daily, or weekly observations
  • Human-scale seasonalities: Strong patterns tied to day of week and time of year
  • Known holidays: Holidays that occur at irregular intervals but are predictable
  • Imperfect data: Reasonable amounts of missing observations or outliers
  • Trend changes: Historical shifts due to product launches or market changes
  • Non-linear growth: Trends that follow growth curves rather than straight lines
Business Application: Prophet excels in retail sales forecasting, website traffic prediction, capacity planning, and demand forecasting where seasonal patterns and holidays significantly impact the data.

Design Philosophy Behind Prophet

Prophet was developed to be accessible to analysts who may not have deep statistical expertise. The key design principles include:

User-Friendly Customisation

Smoothing Parameters

  • Adjust how closely to fit historical seasonal cycles
  • Control how aggressively to follow historical trend changes

Growth Curve Settings

  • Manually specify capacity limits
  • Inject domain knowledge about growth constraints

Holiday Specification

Users can specify irregular holidays like Easter, Ramadan, or major sporting events that don't fall on fixed dates but significantly impact the time series.

The Prophet Philosophy

By using a flexible regression approach rather than traditional time series models, Prophet provides greater modelling flexibility, easier model fitting, and more graceful handling of missing data and outliers.

Case Study: Chicago Bike Share

Let us examine a real-world application of Prophet using bike-sharing data from Chicago (Divvy). This case study demonstrates how Prophet handles seasonal patterns and external factors.

The Data

The dataset contains daily bike ride counts along with weather information (temperature and rainfall). The time series exhibits:

  • Strong yearly seasonality (more rides in summer)
  • Weekly patterns (weekday commuter patterns)
  • Weather-dependent fluctuations

Source: Greg Rafferty, "Forecasting in Python with Facebook Prophet"

Case Study: Weather Impact

The Chicago bike share data reveals a strong correlation between temperature and ridership. Prophet can incorporate such external regressors to improve forecast accuracy.

External Regressors

Prophet allows you to add additional variables (like temperature or marketing spend) that influence your target variable. This makes forecasts more accurate when external factors have predictable effects.

Case Study: Prophet Forecast Output

When Prophet generates a forecast, it produces several key outputs that help you understand and communicate the results:

Visual Elements

  • Black dots: Original observed data
  • Blue line: Fitted model and forecast
  • Light blue shading: Uncertainty interval (confidence band)
  • Red dashed lines: Detected trend changepoints
  • Red solid line: Underlying trend (seasonality removed)

Interpretation

  • Wider confidence intervals indicate greater uncertainty
  • Changepoints show where trends shifted direction
  • The trend line reveals long-term growth or decline

Case Study: Component Decomposition

Prophet automatically generates a components plot that breaks down the forecast into its constituent parts. The sum of these components equals the final forecast.

Insights from Weekly Seasonality

The weekly pattern shows ridership is relatively constant Monday through Friday, with a steep decline on weekends. This supports the hypothesis that most riders are weekday commuters rather than recreational users.

Knowledge Check

Quiz 2: Prophet Model Components
In the Prophet equation y(t) = g(t) + s(t) + h(t) + εt, what does s(t) represent?

Activity: Sales Forecasting with Exploratory

Step-by-Step Instructions
  1. Open the Exploratory.io application
  2. Create a new project
  3. Load the Sales_Data dataset from the Exploratory Data Catalog
  4. Explore the data summary page to understand your variables
  5. Verify that "Order Date" is recognised as a date type
  6. If not recognised as a date, go to the Table tab and change the column type to Date
Important: Prophet requires the date column to be properly formatted. Incorrect date types are a common source of errors when building forecasting models.

Activity: Building the Prophet Model

Continuing the Analysis
  1. Navigate to the Charts tab and create a line chart of sales over time
  2. Go to the Analytics tab and select Prophet forecasting
  3. Build your Prophet model with default settings initially
  4. Experiment with external factors: Are there regressors like discounts or promotions you can add?
  5. Identify the maximum historical monthly sales value
  6. Compute a threshold of 1.2 × peak sales for capacity planning
Why Calculate a Threshold?

Setting a capacity threshold (e.g., 120% of historical peak) helps businesses prepare for high-demand periods and avoid stockouts or service failures.

Understanding Extrapolation

Extrapolation is the process of extending patterns observed in historical data into the future. It is the fundamental mechanism behind most forecasting methods, including Prophet.

How Extrapolation Works

The forecasting model identifies patterns (trends, seasonality, cycles) in your historical data and projects these patterns forward. The assumption is that future behaviour will resemble past behaviour.

Extrapolation: Limitations and Cautions

When Extrapolation Works Best

  • The underlying trend is stable and consistent
  • No major changes are expected in the system
  • Forecasting over short time horizons
Critical Warning: Past patterns do not always continue. Markets crash, trends reverse, and unexpected events occur. The further you extrapolate into the future, the less reliable your forecast becomes.

Real-World Examples of Extrapolation Failure

  • COVID-19 pandemic: No historical pattern could predict the sudden drop in travel and retail
  • Technological disruption: Kodak's film sales forecasts couldn't anticipate digital photography
  • Regulatory changes: New laws can instantly change market dynamics

Knowledge Check

Quiz 3: Extrapolation
Which statement about extrapolation in forecasting is TRUE?

Python Activity: Prophet Forecasting

Python Notebook Activities

Complete the following Python notebooks to practice Prophet implementation:

DATA4400_W06_1_ProphetExtrapolate

  • Loading time series data
  • Fitting a Prophet model
  • Generating future predictions
  • Visualising forecasts with confidence intervals

DATA4400_W06_2_ProphetErrors

  • Calculating RMSE, MAPE, MSE
  • Cross-validation for error estimation
  • Comparing model configurations
  • Visualising forecast errors
Learning Objective

These activities demonstrate how Prophet handles extrapolation, computes error metrics, and helps you understand how uncertainty grows as you forecast further into the future.

Model Evaluation Metrics

To evaluate the quality of forecasting models, we use standardised accuracy measures that quantify how close our predictions are to the actual observed values.

Why Evaluate Models?

  • Compare different forecasting approaches objectively
  • Assess whether a model is accurate enough for business decisions
  • Identify areas where the model performs poorly
  • Communicate forecast reliability to stakeholders
The Golden Rule

Smaller error values indicate better predictions.

We will examine three primary metrics: RMSE, MAPE, and MSE. Each has different strengths and is suited to different situations.

Root Mean Square Error (RMSE)

RMSE (also called Root Mean Square Deviation or RMSD) measures the average magnitude of forecast errors, giving higher weight to larger errors.

RMSE = √(1/n × Σ(Yi - Ŷi)²)

Formula Components

  • Yi = Actual observed value
  • Ŷi = Predicted value
  • n = Number of observations

Key Properties

  • Same units as the original data
  • Sensitive to outliers (large errors)
  • Penalises large errors more heavily

Mean Absolute Percentage Error (MAPE)

MAPE expresses forecast accuracy as a percentage, making it easy to interpret and compare across different scales.

MAPE = (1/n × Σ|Yi - Ŷi| / Yi) × 100%

Advantages

  • Scale-independent (percentage)
  • Easy to communicate to stakeholders
  • Positive and negative errors don't cancel

Interpretation Guide

MAPE Accuracy
< 10% Highly accurate
10-20% Good
20-50% Reasonable
> 50% Poor
Caution: MAPE cannot be used when actual values are zero or near zero, as this causes division by zero or extremely large percentages.

Mean Square Error (MSE)

MSE (also called Mean Square Deviation or MSD) is the average of squared differences between predicted and actual values. It forms the basis for many statistical calculations.

MSE = 1/n × Σ(Yi - Ŷi

Relationship Between Metrics

Note that RMSE is simply the square root of MSE: RMSE = √MSE

When to Use MSE

  • Comparing models mathematically
  • Optimisation algorithms
  • Statistical calculations

When to Use RMSE

  • Reporting to stakeholders
  • Interpreting error magnitude
  • Comparing to actual data values
Practical Tip

RMSE is generally preferred for reporting because it is in the same units as your data. If your sales are in dollars, RMSE will be in dollars, making it easier to understand the practical impact of forecast errors.

Knowledge Check

Quiz 4: Error Metrics
A company's sales forecast has an RMSE of 500 units and a MAPE of 8%. Which statement is correct?

Model Selection Criteria

When comparing different types of forecasting models, we use information criteria to measure model quality while penalising complexity.

Akaike Information Criterion (AIC)

AIC balances goodness of fit against model complexity. Lower AIC values indicate a better model.

  • Penalises models with more parameters
  • Prevents overfitting to historical data
  • For small samples, use the corrected version: AICc

Bayesian Information Criterion (BIC)

BIC applies a stronger penalty for model complexity than AIC, especially with larger datasets.

  • More conservative model selection
  • Tends to select simpler models than AIC
  • Also called Schwarz Information Criterion (SIC)
Selection Rule

Choose the model with the LOWEST AIC or BIC value.

Knowledge Check

Quiz 5: Model Selection
You are comparing three Prophet models with different configurations. Their AIC values are: Model A = 1250, Model B = 1180, Model C = 1320. Which model should you select?

Key Takeaways

Prophet Fundamentals

  • Additive model: y = g(t) + s(t) + h(t) + ε
  • Handles multiple seasonalities
  • Robust to missing data and outliers
  • Best for business time series with holidays

Error Metrics

  • RMSE: Same units as data, sensitive to outliers
  • MAPE: Percentage-based, easy to interpret
  • MSE: Used in calculations, RMSE = √MSE
  • Lower values = better predictions

Model Selection

  • AIC/BIC balance fit vs complexity
  • Lower AIC/BIC = better model
  • Use AICc for small samples
  • Start simple, add complexity as needed
Remember: Prophet is not always the best choice. For simple data without holidays or multiple seasonalities, traditional methods like Holt-Winters may be equally effective with lower computational cost. Always evaluate multiple approaches and select based on error metrics.

Additive vs Multiplicative Seasonality

Prophet supports both additive and multiplicative seasonality modes. Choosing the correct mode significantly impacts forecast accuracy.

Additive Seasonality

Pattern: Seasonal swings remain constant regardless of the level

Example: Sales always increase by $10,000 in December

Use when: Seasonal variation is roughly constant over time

Multiplicative Seasonality

Pattern: Seasonal swings grow proportionally with the level

Example: Sales always increase by 15% in December

Use when: Seasonal variation grows with the trend

Quick Test

Look at your data: If the peaks and troughs get larger as the overall level increases, use multiplicative. If they stay roughly the same size, use additive.

References and Further Reading

Primary Sources

  • Bakker, L.A. (2020). "Business Forecasting with Facebook Prophet." Towards Data Science. Available at: https://towardsdatascience.com/business-forecasting-with-facebook-prophet-b9aaf7121398
  • Rafferty, G. (2021). Forecasting Time Series Data with Facebook Prophet: Build, improve, and optimize time series forecasting models using the advanced forecasting tool. Packt Publishing Ltd.
  • Taylor, S.J. & Letham, B. (2018). "Forecasting at Scale." The American Statistician, 72(1), 37-45.

Official Documentation

End of Lesson 6

You have completed the materials for Prophet for Business Forecasting. Ensure you complete the Python activities and prepare for the upcoming content on ARIMA and SARIMA modelling in Week 7.