From dc3048407a87cb645ce27e4f873ce6204c00f470 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Fri, 27 Sep 2024 14:55:23 -0400 Subject: [PATCH] work through the parameterization --- conjugate/distributions.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/conjugate/distributions.py b/conjugate/distributions.py index 54e678c..c541bb8 100644 --- a/conjugate/distributions.py +++ b/conjugate/distributions.py @@ -1192,6 +1192,8 @@ def dist(self): class Weibull(ContinuousPlotDistMixin, SliceMixin): """Weibull distribution. + Parameterization from Section 2.11 of paper. + Args: beta: shape parameter theta: scale parameter @@ -1201,10 +1203,17 @@ class Weibull(ContinuousPlotDistMixin, SliceMixin): ```python import matplotlib.pyplot as plt + import numpy as np from conjugate.distributions import Weibull - distribution = Weibull(beta=1, theta=[0.5, 1.0, 1.5, 5.0]) + lam = 1 + k = np.array([0.5, 1.0, 1.5, 5.0]) + + beta = k + theta = lam ** beta + + distribution = Weibull(beta=beta, theta=theta) ax = distribution.set_bounds(0, 2.5).plot_pdf( label=["k=0.5", "k=1.0", "k=1.5", "k=5.0"], color=["blue", "red", "pink", "green"], @@ -1223,4 +1232,6 @@ class Weibull(ContinuousPlotDistMixin, SliceMixin): @property def dist(self): - return stats.weibull_min(c=self.theta, scale=self.beta) + k = self.beta + lam = self.theta ** (1 / self.beta) + return stats.weibull_min(c=k, scale=lam)