# Contents

# Context

#### Analysis | Report | Target Analysis | Contribution Analysis

**Contribution Analysis** was first designed to be used in the context of marketing mix analysis. It used counterfactuals for measuring the added value of each driver on the target variable (*e.g.* Sales) over the entire analyzed period (by using the model), as well as for each observation, *i.e.* each line in the dataset.

In the initial version, the contributions of each driver were computed using the following two counterfactuals:

**Model**:*What would have been the mean value of the target, had the driver been set to its min value, instead of its marginal probability distribution, all the other confounders being hold to their marginal probability distributions?***Data**(for each observation):*What would have been the mean value of the target, had the driver been set to its**min value*, instead of the state in which it was observed, all the other confounders being set to their observed states?

# New Feature: Neutral State

For each driver,** **counterfactuals are now based on a specified **Neutral State** as opposed to the *minimum* value of the driver*.* By default, the minimum ** Value **of drivers is used as their **Neutral State.** However for some drivers, the minimum value may not reflect the neutral condition of a system. For instance, the lowest temperature ever recorded would not be an appropriate neutral condition of a domain. Rather, the average temperature might be a better **Neutral State**.

The ** Reference State **, which was first introduced in BayesiaLab 5.1, can now be used to specify the *Neutral State* of a driver.

# New Feature: Type I and Type II Contributions

The measure of a driver's contribution is highly sensitive to the conditions used in the counterfactual:

- the state of the driver,
- the states of all the other confounders.

There are then multiple ways to compute contributions.

In the initial version of ** Contribution Analysis** , the estimations were based on what we call now **Type I Contribution** , * i.e.:*

*Neutral State*state for the driver- observed values for the confounders.

We introduce in this new BayesiaLab release** Type II Contribution**, which is based on the following counterfactuals:

**Model**:*What would have been the mean value of the target, had all the other confounders being set to their**Neutral States,*the driver being hold to its marginal probability distribution?**Data**(for each observation):*What would have been the mean value of the target, had all the other confounders been set to their**Neutral States,**the driver being set to its observed state?*

*i.e.:*

- observed value for the driver
*Neutral States*for the confounders

As illustrated in the examples below, the divergence between the results of these two types of contributions is directly dependent on the kind of relation that links the confounders and the target.

**Example**

Let's use the following network made of 3 drivers and one target variable.

We will use 3 different deterministic functions to define the *Sales* value based on the driver values: *Sum(), Max(), *and* Min(),* and illustrate how to compute the **Model Contributions** for *TV.*

Note

Sales = Sum(Radio, Online, TV)

Counterfactual: *What would have been the value of Sales, had TV been set to 0, instead of its marginal probability distribution (all the other confounders being hold to their marginal probability distributions)?*

Setting *TV* to 0 reduces *Sales* by 0.488.

The **Model D** **ecomposition** for *TV* is:

Initial Value of *Sales* - Final Value of *Sales = 1.479 - 0.991 = 0.488*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales = 0.488/1.479 = 33%*

Counterfactual:* What would have been the mean value of Sales, had all the other confounders being set to 0 (the driver being hold to its marginal probability distribution)? *

Setting *TV* to its original marginal probability distribution and setting all the other drivers to 0 increases the *Sales* by 0.512.

The **Model D** **ecomposition** for *TV* is:

Final Value of *Sales - *Value of *Sales* given all the drivers set to 0 *= 0.512 - 0 = 0.512*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales =* *0.512/1.479 = 34%*

Sales = Max(Radio, Online, TV)

Counterfactual: *What would have been the value of Sales, had TV been set to 0, instead of its marginal probability distribution (all the other confounders being hold to their marginal probability distributions)?*

Setting *TV* to 0 reduces *Sales* by 0.054.

The **Model D** **ecomposition** for *TV* is:

Initial Value of *Sales* - Final Value of *Sales = 0.662 - 0.608 = 0.054*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales = 0.054 */

*0.662*=

*8%*

Counterfactual:* What would have been the mean value of Sales, had all the other confounders being set to 0 (the driver being hold to its marginal probability distribution)? *

Setting *TV* to its original marginal probability distribution and setting all the other drivers to 0 increases the *Sales* by 0.5.

The **Model D** **ecomposition** for *TV* is:

Final Value of *Sales - *Value of *Sales* given all the drivers set to 0 *= 0.5 - 0 = 0.5*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales =* *0.5/ 0.662 = 75%*

Sales = Min(Radio, Online, TV)

Counterfactual: *What would have been the value of Sales, had TV been set to 0, instead of its marginal probability distribution (all the other confounders being hold to their marginal probability distributions)?*

Setting *TV* to 0 reduces *Sales* by 0.337.

The **Model D** **ecomposition** for *TV* is:

Initial Value of *Sales* - Final Value of *Sales = 0.337 - 0 = 0.337*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales =* *0.337/0.337 = 100%*

Counterfactual:* What would have been the mean value of Sales, had all the other confounders being set to 0 (the driver being hold to its marginal probability distribution)? *

Setting *TV* to its original marginal probability distribution and setting all the other drivers to 0 does not change *Sales.*

The **Model D** **ecomposition** for *TV* is:

Final Value of *Sales - *Value of *Sales* given all the drivers set to 0 *= 0 - 0 = 0*

The **Model Contribution** is:

Model Decomposition / Initial Value of *Sales =* *0%*

# New Feature: Base

In classical Linear Regression models, there are usually two additional terms in the function that links the Target and the Drivers:

- the
**Intercept**, the Target value when all the Drivers are set to 0 - the
**Error**, the difference between the observed value of the Target and its predicted value.

A **Base** contribution is now available in the **Contribution Analysis** tool. The objective is to combine the **Intercept** and the **Error** terms.

The **Base mean** is computed by setting all the Drivers (*i.e.* all the confounders that are observable) to their *Neutral State*, while

**Model**: holding fixed all the probability distributions of the confounder variables that are**Not Observable****Data****Not Observable**

The initial contribution of the **Base** is then defined by:

*Base Contribution = Base Mean / Initial Target Value *

Note

The *Base mean* is used in **Type II Contribution** for computing the decompositions:

*D = Final Target Value - Base mean*

Note

The *Base mean* is also used in the computation of the **Contributions** (denominator)

*d = Initial Target Value - Base mean*

**Example**

Let's take back the Sum model we previously used for illustrating **Type I **and** II Contributions.** Let's suppose *Online* is beyond our control. We then set this confounder variable as* Not Observable. *

Setting the Drivers to 0 while holding fixed the probability distribution of *Online *returns a Sales value of 0.512.

The (Model) Base mean is then equal to 0.512, and its contribution is:

Base mean / Initial Value of *Sales = 0.512/1.479 = 33%*

Setting *TV* to its original marginal probability distribution and setting all the other drivers to 0 increases the *Sales* by 0.479.

The **Model D** **ecomposition** for *TV* is:

Final Value of *Sales - Base Mean* *= 0.991 - 0.512 = 0.479*

The **Model Contribution** is:

Model Decomposition / (Initial Value of *Sales - *Base Mean*) =* *0.479/0.967 = 50%*

# New Feature: Mean Contribution and Normalization

Four different contributions are now available for each driver: **Type I** and **Type II**, computed with the model and the data.

The three examples we used to illustrate **Type I** and **Type II** clearly show that **Type I** returns an underestimated contribution for *Max* type functions and an overestimated contribution for *Min* type functions. Conversely, **Type II** returns an underestimated contribution for *Min* type functions and an overestimated contribution for *Max* type functions. These two measures are only identical for the *Sum* type function.

The Mean Driver Contribution combines **Type I** and **Type II** by averaging the computed contributions.

* Mean Contribution = (Type I + Type II) / 2 *

When the sum of all the drivers's contributions and the Base contribution is greater than 1, all the contributions are normalized to get a final sum equal to 1.

For each observation of the dataset, the mean contribution of each driver is equal to:

* Mean Contribution = (Type I + Type II) / 2 *

When the sum of all the drivers's contributions and the Base contribution is greater than 1, all the contributions are normalized to get a final sum equal to 1.

When this sum is lower than 1, the complement to one is added to the Base contribution.

The Final Mean Contribution of a Driver is the average of its normalized contributions:

*Final Mean Contribution = (Mean Contribution Model + Mean Contribution Data) / 2*

After computing the sum of all the final driver mean contributions, the Final Base Contribution is defined as (1 - sum).

**Example**

Let's take again the network with the Sum function.

# Update Feature: CSV File

Setting an output file allows saving the **Decompositions** and **Contributions** in a CSV file for every single observation, *i.e.* each line in the database.

This report comes now with:

- the Normalized Base and Drivers' Mean Contributions
**Type I**Normalized Decompositions and Contributions**Type II**Normalized Decompositions and Contributions

**Example**

# New Feature: Curves

**Curves** allows generating a *Stacked Curves Graph* that illustrates, for each observation, the normalized Base and Drivers' Mean Contributions.

**Example**

- The X-axis corresponds to the observations read in the original dataset
- The Y-axis is the value of the
*Target* - The first curve corresponds to the Base contribution for each observed
*Target*value*:*

- The curves corresponding to the
*Drivers*contributions are then stacked up as follows:

- The final curves corresponds to the observed Target Values .

Note: Curve Selection

Note: Highlighting Contributions

Note: Zooming

Note: Copy

# New Feature: Synergies

The purpose of this new measure is to compare the contributions of jointly used Drivers versus the sum of their particular contributions.

**Synergy** computations are based on **Type II** contributions (model and data), and the search is restricted to pair of Drivers only.

The following counterfactuals are then used:

**Model**:*What would have been the mean value of the target, had all the other confounders being set to their**Neutral States,*the pair of analyzed drivers being hold to their marginal probability distributions?**Data**(for each observation):*What would have been the mean value of the target, had all the other confounders been set to their**Neutral States,**the pair of drivers being set to their observed states?*

**Example**

Let's use the following network made of 3 drivers and one target variable.

We will use two different deterministic functions to define the *Sales* values based on the drivers: *SumMin() * and * SumMax() , * and illustrate how to compute the

**Synergy**between

*Online*and

*Radio*.

Sales = Sum(Min(Online, Radio), TV)

Setting *Online* to its original marginal probability distribution does not change the *Sales* value. The **Decomposition** and **Contribution** are then equal to 0.

These values are identical for *Radio.*

Setting *Online* and *Radio *to their original marginal probability distributions increases the *Sales* value by 0.407.

The **Model Synergy Decomposition** for *Online-Radio* is:

Final Value of *Sales - *Base Mean - Decomposition_Online - Decomposition_Radio *= 0.407 - 0 - 0 - 0 = 0.407*

The **Model Synergy** for *Online-Radio* is:

*Sales -*Base Mean)

*=*

*0.407/0.885 = 46%*

Sales = Sum(Max(Online, Radio), TV)

Setting *Online* to its original marginal probability distribution increases the *Sales* by 0.512.

The **Model D** **ecomposition** for *Online* is:

Final Value of *Sales - Base Mean* *= 0.512 - 0 = 0.512*

The **Model Contribution** is:

Model Decomposition / (Initial Value of *Sales - * Base Mean) * * *=* *0.512/1.097 = 46%*

Again, these values are identical for *Radio.*

Setting *Online* and *Radio *to their original marginal probability distributions increases the *Sales* value by 0.617.

The **Model Synergy Decomposition** for *Online-Radio* is:

Final Value of *Sales - *Base Mean - Decomposition_Online - Decomposition_Radio *= 0.617 - 0 - 0.512 - 0.512 = -0.407*

The **Model Synergy** for *Online-Radio* is:

*Sales -*Base Mean)

*=*-

*0.407/1.097 = -37%*