The solution for the exercise in Chapter 5 to create a transformation which shows a straight line for Weibull distributed data is missing the log-log transformation:
sample = [random.weibullvariate(2, 1) for _ in range(1000)]
cdf = thinkstats2.Cdf(sample)
thinkplot.Cdf(cdf, transform="weibull")
thinkplot.Config(xlabel="Weibull variate", ylabel="CCDF")
instead. Then we get a straight line also for other values of k then just k=1.
(This seems to be a bit more complex, since thinkstats.Cdf correctly sets xscale and yscale to "log" but the scale return value of thinkstats.Cdf is not used here. Another option would be to replace the last two lines with
The solution for the exercise in Chapter 5 to create a transformation which shows a straight line for Weibull distributed data is missing the log-log transformation:
The last line should be
instead. Then we get a straight line also for other values of k then just k=1.
(This seems to be a bit more complex, since
thinkstats.Cdf
correctly setsxscale
andyscale
to "log" but thescale
return value ofthinkstats.Cdf
is not used here. Another option would be to replace the last two lines withbut that's less transparent.)