Metadata-Version: 2.4
Name: predictr
Version: 0.1.37
Summary: Life Data Analysis for Reliability Engineers - Weibull Analysis, Detailed Plots, Compute Statistics
Home-page: https://tvtoglu.github.io/predictr/
Author: Tamer Tevetoglu
Author-email: predictr@outlook.com
Project-URL: Documentation, https://tvtoglu.github.io/predictr/classes/
Project-URL: GitHub, https://github.com/tvtoglu/predictr
Project-URL: Github Discussions, https://github.com/tvtoglu/predictr/discussions
Keywords: reliability,weibull,bias,life data analysis,engineering,confidence,bootstrap,monte-carlo,fisher bounds,likelihood ratio,unreliability,survival analysis,lifelines,testing,regression,accelerated failure time,cox proportional hazards,kaplan-meier,nelson-aalen,accelerated life testing,arrhenius
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.16.0
Requires-Dist: scipy>=1.3.0
Requires-Dist: pandas>=1.0.0
Requires-Dist: matplotlib>=2.2.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: summary

# predictr 
predict + reliability, in other words: A tool to predict the reliability.  

**predictr** is a Python package for Weibull-based life data analysis (reliability engineering). It covers parameter estimation, bias-correction, confidence bounds, and publication-ready Weibull plots in a single, consistent API.

![](https://img.shields.io/pypi/v/predictr?color=blue&style=flat&label=pypi)
[![Downloads](https://pepy.tech/badge/predictr)](https://pepy.tech/project/predictr)
![](https://img.shields.io/pypi/pyversions/predictr)
![](https://img.shields.io/pypi/l/predictr)
![](https://img.shields.io/github/stars/tvtoglu/predictr?style=flat)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21901236.svg)](https://doi.org/10.5281/zenodo.21901236)


## Installation

```bash
pip install predictr
```

Requires Python >= 3.6.

## Quick start

```python
from predictr import Analysis

failures = [0.4508831, 0.68564703, 0.76826143, 0.88231395, 1.48287253, 1.62876357]

weibull = Analysis(df=failures, bounds='fb', show=True)
weibull.mle()

print(weibull.beta, weibull.eta)  # shape and scale estimates
```

This fits a two-parameter Weibull distribution via Maximum Likelihood Estimation, adds Fisher confidence bounds, and renders the probability plot below.

<img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/MLE_Fisher_uncensored.png" alt="Weibull probability plot with Fisher confidence bounds" width="380">

## See it in action

A few of predictr's capabilities, from bias-corrected estimates to comparing entire distributions.

| Bias-corrected estimates | Confidence region, multiple levels |
|:---:|:---:|
| <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/MLE_Fisher_uncensored_c4.png" alt="Bias-corrected Weibull fit (C4 method)" width="260"> | <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/Contour_plot_cl_set.png" alt="Contour plot with multiple confidence levels" width="260"> |

| Ranked by AIC | Distributions compared |
|:---:|:---:|
| <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/Compare_Normal.png" alt="PlotAll().compare() ranked by AIC" width="260"> | <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/Compare_Normal_pdf.png" alt="PlotAll().compare() PDF comparison figure" width="260"> |

| Regression: survival per covariate profile | Regression: goodness of fit with verdict |
|:---:|:---:|
| <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/Regression_survival_band.png" alt="Weibull AFT survival curves with confidence band, B10 marker and Kaplan-Meier overlay" width="300"> | <img src="https://raw.githubusercontent.com/tvtoglu/predictr/main/docs/images/Regression_goodness_of_fit.png" alt="Cox-Snell and martingale residual panels with an overall GOOD/MARGINAL/POOR verdict" width="300"> |

## Main features

**Parameter estimation**
- Uncensored and type I / type II right-censored two-parameter Weibull distribution
- Maximum Likelihood Estimation (MLE) and Median Rank Regression (MRR)
- Bx-life calculator
- Normal, LogNormal and Exponential distributions, alongside Weibull
- Non-parametric Kaplan–Meier `kaplan_meier()` and Nelson–Aalen `nelson_aalen()` from the failure / suspension lists (no DataFrame), with pointwise bands and step plots

**Lifetime regression** (covariates)
- Weibull accelerated failure time (AFT) and Cox proportional hazards (Cox PH) models
- Uncensored and right-censored data, Efron/Breslow tie handling, Wald / profile-likelihood / bootstrap (parametric and non-parametric) bounds
- `summary()`, coefficient forest plot, survival-curve prediction per covariate profile (with pointwise and simultaneous confidence bands)
- Goodness of fit: `goodness_of_fit()` with a good / marginal / poor verdict (concordance, Cox–Snell slope, proportional-hazards test), Cox–Snell / martingale / deviance residuals, `plot_gof()`, `check_ph()`
- Non-parametric descriptors: the same `kaplan_meier()` / `nelson_aalen()` as `Analysis`, here also splittable by a covariate (`by=`), plus `plot_km()` / `plot_na()`
- Accelerated life testing: named aging laws (`stress_model=` — Arrhenius, inverse power, Eyring, Coffin–Manson), physical parameters (`Ea`, `n`) with CIs, `acceleration_factor()`, raw-unit predictions, `plot_stress_life()`, `check_shape()`
- Monte-Carlo `power_analysis()` and `sample_size()`

**Bias-correction**
- C4 method (reduced bias adjustment)
- Hirose and Ross method
- Parametric and non-parametric bootstrap correction (mean, median, trimmed mean)

**Confidence bounds**
- Fisher bounds
- Likelihood Ratio bounds (Weibull, Normal, LogNormal)
- Beta-Binomial bounds
- Monte Carlo Pivotal bounds
- Parametric and non-parametric bootstrap bounds
- Exact chi-square bounds (Exponential)

**Plots**
- Probability plots with all relevant statistics in the legend
- Multiple fits overlaid in one figure, for design comparisons
- Contour plots for the joint confidence region of shape and scale, with support for multiple confidence levels per dataset
- Distribution comparison: fit every supported distribution to one dataset, ranked by AIC or Anderson-Darling, plus a combined PDF plot

See the [class documentation](https://tvtoglu.github.io/predictr/classes/) for the full method and parameter reference, including censored-data and bias-correction examples.

## Documentation and links

- [Documentation](https://tvtoglu.github.io/predictr/)
- [PyPI](https://pypi.org/project/predictr/)
- [Changelog](https://tvtoglu.github.io/predictr/CHANGELOG/)
- [Citation / Zenodo](https://doi.org/10.5281/zenodo.4433164)
- [Discussions](https://github.com/tvtoglu/predictr/discussions)

## Citing predictr

If you use predictr in academic work, please cite it via its [Zenodo DOI](https://doi.org/10.5281/zenodo.4433164). See [docs/citation.md](https://tvtoglu.github.io/predictr/citation/) for details.

## License

MIT — see [LICENSE.txt](LICENSE.txt).

## Contacte me

If you have any questions and / or suggestions, don't hesitate to contact me.
