繪製模型的不確定性
因為我們使用的是貝葉斯估計,所以可以利用後驗分佈,從後驗樣本中的每一次抽樣建立一條預測的迴歸線。這些線條會呈現整體迴歸線周圍的不確定性。songs 與 stan_model 物件已經載入,還有你在上一個練習中用到的 model_intercept 與 model_slope。
本練習屬於課程
使用 rstanarm 的貝葉斯迴歸建模
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Save the values from each draw of the posterior distribution
draws <- ___(stan_model, `___`, `___`)
# Print the `draws` data frame to the console
___