開始使用免費開始

設定具資訊性的先驗

現在來設定一個自訂的先驗,讓我們能更精準地控制模型。songs 資料集已經載入。

本練習屬於課程

使用 rstanarm 的貝葉斯迴歸建模

檢視課程

練習說明

  • song_age 預測 popularity
  • 為此解釋變數指定常態先驗分佈,平均數為 20、標準差為 0.1
  • 將先驗摘要列印到畫面上

動手互動練習

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

# Estimate the model with an informative prior
inform_prior <- stan_glm(___ ~ ___, data = songs,
    ___ = normal(___ = 20, ___ = 0.1, autoscale = FALSE))

# Print the prior summary
___(inform_prior)
編輯並執行程式碼