새 노래의 인기도
Beyoncé의 최근 앨범인 Lemonade는 우리의 songs 데이터셋에 포함되어 있지 않아요. 그 앨범의 수록곡이 얼마나 인기가 있을지 예측해 봅시다. Lemonade 앨범은 이 데이터셋이 만들어지기 663일 전에 발매되었습니다. 지난 연습 문제에서 생성한 stan_model 객체가 현재 환경에 로드되어 있습니다.
이 연습은 강의의 일부입니다
rstanarm으로 배우는 Bayesian 회귀 모델링
연습 안내
- 예측할 새 데이터의 데이터 프레임을 만들고, 여기에
song_age와artist_name변수를 포함하세요 - Lemonade 수록곡의 예측 인기도에 대한 사후분포를 생성하세요
- 사후분포에서 처음 10개 드로우에 대한 예측 인기도를 출력하세요
- 새 관측치 1건에 대한 사후 예측의 요약 통계를 출력하세요
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Create data frame of new data
predict_data <- data.frame(___ = ___, ___ = "Beyoncé")
# Create posterior predictions for Lemonade album
new_predictions <- ___(stan_model, ___ = predict_data)
# Print first 10 predictions for the new data
___[___:___,]
# Print a summary of the posterior distribution of predicted popularity
___(new_predictions[, ___])