Skip to main content
A phase-type distribution being fitted to bimodal data

PyPI Python License

PhaseDist is a Python package for fitting continuous and discrete phase-type distributions.

Features

  • Fit continuous and discrete phase-type distributions using EM algorithms.
  • Fit to uncensored or censored observations.
  • Impose a special case on the fitted distribution, such as the Coxian, generalized Erlang, or hyper-exponential distribution.
  • Use built-in methods to check the fitted distribution.
  • Compute metrics, such as the mean, density, and quantile function.
  • Simulate observations from a phase-type distribution.
  • Approximate another distribution, e.g. a log-normal distribution, using a phase-type distribution.
A phase-type distribution being fitted to bimodal data

A phase-type distribution fitted using PhaseDist.

Installation

Install directly from PyPI with:

pip install phasedist

Quick start guide

The following shows how to use PhaseDist for fitting a continuous phase-type distribution from observed data.

(1) Start by loading PhaseDist (and NumPy) and defining the observed data.

import phasedist as ph
import numpy as np

obs = np.array([1.48246359,1.13468709,0.66779536,0.61823347,0.8888217,1.10124776,0.1424737,2.1228061,
1.73924933,0.9849647,1.4828275,1.97188842,2.56132465,1.58038807,1.27567082,2.7754917,1.42516854,0.4602795,
1.93701091,2.50633135,1.92906099,1.60935023,1.41949599,1.14870169,0.79146146,1.31530543,1.81352371,1.17079096,
0.78948314,1.39528837,1.62003755,1.52143826,0.46665594,1.37913488,3.10066725,0.76942733,1.42849783,1.61511175,
2.94617609,1.53719196,1.01144357,2.00466269,0.56886361,1.62237618,0.41023332,0.78733512,4.01849928,1.27761144,
1.09426382,1.36946933])

(2) Fit the data to a generalized Erlang distribution with 3 phases.

fit = ph.fit(obs=obs,
             nphases=3,
             dtype="generlang")

(3) Store the fitted distribution in the object phdist and compute the mean, variance, and 95% quantile.

phdist = fit.getdist()

print(phdist.getmean())
#1.455814

print(phdist.getvar())
#0.706465

print(phdist.getquantile(p=0.95))
#3.055168

Find the complete example in the file examples/quickstart_example.py.

Documentation

The documentation can be found in the wiki for PhaseDist.

License

PhaseDist is released under the MIT License.

Metadata

Release files for phasedist 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phasedist 0.2.1
File Size Uploaded
phasedist-0.2.1.tar.gz 128.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phasedist 0.2.1
File Interpreter ABI Platform
phasedist-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 180.2 kB

Release files / phasedist-0.2.1.tar.gz

Download URL phasedist-0.2.1.tar.gz
Size 128.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5f15e246857eff8156f0ed7faca4779f35039e1795785712f45906c3e049a7d7
BLAKE2b-256 checksum
How to use checksums
068f2721879e72f7f199ba188e7d4614953a4b180f1fc68e98ee8c8b21f32ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / phasedist-0.2.1-py3-none-any.whl

Download URL phasedist-0.2.1-py3-none-any.whl
Size 51.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04ce0cd79dabfac77697e35e36eebcb679dcba7add69fc9d8e8226372d0af9a6
BLAKE2b-256 checksum
How to use checksums
379fd09ad02e90f0bfd2a704f053be633a99a254aa89ba4befc4b2cb6a3170b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page