Pair-based estimators of infection and removal times
Project description
Pair-based Estimators of Infection and Removal Rates
This Python package is an AI-translated version of the R package github.com/sdtemple/peirrs.
Install
From PyPI (recommended)
pip install peirrs
From source (development)
Install from the local source directory using pip:
pip install -e .
Requires NumPy and SciPy for numerical computations.
Requirements
This package requires Python 3.6+ with the following dependencies:
- NumPy 1.19+
- SciPy 1.5+
I developed the package with versions:
- Python 3.9+
- NumPy 2.0+
- SciPy 1.7+
Usage
Estimate infection and removal rates with partially observed removal and infection times. The following functions are the ones you would likely use, in order of relevance:
Real data analysis
peirrs.estimators.peirr_tau()- EM-based estimationpeirrs.estimators.peirr_bayes()- Bayesian estimation with MCMCpeirrs.estimators.peirr_bootstrap()- Bootstrap resamplingpeirrs.estimators.peirr_imputed()- Imputation-based estimation
Simulation experiments
peirrs.simulate.simulator()- Core simulation wrapper
All functions have docstrings. As a result, you can get help for instance with:
from peirrs.estimators import peirr_tau
help(peirr_tau)
print(peirr_tau.__doc__)
There are also functions with the suffixes _multitype() and _spatial() for estimators with multiple classes and spatial kernels, respectively:
Multitype estimators (in peirrs.multitype.estimators_multitype)
peirr_tau_multitype()- Class-specific EM estimationpeirr_bayes_multitype()- Class-specific Bayesian MCMCpeirr_bootstrap_multitype()- Class-specific bootstrap
Spatial tools (in peirrs.spatial)
peirr_tau_spatial()- Spatial EM estimationpeirr_bayes_spatial()- Spatial Bayesian MCMCsimulate_distance_matrix()- Generate spatial distance matricessimulator_spatial()- Spatial simulation wrapper
The peirr_bootstrap() function does not provide confidence intervals but rather bootstrap samples. You can perform bias correction or interval estimation according to Wikipedia.
Warning !!!
- I used AI chatbots to translate this from an R package.
- Mostly as a personal experiment ...
- PBLA functions are not available.
- Some light units tests are available.
- Except for complete data, the
_bayesfunctions are barely tested.
- Except for complete data, the
- Some spot reading resulted in:
- Manually fixes to the
utils.tau_momentfunction - Manually fixed to the
_bayesfunctions
- Manually fixes to the
- I checked that some simulation study results were similar.
- I checked for sensible results in a small IPython notebook.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file peirrs-1.0.0.tar.gz.
File metadata
- Download URL: peirrs-1.0.0.tar.gz
- Upload date:
- Size: 40.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20eebcbe3a4261494fcbbdb0422b31232e9796ff45126f2c7aadc93805491551
|
|
| MD5 |
969979d195f02ac6b2eb37970b0550b4
|
|
| BLAKE2b-256 |
47144ff66e47692e8407ff0d49b31db59bbdd59c1f8b7575352e4a2d96819006
|
File details
Details for the file peirrs-1.0.0-py3-none-any.whl.
File metadata
- Download URL: peirrs-1.0.0-py3-none-any.whl
- Upload date:
- Size: 45.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cb46f5125e76b61b9a3c35fd58ea3666c59db53678a59136d410666428f1126
|
|
| MD5 |
901cdcf348dd823025feb9d33278eaab
|
|
| BLAKE2b-256 |
9b3275a18c9f77e00420055a9ae39549d2682473c40daf97b53992ad29a3e085
|