gen_surv
gen_surv is a Python package for simulating survival data under a variety of models, inspired by the R package genSurv. It supports data generation for:
- Cox Proportional Hazards Models (CPHM)
- Continuous-Time Markov Models (CMM)
- Time-Dependent Covariate Models (TDCM)
- Time-Homogeneous Hidden Markov Models (THMM)
📦 Installation
poetry install
✨ Features
- Consistent interface across models
- Censoring support (
uniformorexponential) - Easy integration with
pandasandNumPy - Suitable for benchmarking survival algorithms and teaching
🧪 Example
from gen_surv.cphm import gen_cphm
df = gen_cphm(
n=100,
model_cens="uniform",
cens_par=1.0,
beta=0.5,
covar=2.0
)
print(df.head())
from gen_surv import generate
df = generate(
model="cphm",
n=100,
model_cens="uniform",
cens_par=1.0,
beta=0.5,
covar=2.0
)
print(df.head())
🔧 Available Generators
| Function | Description |
|---|---|
gen_cphm() |
Cox Proportional Hazards Model |
gen_cmm() |
Continuous-Time Multi-State Markov Model |
gen_tdcm() |
Time-Dependent Covariate Model |
gen_thmm() |
Time-Homogeneous Markov Model |
genSurvPy/
├── gen_surv/ # Pacote principal
│ ├── __main__.py # Interface CLI via python -m
│ ├── cphm.py
│ ├── cmm.py
│ ├── tdcm.py
│ ├── thmm.py
│ ├── censoring.py
│ ├── bivariate.py
│ ├── validate.py
│
├── tests/ # Testes automatizados
│ ├── test_cphm.py
│ ├── test_cmm.py
│ ├── test_tdcm.py
│ ├── test_thmm.py
│
├── examples/ # Exemplos de uso
│ ├── run_cphm.py
│ ├── ...
│
├── pyproject.toml # Configurado com Poetry
├── README.md
├── LICENSE
├── .gitignore
🧠 License
MIT License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gen_surv-0.6.3.tar.gz
(7.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
gen_surv-0.6.3-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file gen_surv-0.6.3.tar.gz.
File metadata
- Download URL: gen_surv-0.6.3.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.0.0 CPython/3.9.13 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f0a4651bc9c0c34a1369fc37861f9d9a02bafaecaf008c7553172593a4c711f
|
|
| MD5 |
d2ceacd02dd68e53162634a774a25a37
|
|
| BLAKE2b-256 |
d503babbee101e1b540ce19b7858c7db107fdb5a0be03fd4291fde4f1ee8027f
|
File details
Details for the file gen_surv-0.6.3-py3-none-any.whl.
File metadata
- Download URL: gen_surv-0.6.3-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.0.0 CPython/3.9.13 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3317abdc95d1a853127ee9dce1c4c221e1bcb9ed95bb8219ac598a63d932eb1
|
|
| MD5 |
4e73e6d9ef01d739489d20d5304e3e32
|
|
| BLAKE2b-256 |
7bd78494de4ac7d62845883ec4525f90868a4dc2e5776965a2c7ce2f5797c3dc
|