Python module that runs causal inference experiments, implementing procedures as outlined in the paper Staggered Rollout Designs Enable Causal Inference Under Interference Without Network Knowledge .
.
├── experiment
│ ├── estimators.py
│ ├── rct.py # randomised control trials
├── model
│ ├── graph.py # OOP graph implementations
│ ├── graphs.py # basic graph implementations
│ ├── pom.py # potential outcome models
├── plots # storage of experiment plots
├── runners # experiment run files
│ ├── experiment.py # univariate experiment
│ ├── main_experiment_two-stage.py # TODO
│ ├── modular_experiment.py # TODO
│ ├── parallel_experiment.py # TODO
└── tests # unit tests
To get started, first clone and install the necessary requirements using the following command:
git clone [email protected]:a3yu/causal_inference.git
Make sure you are in a Python >=3.8 environment.
(Optional): create a Python virtual environment to isolate your dependencies for this repository, then activate it:
python3 -m venv venv
source venv/bin/activate
Navigate to your local repository and install dependencies:
python3 -m pip install -r requirements.txt
To run a univariate experiment, simply run python3 runners/experiment.py
and edit the run_experiment(), sample usage, and plotting fields accordingly.
One iteration of an experiment:
- first, generate a graph using a specified graph model (SBM, ER, etc).
- Use a specified potential outcomes model (e.g. polynomial POM) to compute the total treatment effect and a function to produce outcomes on the graph based on a treatment tensor.
- Compute a treatment tensor based on a randomised control trial (e.g. staggered Bernoulli).
- Compute a TTE estimate using a specified estimator (e.g. polynomial estimate) using the above treatment and outcome tensors.
- Repeat this above process over varying time steps (t) and over varying number of repetitions (r), and compute the bias and variance of the estimate vs the true TTE.