開始使用免費開始

Poisson 迴歸繪圖

使用 geom_smooth 繪製 Poisson 迴歸的資料,和繪製二元(binomial)資料很類似。 不過,你需要在 geom_smooth() 中更改 family 參數。 在這個練習中,你會繪製每平方公分(cm$^2$)的癌細胞數量,並使用 geom_smooth()。 這是你在影片中看過的同一個模擬資料集。

本練習屬於課程

R 的廣義線性模型

檢視課程

練習說明

  • 使用 geom_jitter(),將抖動的寬度與高度都設為 0.05
  • 使用 geom_smooth(),以 Poisson 迴歸建立趨勢線。

動手互動練習

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

# Use geom_smooth to plot a continuous predictor variable
ggplot(data = dat, aes(x = dose, y = cells)) + 
	___(___ = ___, ___ = ___) + 
	___(method = '___', method.args = list(___ = '___'))
編輯並執行程式碼