Throughout my studies in psychology, teachers continuously repeat the sentence that now has became a dogma:
Correlation is not Causation!
Apart from this mantra, we had no more information on what is causality and how to identify it. At least, the field presented to achieve this was experimental psychology with its tool, the experiment. The goal? Develop experiments in which factors influencing the measured variable (Dependent Variable; DV), e.g. performance at a task are controlled and therefore do not impact the DV. The expected outcome is that only the manipulated variable (Independent Variable; IV) impacts the VD.
During my journey, however, I have been able to collect a few cases in which experimental psychology does not apply, badly apply or suffer from bias. For example, what to do if you realize that a factor, not measured, influences nevertheless your results ? And in case you cannot manipulate your variable of interest, what to do if you can only observe it?
Causal inference can solve these problems. In addition, alongside Bayesian statistics, it offers a powerful tool to solve most cases. In 2022, I discover causality thanks to the Videos of Richard McElreath. Very quickly fascinated by this new method, I immerse myself in the books of Judea Pearl: The Book of Why (Do not ask, just read it), Causal Inference in Statistics: A Primer, and the very hefty Causality. I discovered Pearl’s causality ladder which presents three levels that I detail below:
Level 1: Observation
This first level is characterized by observation. we notice a regularity in the occurrence of two events. We therefore want to associate them and draw causal conclusions on their co-occurrence of one or the other event. This is the method that causes the most allocation errors. This allocation bias is very often used by conspiracy theorists who see X, then Y and infer that X causes Y. Artificial intelligence, too, operates at this level: it notices patterns that are certainly very complex, but it sticks at the observation level and make a prediction.
Typical question: If I see X, then Y?
Example (Taken from The Book of Why): If someone buy toothpaste, do they also buy dental floss?
Level 2: Intervention
The second level stipulates that we are capable to intervene on the system and observe the impact of our intervention. As you already understood, this is exactly in this level that we find our experiments. It therefore makes it possible to confirm or deny a previous observation. We also do this commonly in everyday life: I have a headache, I take an aspirin and check if my headache disappears or not.
Typical question: If I do X, what becomes of Y?
Example: If I double the price of the toothpaste, what impact has it on our dental floss sales?
Level 3: Counterfactual
The highest level calls for counterfactual thoughts. We use this way of thinking everywhere and all the time and this since about 2 years old: we explore the world by imagining alternative scenarios where the cause is absent. We then imagine that the supposed effect wouldn’t have been there neither.
Typical question: If I had done X, what becomes of Y?
Example: If I had doubled the price of toothpaste, how our dental floss sales would have performed?
A real example
This last step was particularly useful in identifying the effect of an uncontrolled experiment. Indeed, having worked on indoor visual comfort, it is not always easy to set up control conditions, particularly in real environments.
What we had done to limit the inconvenience for the employees working in the building, is to measure the lighting system before our intervention. Then, we set up our new system for controlling the lighting for some time and kept measuring consumption.
The counterfactual question In my case is therefore: what would have happened if we nnot installed this new system?
Thanks to Pymc, I built a model on electricity consumption before our intervention. This model represents the normal flow during weeks. It thus allows to evaluate the impact of our new system, as shown by the picture below.

If you also want to create a similar model, do not hesitate to contact me!
