開始使用免費開始

依性別找出最佳模型

在上一個練習中,你用 shuckedWeightshellWeight 來預測年齡(age)。其中以 shellWeight 的表現最佳,得到最高的 r.squared

在本練習中,請以 shellWeightage 進行簡單線性迴歸,分別針對 3 種鮑魚性別("I""F""M")各跑一次。將每個 lm() 模型的結果儲存下來,並比較模型擬合統計量,例如 r.squared

已為你載入 abaloneKeep 資料集與 dplyr 套件,且也提供了每個模型擬合的圖。

本練習屬於課程

給 SAS 使用者的 R

檢視課程

動手互動練習

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

# Save model output and output of model summary for infants
modelInfants <- lm(___ ~ ___, data = ___, subset = ___)
summaryInfants <- summary(___)
編輯並執行程式碼