EDA:繪製主動活動區段長度的 ECDF
主動活動區段(active bout)指的是魚持續移動的一段時間。請為牠們生命中的第 7 個夜晚,分別繪製突變型與野生型魚的主動活動區段長度的 ECDF。資料已存於 numpy 陣列 bout_lengths_wt 與 bout_lengths_mut,單位為分鐘。
本練習屬於課程
統計思維個案研究
練習說明
- 將模組
dc_stat_think以別名dcst匯入,以便使用其中的函式。 - 使用
dcst.ecdf()為野生型魚(bout_lengths_wt)產生用於繪圖的 x 與 y 值,並將結果存為numpy陣列x_wt與y_wt。 - 以相同方式為突變型魚(
bout_lengths_mut)產生資料,並將結果存為numpy陣列x_mut與y_mut。 - 使用
plt.plot()在同一張圖上以點的方式繪製兩條 ECDF,並指定關鍵字參數marker='.'與linestyle='none'。 - 使用
plt.show()顯示你的圖表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import the dc_stat_think module as dcst
____
# Generate x and y values for plotting ECDFs
x_wt, y_wt = ____
____, ____ = ____
# Plot the ECDFs
_ = ____(____, ____, ____='.', linestyle='____')
_ = ____(____, ____, ____='.', linestyle='____')
# Make a legend, label axes, and show plot
_ = plt.legend(('wt', 'mut'))
_ = plt.xlabel('active bout length (min)')
_ = plt.ylabel('ECDF')
____