With Pigment’s Predictions tool, you can improve your forecast accuracy by including external factors, such as weather reports, planned changes to pricing and distribution, and other data. This article provides best practices and tips on adding external factors to your model.
Before you begin
Adding external factors to your Predictions might improve forecast accuracy. External data sets that capture cause-effect relationships can predict behaviors historical data alone might miss.
What is an external factor?
An external factor is any data that is expected to influence the behavior of the Metric you are forecasting, beyond what can be explained by the Metric’s own historical values. Despite the name, external factors are not limited to data from outside your company. They can include both internal and external signals, as long as they help explain and predict future changes.
Examples include:
-
Internal signals: price shifts, promotions and advertising campaigns
-
External signals: signals, holidays, competitor pricing, economic indicators
To be effective, external factors should have a plausible causal relationship with the predicted Metric.
Eligible Metrics for external factors
Data to be used as external factors must be held in Metrics, with a maximum of 10 Metrics for each Prediction. To be eligible, the data must be:
- 90% complete, as defined below
- With the same Dimensions as the source Metric
- Integer or Number data type
Note
Having too many external factors, especially those that are not clearly related to the forecasted Metric, can introduce noise, reduce accuracy, and increase computation time. For best results, only select external factors that have a clear, plausible influence on the Metric you are forecasting.
Run a Prediction with external factors
When you have chosen and set up an eligible Metric as above, you start a new Prediction by selecting the checkbox beside the Metric’s name in the Configure Prediction dialog. The external factors are evaluated automatically (see next section) and the data is included if relevant.
Automatic evaluation
When you include external factors in a prediction, Pigment performs two evaluation steps before including them. If your external factors are not changing your Predictions, they may not have passed the following evaluations:
1. Pre-processing of external factors
First, Pigment checks for completeness per time series:
- External factor data must cover 90% minimum of the time series, both backwards in time and forwards.
Imagine you are predicting 12 months of future data for a Metric using 48 months of past data. Your external factors must have, at a minimum:- 90% x 12 = 10.8. → 11 months of future data.
- 90% x 48 = 43.2. → 44 months of past data.
- if those thresholds are not met for a given time series, the external factor data is not used in the prediction for that time series.
- If the completeness condition is met, missing values are handled automatically:
- Backward fill is used at the beginning of the series: the first known value is used to fill any missing values that come before it.
- Interpolation is applied for missing values in the middle: missing values between known data points are estimated based on a straight line method between the surrounding values.
- Forward fill is used at the end of the series: the last known value is carried forward to fill any missing values that follow it.
This approach ensures Predictions are only influenced by external data that’s complete enough and meaningful, while remaining robust to a few missing values.
2. Granger causality test
Pigment performs a Granger causality test (see Wikipedia for more information) to assess whether an external factor has predictive power for the Metric.
For each external factor and time series:
- Up to five time lags are tested. A lag is a past value of an external factor, used to check if earlier changes in that factor help explain or predict future changes in the Metric.
- A factor is selected if any lag produces a p-value below 0.005, indicating statistically significant predictive power.
This step filters out irrelevant external factors and ensures only meaningful data is used in the model.
Impact of external factors
COMING SOON
For each time series and selected external factor, Pigment calculates an impact score that quantifies the influence of that factor on the predicted Metric.
For example, if Marketing spend
is selected as an external factor for the Metric Sales
, the impact scores might look like this:
Product | External factor | Impact score |
---|---|---|
Product 1 | Marketing spend | 10 |
Product 2 | Marketing spend | 20 |
Product 3 | Marketing spend |
- For
Product 1
, an increase of 1 unit inMarketing spend
is associated with an average increase of 10 units inSales
over the same time period. - For
Product 2
, an increase of 1 unit inMarketing spend
is associated with an average increase of 20 units inSales
over the same time period - For
Product 3
, the is no score score is shown becauseMarketing spend
was not selected by the Granger test, meaning no statistically significant predictive relationship was detected.
These scores are then aggregated to compute and display the following insights:
Measure | Description | Example |
---|---|---|
Usage % | The proportion of time series where the external factor was selected. | In the example above, |
Average impact | The average impact of the external factor, weighted by the forecasted values of each time series. | Assuming the forecast of |