開始使用免費開始

擬合一個貝氏線性迴歸

練習擬合一個貝氏模型。這個模型和你先前用傳統頻率學派方法已經估計過的模型相同,所以之後可以比較參數的輸出。songs 資料已經載入。

本練習屬於課程

使用 rstanarm 的貝葉斯迴歸建模

檢視課程

練習說明

  • 建立一個貝氏線性模型 stan_model,用歌曲的年齡來預測歌曲的熱門程度。
  • 列印該貝氏線性模型的摘要。

動手互動練習

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

# Create the model here
stan_model <- ___(___ ~ ___, data = songs)

# Produce the summary
___(stan_model)

# Print a tidy summary of the coefficients
___(stan_model)
編輯並執行程式碼