LoslegenKostenlos loslegen

How is this parameter optimal?

Now sample out of an exponential distribution with \(\tau\) being twice as large as the optimal \(\tau\). Do it again for \(\tau\) half as large. Make CDFs of these samples and overlay them with your data. You can see that they do not reproduce the data as well. Thus, the \(\tau\) you computed from the mean inter-no-hitter times is optimal in that it best reproduces the data.

Note: In this and all subsequent exercises, the random number generator is pre-seeded for you to save you some typing.

Diese Übung ist Teil des Kurses

Statistical Thinking in Python (Part 2)

Kurs anzeigen

Anleitung zur Übung

  • Take 10000 samples out of an Exponential distribution with parameter \(\tau_{1/2}\) = tau/2.
  • Take 10000 samples out of an Exponential distribution with parameter \(\tau_{2}\) = 2*tau.
  • Generate CDFs from these two sets of samples using your ecdf() function.
  • Add these two CDFs as lines to your plot. This has been done for you, so hit submit to view the plot!

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Plot the theoretical CDFs
plt.plot(x_theor, y_theor)
plt.plot(x, y, marker='.', linestyle='none')
plt.margins(0.02)
plt.xlabel('Games between no-hitters')
plt.ylabel('CDF')

# Take samples with half tau: samples_half
samples_half = ____

# Take samples with double tau: samples_double
samples_double = ____

# Generate CDFs from these samples
x_half, y_half = ____
x_double, y_double = ____

# Plot these CDFs as lines
_ = plt.plot(x_half, y_half)
_ = plt.plot(x_double, y_double)

# Show the plot
plt.show()
Code bearbeiten und ausführen