Popularity for New Songs
Beyoncé's most recent album, Lemonade, is not in our songs
dataset. Let's predict how popular a song on that album would be. The Lemonade album was released 663 days before this dataset was created. The stan_model
object you created in the last exercise is loaded in your environment.
This exercise is part of the course
Bayesian Regression Modeling with rstanarm
Exercise instructions
- Create a data frame of new data to be predicted including the
song_age
andartist_name
variables - Create a posterior distribution for predicted popularity of a song on Lemonade
- Print the predicted popularity for the first 10 draws from the posterior distribution
- Print a summary of the posterior predictions for the 1 new observation
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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[, ___])