|
2 | 2 | Causal Specification |
3 | 3 | ===================== |
4 | 4 |
|
5 | | -- In causal testing, our units of interest are specific usage **scenarios** of the system-under-test. For example, |
6 | | - when testing an epidemiological computational model, one scenario could focus on the simulation of the spread of a virus in a crowded indoors space. |
7 | | - For this scenario, our causal specification will describe how a number of interventions should **cause** some outputs to change e.g. opening a window should reduce the spread of the virus by some factor. |
8 | | - |
9 | | -- In order to isolate the causal effect of the defined interventions, the user needs to express the anticipated cause-effect relationships amongst the inputs and outputs involved in the scenario. |
10 | | - This is achieved using a causal DAG, a simple dot and arrow graph that does not contain any cycles where nodes are random variables that represent the |
11 | | - inputs and outputs in the scenario-under-test, and edges represent causality. For example, ``window --> infection_prob`` encodes the belief that opening or closing the |
12 | | - window should cause the probability of infection to change. |
13 | | - |
14 | | -- A causal specification is simply the combination of these components: a series of requirements for the scenario-under-test and a causal DAG representing causality |
15 | | - amongst the inputs and outputs. |
16 | | - |
17 | | -- Collectively, the components of the causal specification provide both contextual information in the form of constraints and requirements, as well as causal information in the form of a causal DAG. |
18 | | - It's these components that are used to design statistical experiments that can answer causal questions about the scenario-under-test. |
| 5 | +As in traditional software testing, the specification defines the expected behaviour of the system. |
| 6 | +In causal testing, this is made up of two components: the modelling scenario and the causal graph. |
| 7 | +These components are then used to design statistical experiments that can answer causal questions about the system-under-test. |
19 | 8 |
|
20 | 9 | 1. Modelling Scenario |
21 | | ----------------------- |
| 10 | +--------------------- |
22 | 11 |
|
23 | | -- Each scenario is defined as a series of constraints placed over a set of input variables. A constraint is simply a mapping |
24 | | - from an input variable to a specific value or distribution that characterises the scenario in question. |
25 | | - For example, a scenario simulating the spread of a virus in a crowded indoors space would likely place a constraint over the size of room, |
26 | | - the number of windows, and the number of people in the room. |
| 12 | +- In causal testing, our units of interest are specific usage **scenarios** of the system-under-test. |
| 13 | + For example, when testing an epidemiological computational model, one scenario could focus on the simulation of the spread of a virus through a population. |
| 14 | + For this scenario, we may then test how a number of interventions should **cause** some outputs to change e.g. vaccinations should reduce the total number of deaths. |
| 15 | + |
| 16 | +- Each scenario is defined as a series of constraints placed over a set of input variables. |
| 17 | + A constraint is simply a mapping from an input variable to a specific value or distribution that characterises the scenario in question. |
| 18 | + For example, a scenario simulating the spread of a virus would likely place constraints on the location, population demographics, and who is vaccinated. |
27 | 19 |
|
28 | 20 | - Requirements for this scenario should describe how a particular intervention |
29 | | - (e.g. opening the window, changing the number of people, changing the size of the room etc.) is expected to cause a particular outcome (number of infections, deaths, R0 etc.) to change. |
| 21 | + (e.g.changing the number of people, changing who is vaccinated, etc.) is expected to cause a particular outcome (number of infections, deaths, R0, etc.) to change. |
30 | 22 | The way these requirements are expressed is up to the user, however, it is essential that they focus on the expected effect of an intervention. |
31 | 23 |
|
32 | | -2. Causal DAG |
33 | | --------------- |
| 24 | +2. Causal Graph |
| 25 | +--------------- |
34 | 26 |
|
| 27 | +To isolate the causal effect of the defined interventions, the user needs to express the anticipated cause-effect relationships amongst the inputs and outputs involved in the scenario. |
| 28 | +This is done using a directed acyclic graph (DAG) in which nodes represent variables in the system and edges represent causal effects. |
35 | 29 | In order to apply CI techniques, we need to capture causality amongst the inputs and outputs in the scenario-under-test. |
36 | 30 | Therefore, for each scenario, the user must define a causal DAG. |
37 | | -As an example, consider the DAG shown below for the `Poisson Line Process example. <https://github.com/CITCOM-project/CausalTestingFramework/tree/main/examples/poisson-line-process>`_ |
38 | | -Here, the model has three inputs: ``width``, ``height``, and ``intensity``. |
39 | | -These inputs control the number of lines (``num_lines_abs``) and polygons (``num_shapes_abs``) that are drawn, which then feed into the numbers of lines (``num_lines_unit``) and polygons (``num_shapes_unit``) per unit area. |
40 | | -Note though that the ``num_lines_abs`` does not have a direct causal effect on ``num_shapes_unit``, since the number of polygons per unit area is defined entirely by the total number of polygons and the area of the sampling window. |
| 31 | + |
| 32 | +As an example, consider the DAG shown below for the `vaccinating the elderly example. <https://github.com/CITCOM-project/CausalTestingFramework/tree/main/examples/covasim_/vaccinating_elderly>`_ |
| 33 | +This modelling scenario has two inputs `vaccine` and `max_doses` and three outputs `cum_vaccinations`, `cum_vaccinated`, and `cum_infections`. |
| 34 | +We do not expect `max_doses` to have a causal effect on any of the outputs since this remains constant throughout modelling scenario. |
41 | 35 |
|
42 | 36 | .. container:: zoom-container |
43 | 37 |
|
44 | | - .. image:: ../../../examples/poisson-line-process/dag.png |
| 38 | + .. image:: ../../../examples/covasim_/vaccinating_elderly/dag.png |
45 | 39 | :class: zoomable-image |
46 | | - :alt: Schematic diagram of the Poisson Line Process DAG |
| 40 | + :alt: Causal DAG of the vaccinating the elderly modelling scenario |
47 | 41 |
|
48 | | -.. literalinclude:: ../../../examples/poisson-line-process/dag.dot |
| 42 | +.. literalinclude:: ../../../examples/covasim_/vaccinating_elderly/dag.dot |
49 | 43 | :language: graphviz |
50 | | - :caption: **Figure:** Example Causal DAG for the Poisson line process example. |
| 44 | + :caption: **Figure:** Example Causal DAG for the vaccinating the elderly example. |
51 | 45 |
|
52 | 46 | .. raw:: html |
53 | 47 |
|
|
0 commit comments