시작하기무료로 시작하기

LOO 추정값 계산하기

이제 loo 패키지를 사용해 Spotify 모형을 비교해 보면서 어떤 모형이 데이터에 가장 잘 맞는지 판단해 봅시다. songs 데이터셋은 이미 로드되어 있어요.

이 연습은 강의의 일부입니다

rstanarm으로 배우는 Bayesian 회귀 모델링

강의 보기

연습 안내

  • song_agepopularity를 예측하는 모형을 추정하세요
  • 예측 변수가 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)
코드 편집 및 실행