Normal 的 CDF
現在你已經熟悉 Normal PDF 的樣子了,接著來看它的 CDF。使用你在上一題產生的樣本(在你的命名空間中為 samples_std1、samples_std3、samples_std10),產生並繪製這些 CDF。
本練習屬於課程
Statistical Thinking in Python (Part 1)
練習說明
- 使用你的
ecdf()函式產生各個 CDF 的 x 與 y 值:分別為x_std1, y_std1、x_std3, y_std3與x_std10, y_std10。 - 將三條 CDF 都以點的形式繪製(別忘了
marker與linestyle這兩個關鍵字參數!)。 - 按下送出以建立圖例,顯示所使用的標準差,並顯示你的圖表。軸標籤不必加上,因為我們尚未定義 Normal 分配描述的是什麼;此處只是觀察 CDF 的形狀。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Generate CDFs
# Plot CDFs
# Make a legend and show the plot
_ = plt.legend(('std = 1', 'std = 3', 'std = 10'), loc='lower right')
plt.show()