Skip to content

HIAlab/sinot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License

Simulation of N-of-One Trials (SiNOT)

Table of Contents

About The Project

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.

Built With

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.

Getting Started

Here you can see, how to use the library.

Prerequisites

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:

Installation

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.

  1. Clone the repo
git clone https://github.com/thogaertner/n-of-1-simulation
  1. Install package with pip
pip install -e path_to_project

Usage

Create Study Parameters

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)

Simulate Data

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)

Tutorial

A complete Tutorial with all parameters of simulation data cam be found in example/Tutorial.ipynb.

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Thomas Gärtner - Linked In - thomas.gaertner[at]hpi.de

Project Link: https://www.github.com/HIAlab/sinot

Acknowledgements

Thanks to everyone, who supported this project!

About

In this project I created python scripts and functions to simulate n of 1 studies based on given parameters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published