Transform a Weibull distribution into a straight line in Python with Scipy

171 Views Asked by At

The CDF of the Weibull distribution is

CDF(x) = 1 − exp[−(x / λ)^k]

The CCDF and my approach:

CCDF(x) = 1 - CDF(x)
CCDF(x) = 1 - (1 − exp[−(x / λ)^k])
CCDF(x) = exp[−(x / λ)^k]

Assuming the following value of scale/k and taking the natural log, ln:

k = 1, 

ln(CCDF) = ln(exp[−(x / λ)^k])
ln(CCDF) = -xλ

Which yields a straight line with slope -λ.

Code:

x3 = np.linspace(1,15, 1000)
weibull_cdf = scipy.stats.weibull_min.cdf(x3, c = 1, scale = 1)
weibull_ccdf = (1 - weibull_cdf)
weibull_ccdf = np.log(weibull_ccdf)

Is this implementation solid? Would changing the scale so that scale/k = 2 change the implementation?

0

There are 0 best solutions below