Sensitivities

pd4castr lets you run alternative versions of your model with modified input data, so you can explore “what if” scenarios alongside your base forecast.

Sensitivities execute the same model container with transformed input data. A SQL query modifies the base input before the container runs, letting you answer questions like “what if demand is 10% higher?”.

How Sensitivities Execute

When a base model run is triggered, one additional run is created for each sensitivity. All runs share the same runDatetime. Before each sensitivity run starts, the SQL query runs against the input files loaded into a SQL database and produces a modified version of the input data. The container then receives this transformed data instead of the original.

Configuration

Define sensitivities in the sensitivities array in .pd4castrrc.json:

FieldTypeRequiredDescription
namestringYesDisplay name for the scenario. Shown in the pd4castr UI.
keystringYesStable identifier for this sensitivity. Must be lowercase alphanumeric (with hyphens/underscores). Must be unique within the model.
querystringYesPath to a SQL file that transforms the input data.

Here’s an example sensitivity that increases demand by 10%:

{
  "sensitivities": [
    {
      "name": "High Demand (+10%)",
      "key": "high-demand",
      "query": "queries/sensitivities/high-demand.sql"
    }
  ]
}

The SQL file at queries/sensitivities/high-demand.sql might look like this:

UPDATE input_data
SET demand = demand * 1.10

Where the data in the table named input_data in this case would correspond to an input with the key of input_data.

Viewing Sensitivity Results

Sensitivity runs appear as toggleable options in the pd4castr UI. When enabled, the sensitivity forecast overlays on the main chart alongside the base forecast, making it easy to compare scenarios visually.

Next Steps

  • Learn about Input aggregations to display summary views of input data alongside forecast results.
  • See the Configuration file reference for all sensitivity fields.
  • Learn about Run modes and scheduling to understand how sensitivity runs are triggered alongside base runs.