The Normal PDF
In this exercise, you will explore the Normal PDF and also learn a way to plot a PDF of a known distribution using hacker statistics. Specifically, you will plot a Normal PDF for various values of the variance.
Diese Übung ist Teil des Kurses
Statistical Thinking in Python (Part 1)
Anleitung zur Übung
- Draw 100,000 samples from a Normal distribution that has a mean of
20
and a standard deviation of1
. Do the same for Normal distributions with standard deviations of3
and10
, each still with a mean of20
. Assign the results tosamples_std1
,samples_std3
andsamples_std10
, respectively. - Plot a histogram of each of the samples; for each, use 100 bins, also using the keyword arguments
density=True
andhisttype='step'
. The latter keyword argument makes the plot look much like the smooth theoretical PDF. You will need to make 3plt.hist()
calls. - Hit submit to make a legend, showing which standard deviations you used, and show your plot! There is no need to label the axes because we have not defined what is being described by the Normal distribution; we are just looking at shapes of PDFs.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Draw 100000 samples from Normal distribution with stds of interest: samples_std1, samples_std3, samples_std10
# Make histograms
# Make a legend, set limits and show plot
_ = plt.legend(('std = 1', 'std = 3', 'std = 10'))
plt.ylim(-0.01, 0.42)
plt.show()