開始使用免費開始

視覺化反應變數

在影片中你學到 Poisson 隨機變數的主要特性,以及當參數 \(\lambda\) 改變時分配如何變化。在這個練習中,你會用視覺化方式檢視反應變數,以評估參數值、分配的散布或偏態。

你會使用先前章節練習中用過的 crab 資料集,但這次你要分析的是衛星蟹的數量 sat,而不是巢位附近是否至少有一隻。

crab 資料集已經預先載入到工作區中。

本練習屬於課程

Generalized Linear Models in Python

檢視課程

練習說明

  • seaborn 函式庫匯入為 sns
  • matplotlib 函式庫匯入為 plt
  • 使用 distplot() 函式繪製 sat 變數的分配圖。
  • 使用 show() 函式顯示圖表。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Import libraries
import ____ as sns
import ____.pyplot as plt

# Plot sat variable
sns.____(____[____])

# Display the plot
plt.____
編輯並執行程式碼