開始使用免費開始

檢查過度離散(overdispersion)

在這個練習中,你要檢查先前擬合的模型是否有過度離散,也就是以馬蹄蟹資料建立的 Poisson 模型,將 satwidth 做為自變數來擬合。回想影片中提到,若要檢查擬合是否可能存在過度離散,你可以計算下列數值:

model.pearson_chi2 / model.df_resid

其中 .pearson_chi2 代表 Pearson 統計量,.df_resid 代表殘差的自由度。

工作環境已預先載入模型 crab_pois 與資料集 crab

本練習屬於課程

Generalized Linear Models in Python

檢視課程

練習說明

  • 計算 crab_pois Poisson 迴歸模型的 Pearson 統計量與殘差自由度的比值。

動手互動練習

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

# Compute and print the overdispersion approximation
____(____.____ / ____.____)
編輯並執行程式碼