https://github.com/scai-bio/pytmle
A Flexible Python Implementation of Targeted Estimation for Survival and Competing Risks Analysis
https://github.com/scai-bio/pytmle
Last synced: 7 days ago
JSON representation
A Flexible Python Implementation of Targeted Estimation for Survival and Competing Risks Analysis
- Host: GitHub
- URL: https://github.com/scai-bio/pytmle
- Owner: SCAI-BIO
- License: apache-2.0
- Created: 2025-04-15T10:40:39.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-05-08T09:01:35.000Z (15 days ago)
- Last Synced: 2025-05-08T10:19:47.332Z (15 days ago)
- Language: Python
- Size: 8.22 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyTMLE
`PyTMLE` is a flexible Python implementation of the Targeted Maximum Likelihood Estimation (TMLE) framework for survival and competing risks outcomes.
The package can be installed from PyPI, for example using `pip`:
```bash
pip install pytmle
```It is designed to be easy to use with default models for initial estimates of nuisance functions which are applied in a super learner framework. With a `pandas` dataframe containing event times, indicators, and (binary) treatment group information in specified columns, it is straight-forward to fit a main `PyTMLE` class object and get predictions and plots for selected `target_times`:
```pytmle
from pytmle import PyTMLEtmle = PyTMLE(df,
col_event_times="time",
col_event_indicator="status",
col_group="group",
target_times=target_times)tmle.plot(type="risks") # get estimated counterfactual CIF, or set to "rr" or "rd" for ATE estimates based on RR or RD
pred = tmle.predict(type="risks") # store estimates in a data frame
```However, it also allows for custom models to be used for the initial estimates or even passing initial estimates directly to the second TMLE stage.
Have a look at the package's [Read the Docs page](https://pytmle.readthedocs.io/) for the detailed API reference and tutorial notebooks.