The project started with a master thesis on analysing causal effects in N of 1 studies. Unfortunately there was no library available, which meets the needs. Hence, this package was created. Within this package, data of N-of-1 studies could be created though a DAG file and a configuration file. A preprint of the related publication could be found on medRxiv.
This project is build on python 3.8
and is using following libraries:
- Numpy
- Pandas
- (Matplotlib)
For detailed description you can have a look into pyproject.toml
.
Here you can see, how to use the library.
Python is required for this package. For that, I used anaconda and created my own environment with in it. Afterwards I installed all requirements within this environment with:
You can directly install the current version:
pip install --upgrade https://github.com/HIAlab/sinot/tarball/master
Alternativly, you can clone the repo and install it with binding to the repo.
- Clone the repo
git clone https://github.com/thogaertner/n-of-1-simulation
- Install package with pip
pip install -e path_to_project
This project consists of 2 functions. The first one is create_study_parameters
. It transforms a DAGitty text file into the parameter file.
A DAGitty text file could be found at ./example/parameter/dagitty_example.txt
.
A study parameter file out.json
could be created by using:
python ./src/sinot/create_study_params.py ./example/parameter/dagitty_example.txt ./example/parameter/out.json
For further information checkout --help
.
Alternativly you can directly use the function create_study_params
from sinot.create_study_params
. It returns a json file containing all dependencies from your dag with default parameters:
from sinot.create_study_params import create_study_params
dagitty_file = "path_to_your_file"
study_params = create_study_params(dagitty_file)
To simulate data, you use the class sinot.Simulation
to create a cohort based on a parameters file.
from sinot.Simulation import Simulation
sim = Simulation(study_params)
pat_complete, pat_drop = sim.gen_patient(study_design, days_per_period, drop_out=drop_out)
A complete Tutorial with all parameters of simulation data cam be found in example/Tutorial.ipynb
.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Thomas Gärtner - Linked In - thomas.gaertner[at]hpi.de
Project Link: https://www.github.com/HIAlab/sinot
Thanks to everyone, who supported this project!