開始使用免費開始

多變量線性迴歸(第 1 部分)

在這個練習中,你會使用血壓資料集(來源),並將 blood_pressure 建立為 weightage 的函式。

資料框 bloodpressure 已為你預先載入。

本練習屬於課程

R 中的監督式學習:回歸

檢視課程

練習說明

  • 定義一個公式,將 blood_pressure 明確表示為 ageweight 的函式。把公式指定給變數 fmla,並印出它。
  • 使用 fmla 來擬合線性模型,從資料集 bloodpressureageweight 預測 blood_pressure。把模型命名為 bloodpressure_model
  • 印出模型,並對其呼叫 summary()。血壓會隨年齡上升還是下降?隨體重上升還是下降?

動手互動練習

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

# bloodpressure is available
summary(bloodpressure)

# Create the formula and print it
fmla <- ___
___

# Fit the model: bloodpressure_model
bloodpressure_model <- ___

# Print bloodpressure_model and call summary() 
___
___
編輯並執行程式碼