LOO 推定値を計算する
それでは、loo パッケージを Spotify のモデルに使って、どのモデルがデータに最もよく当てはまるかを確認してみましょう。songs データセットはすでに読み込まれています。
この演習はコースの一部です
rstanarm で学ぶベイズ回帰モデリング
演習の手順
song_ageからpopularityを予測するモデルを推定します- 1 つの予測子をもつこのモデルについて、LOO 近似を出力します
song_age、artist_name、およびその交互作用からpopularityを予測するモデルを推定します- 2 つの独立変数をもつこのモデルについて、LOO 近似を出力します
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Estimate the model with 1 predictor
model_1pred <- ___(___ ~ ___, data = songs)
# Print the LOO estimate for the 1 predictor model
___(model_1pred)
# Estimate the model with both predictors
model_2pred <- ___(___ ~ ___ * ___, data = songs)
# Print the LOO estimates for the 2 predictor model
___(model_2pred)