Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing log-log scale in solution for Weibull transform (chap05soln.ipynb) #206

Open
rjoberon opened this issue Jun 14, 2023 · 0 comments
Open

Comments

@rjoberon
Copy link

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")

The last line should be

thinkplot.Config(xlabel="Weibull variate", ylabel="CCDF", xscale="log", yscale="log")

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

scale = thinkplot.Cdf(cdf, transform="weibull")
thinkplot.Config(xlabel="Weibull variate", ylabel="CCDF", xscale=scale["xscale"], yscale=scale["yscale"])

but that's less transparent.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant