---
title: "Causal Model for COVID-19 vaccine effectiveness assessment"
title-prefix: "BY-COVID WP5"
pagetitle: "baseline use case"
authors: "Marjan Meurisse, Francisco Estupiñán-Romero, Nina Van-Goethem, Enrique Bernal-Delgado"
date: '2022-07-27'
format: 
  html:
    df-print: paged
    code-fold: true
    code-summary: "Show the code"
    code-overflow: wrap
    toc: true
    toc-location: left
    fig-cap: true
    fig-cap-location: bottom
    fig-width: 12
    fig-height: 8
execute: 
  warning: false
keywords: COVID-19, vaccines, effectiveness, causal inference
licence: CC BY-NC
self-contained: true
# bibliography: references.bib
editor: visual
---

![](BYCOVID_logo.png){fig-alt="BY-COVID project logo"}

## BY-COVID project

BeYond-COVID ([BY-COVID](https://by-covid.org/ "BY-COVID project website")) aims to provide comprehensive open data on SARS-CoV-2 and other infectious diseases across scientific, medical, public health and policy domains. It will strongly emphasise mobilising raw viral sequences, helping to identify and monitor the spread of SARS-CoV-2 variants. The project will further accelerate the access to SARS-CoV-2 and COVID-19 data, and the linkage of these data to patient and research data.

To ensure interoperability of national and global efforts, BY-COVID will enable federated data analysis compliant with data protection regulations, harmonise and manage metadata and sample identifiers, and facilitate long-term cataloguing.

Ultimately, it will improve European preparedness for future pandemics, and enhance genomic surveillance and rapid-response capabilities. In addition, BY-COVID serves as a demonstrator of interdisciplinary work across country borders. The project's outputs will allow scientists across multiple domains (including SMEs and industry) to access varied data, with the potential to generate new knowledge on infectious diseases.

## WP5 - Use Cases

[Work Package 5](https://by-covid.org/about#structure "WP5 - Use Cases") will demonstrate usability of BY-COVID services across disciplines and national borders through continuously evolving demonstrator projects or Use Cases. For instance, the proposed baseline use case will assess the effectiveness of SARS-CoV-2 vaccines against SARS-CoV-2 infection using real-world data, improving the understanding of the determinants of the public health response.

**WP leaders:** [Nina Van Goethem](https://orcid.org/%200000-0001-7316-6990 "ORCID Nina Van Goethem") (Sciensano), [Enrique Bernal-Delgado](https://orcid.org/0000-0002-0961-3298 "ORCID - Enrique Bernal-Delgado") (IACS)

### Baseline Use Case

#### "*Real-world effectiveness of SARS-CoV-2 primary vaccination against SARS-CoV-2 infection*"

#### **Research Question: "***How effective has SARS-CoV-2 vaccination been in preventing SARS-CoV-2 infection?*"

**Intervention (exposure):** SARS-CoV-2 vaccine(s) <br /> **Outcome:** SARS-CoV-2 infection

### Study Design

Observational retrospective longitudinal study to assess the effectiveness of the SARS-CoV-2 vaccine(s) preventing SARS-CoV-2 infections using routinely collected demographic, social, health and care data from several European regions.

A causal model was established using **Directed Acyclic Graphs (DAGs)** to map domain knowledge, theories and assumptions about the causal relationship between exposure and outcome. The DAG developed for the research question of interest is shown below.

This causal model was initially created using the [DAGitty](http://www.dagitty.net/) online tool *v.3.0*.[^1]

[^1]: Johannes Textor, Benito van der Zander, Mark K. Gilthorpe, Maciej Liskiewicz, George T.H. Ellison. Robust causal inference using directed acyclic graphs: the R package 'dagitty'. International Journal of Epidemiology 45(6):1887-1894, 2016.

```{r}
# |label: baseline-usecase-dag


## Load requiered packages ####
pacman::p_load(dagitty, ggdag, ggplot2, dplyr)

## Declare the DAG for the baseline use case causal model ####
## Create dagitty object ####
dag <- dagitty::dagitty(
  'dag {
"Essential worker" [adjusted,pos="-0.340,0.325"]
"Immune status" [adjusted,pos="-0.730,-0.374"]
"Institutionalized people" [adjusted,pos="-0.370,-1.283"]
"Previous infection" [adjusted,pos="-0.631,-1.088"]
"Residence area" [adjusted,pos="0.540,0.587"]
"SARS-CoV-2 Infection" [outcome,pos="0.925,-0.145"]
"Vaccine(s)" [exposure,pos="-0.559,-0.113"]
Age [adjusted,pos="0.437,-1.315"]
Comorbidities [adjusted,pos="-0.012,-1.304"]
Country [adjusted,pos="-0.005,0.863"]
Foreign [adjusted,pos="-0.551,0.866"]
Pregnancy [adjusted,pos="0.516,-0.900"]
Sex [adjusted,pos="0.626,-1.318"]
"Essential worker" -> "SARS-CoV-2 Infection"
"Essential worker" -> "Vaccine(s)"
"Immune status" -> "SARS-CoV-2 Infection"
"Immune status" -> "Vaccine(s)"
"Institutionalized people" -> "Previous infection"
"Institutionalized people" -> "SARS-CoV-2 Infection"
"Institutionalized people" -> "Vaccine(s)"
"Previous infection" -> "Immune status"
"Previous infection" -> "SARS-CoV-2 Infection"
"Previous infection" -> "Vaccine(s)"
"Residence area" -> "SARS-CoV-2 Infection"
"Residence area" -> "Vaccine(s)"
"Vaccine(s)" -> "SARS-CoV-2 Infection"
Age -> "SARS-CoV-2 Infection"
Age -> "Vaccine(s)"
Age -> Comorbidities
Age -> Pregnancy
Comorbidities -> "Immune status"
Comorbidities -> "Institutionalized people"
Comorbidities -> "SARS-CoV-2 Infection"
Comorbidities -> "Vaccine(s)"
Country -> "Essential worker"
Country -> "Residence area"
Foreign -> "SARS-CoV-2 Infection"
Foreign -> "Vaccine(s)"
Pregnancy -> "SARS-CoV-2 Infection"
Sex -> "SARS-CoV-2 Infection"
Sex -> "Vaccine(s)"
Sex -> Age
Sex -> Pregnancy
}')


```

#### Structural Causal Model (DAG) (simple)

The structural causal model uses a directed acyclic graph (DAG) to map the causal relation between an intervention (*or exposure*) and an outcome, in the presence of other relevant entities that can potentially act as confounders.

```{r}
# |label: figure-dag
# |fig-width: 12
# |fig-cap: COVID-19 vaccine(s) effectiveness causal model.
# |fig-subcap: Simple DAG

## Plot dagitty object ####
# plot(dag)

## Plot DAG using ggdag ####
ggdag_status(dag, text = FALSE, use_labels = "name",
             layout = "nicely") +
  guides(color = "none") +  # Turn off legend
  theme_dag()
```

#### Structural Causal Model (DAG) (complete)

The complete structural model shows which entities we need to adjust for enabling causal inference and estimating the impact of the intervention in terms of the outcome for the population.

```{r}
# |label: figure-dag-adjustment-set
# |fig-width: 12
# |fig-cap: COVID-19 vaccine(s) effectiveness causal model
# |fig-subcap: Complete DAG

## Plot Asjustment Set using ggdag ####
ggdag_adjust(dag, use_labels = "name", 
                     text = FALSE, stylized = TRUE) + 
  theme_dag(legend.position = "bottom")

```

#### Minimal adjustment set (entities)

The minimal adjustment set includes the entities required for adjustment in our model.

```{r}
# |label: adjustment-set
adjustmentSets(dag, type = 'minimal', effect = 'total')

```

All entities in the structural causal model are included in the accompanying **common data model (CDM)** for the baseline use case.

<!-- ### References -->

<!-- ::: {#refs} -->

<!-- ::: -->
