In this blog post we will show you how you can leverage SAP Analytics Cloud Predictive Planning predictive capabilities to perform a predictive “What-if simulation”.
How Does Predictive Relate to What-if Simulation?
The Simulation Model
To understand how the “Predictive What-if Simulation” differs from a traditional What-If simulation, we need to have a quick look at the method behind the What-If simulation.
To perform a What-if simulation you need:
- Some business variables: the business variables are KPIs (Key Performance Indicator) associated to your business.
- Some scenarios: the scenarios are the different business hypotheses you want to test. Each scenario corresponds to a set of values you want to test for the business variables to see how it impacts the KPIs to be estimated. “What-if I would increase the advertisement budget by 10% next year and maintain the same discount” would be a scenario, “What-if I would decrease the advertisement budget by 10% next year and make no discount” would be another scenario.
- A simulation model: the simulation model expresses the relations that exist between the business variables. It’s a simplified representation of your business.
Usually, the simulation model would be the Planning Model itself, where you have expressed explicitly (by creating hierarchies or calculations) the relations that exists between the measure/accounts (the business variables). But this approach is applicable only under the following conditions:
- the relations between the business variables and the outcome to be estimated must be known and must have been properly expressed in the planning model
- the relations between the business variables and the outcome doesn’t change over time
The Predictive Model can find relations between the business variables and the KPI to be predicted that may not be expressed in the Planning Model. Moreover, these relations are reevaluated each time the Predictive Model is retrained. The Predictive Model can be used as a complement to provide additional relations between the business variables and the KPI and thus have a better simulation model.
Let’s assume you are selling cars and you would like to get an idea of your revenue for next year.
You have a Planning Model with the following KPIs:
- Revenue (the KPI you would like to estimate with the simulation)
- Number of Units Sold
- Unit Price
- Advertisement Budget
Revenue is certainly expressed explicitly in the Planning Model as a function of Number of Units Sold, Unit Price and Discount (something like Revenue = Number of Units Sold * Unit Price * Discount to simplify). Because this relation exists explicitly in the Planning Model you can easily simulate how changing Discount and Unit Price would impact the Revenue.
But this Planning Model also contains relations that are not expressed explicitly. It’s safe to assume that Discount and Advertisement Budget are impacting Number of Units Sold (that’s usually why you make discount and advertisement). But these relations would usually not be expressed in a Planning Model, so there is something not completely right in your simulation: changing the values for Discount and Advertisement Budget has no impact on Number of Units Sold.
So, to fix your simulation you can use a time series forecasting model to predict Number Of Units Sold using Advertisement Budget and Discount as influencer. This way the missing relations are modelized and can be used as a complement to the relations that exist in the Planning Model.
These new relations brings two advantages:
- You can take into account the impact of variables that were previously not considerd in the simulation: Advertisement Budget
- You don’t have to provide a value for a variable, Number Of Units Sold, which is not under your control, to run your simulation. Instead you provide values for variables which are under your control: Unit Price and Advertisement Budget
The remaining of this post is assuming that you are familiar with Predictive Planning and the Influencers.
I am working for a company that is renting bikes in London. I have a planning model that contains a BikeHires measure that counts the bike hires done each day. The planning model also contains several measures related to the weather. Using Predictive Planning I would like to forecast the number of bikes that will be hired for the coming 30 days.
You can download this dataset if you want to recreate this example. Note that the columns BikeHires, Temp. Min, Temp. Max, Temp. Mean, Humid. Min, Humid. Max, Humid. Mean and Rain are expected to be measures. Other columns should be considered dimensions.
Step by Step
We have seen that the number of bike hires is influenced by some weather related conditions, more specifically, the amount of rain and the maximum temperature during the considered day.
But we want to get predictions for the 30 coming days. We can probably have some rather precise weather predictions we can use for tomorrow, possibly even for the full week to come if the imprecision doesn’t matter too much… but there is no way we can get any weather forecast we can trust for the 30 days to come. In all cases we would be using unreliable input to generate predictive forecasts.
So, what should we do? We should perform a predictive “What-if” simulation, that is looking at what the predictive output would be based on different hypothesis, knowing that they are just hypothesis. Because the predictions are based on input that are themselves not predictable, we don’t make assumptions about what the future will be. Instead we look at what would happen in such or such situation.
We will perform a What-if simulation using 3 simple scenarios (“hypothesis”):
- A median scenario that will allow generating a forecast based some standard assumptions about the weather.
- A pessimistic scenario that will allow generating a forecast based on pessimistic assumptions about the weather (weather conditions that tend to lower the number of bikes hires)
- An optimistic scenario that will allow generating a forecast based on optimistic assumptions about the weather (weather conditions that tend to increase the number of bikes hires)
Setup the Scenarios
Each simulation scenario will be represented as a planning version, so we need to create 3 private versions.
But to create these versions we need to take a SAP Analytics Cloud Predictive Planning limitation into account: it’s not possible to train a model once and apply it to multiple versions. This means that we will have to train 3 distinct models using the same training data each time. So simply we will create our 3 versions by copying the data from the Actual version.
To keep things simple, we have assumed a constant daily maximum temperature and a constant daily amount of rain over the whole month. But you can create way more complex scenarios if you feel the need to.
Where do these values come from?
Over the past years the average temperature in September was 15C, with a minimum average temperature of 12°C and maximum average temperature of 18°C. So, we took 15°C for the median hypothesis, 12°C for the pessimistic hypothesis and 18°C for the optimistic hypothesis.
Similarly, the average daily amount of rain in September is 1.5 inch and it’s around 5 inches on an awfully bad month. So, we took 1.5 inch for the median scenario, 5 inches for the pessimistic scenario and 0 inch (no rain at all) for the optimistic scenario.
Train the Predictive Model
Now we will create a time-series forecasting Predictive Scenario.
Let’s create a first Predictive Model for the “median” scenario, using the settings below:
Don’t forget to provide a description that identifies the simulation scenario clearly.
Train the model:
The two remaining predictive models will use the same settings but reference other input versions, so we will use the “Duplicate” feature.
Create 2 additional predictive models changing only the input version and the description. Train these models.
Now we have 3 trained models, ready to generate prediction for 3 distinct scenarios.
We just need to write the forecasts for each of the model to a different version. To avoid multiplying the versions, we will write the forecasts of each model to the planning version that was used to train the model.
Click the “Save Forecast” button.
Visualize the Results
Now, we are ready to visualize the results of the simulations into a story.
We can see what the bike hires for September could be for three hypothetical scenarios. It gives us as sense of what to expect if the weather in September is very bad, very good or average.