始める無料で始める

LOO 推定値を計算する

それでは、loo パッケージを Spotify のモデルに使って、どのモデルがデータに最もよく当てはまるかを確認してみましょう。songs データセットはすでに読み込まれています。

この演習はコースの一部です

rstanarm で学ぶベイズ回帰モデリング

コースを見る

演習の手順

  • song_age から popularity を予測するモデルを推定します
  • 1 つの予測子をもつこのモデルについて、LOO 近似を出力します
  • song_ageartist_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)
コードを編集して実行