# Calculating Contributions Using Causal Counterfactuals

Attribution and contribution often appear in a similar context, and both concepts are closely related to causality. In general, attribution identifies the cause of an observed outcome. In the marketing domain, however, attribution has a somewhat unique interpretation and often refers to the origin of a consumer’s journey towards a purchase. In this particular context, observed outcomes are attributed to specific prior touchpoints, such as website visits or ad clicks.

On the other hand, contribution, as the name implies, refers to the confluence of multiple factors or causes with regard to an effect. In the marketing context, multiple advertising campaigns and promotions, beyond just single touchpoints, would contribute to sales, for instance. So, the definition of contribution is reasonably straightforward.

The decomposition and quantification of the contributing causes is the problem. Plus, this challenge is not new, as this quote from the late 19th century suggests: “Half the money I spend on advertising is wasted; the trouble is, I don’t know which half” (no pun intended, but the attribution of this quote is uncertain). In other words, we do not know how promotional activities contribute to the outcome, i.e., sales. Conversely, calculating the contributions means that we proportionally allocate a given outcome to any number of potential causes.

### Calculating Contributions

While contribution appears to be rather straightforward in conceptual terms, a mathematical definition is not nearly as obvious.

We propose to distinguish between two types of contributions, which we shall call Type 1 and Type 2 Contributions. Both types rely on computing the difference between factual and counterfactual outcomes corresponding to factual and counterfactual conditions of multiple causes.

A factual outcome is simply an actual observation of an outcome, e.g., sales. Associated with a factual outcome are multiple causes at their observed, factual levels. A counterfactual outcome is the result of causes being set to hypothetical, counterfactual conditions. This begs the question as to how we can calculate a counterfactual outcome. We need to calculate the counterfactual outcome by simulating a counterfactual intervention using a causal model. In our case, we use a Bayesian network, which provides numerous advantages for our purposes.

### A Fictional Example

We introduce an elementary fictional domain with three causes and one outcome as an example. In fact, we make up the “laws of nature” and, thus, have perfect knowledge of this data-generating process (DGP).

From this generated data, we then machine learn a Bayesian network that approximates the joint probability distribution of the data as if we did not know the DGP. By default, of course, any machine-learned network would be non-causal. However, utilizing VanderWeele’s Disjunctive Cause Criterion for confounder selection, we can indeed utilize the learned Bayesian network for causal inference. Hence, we can simulate the effect of setting all three causes to counterfactual states. That choice, however, requires making assumptions from expert knowledge.

In this webinar, we perform machine learning with BayesiaLab and use its Likelihood Matching algorithm for causal inference computations. In addition to calculating contributions, we can determine the “baseline level” of the outcome variable and estimate synergies (positive and negative) between multiple causes.