Format prediction posteriors
Now let's plot some new predictions. In this exercise, we'll predict how popular a song would be that was newly released and has a song_age
of 0. We're still predicting popularity
from song_age
and artist_name
. The new_predictions
object has already been created and contains the distributions for the predicted scores for a new song from Adele, Taylor Swift, and Beyoncé.
Este exercício faz parte do curso
Bayesian Regression Modeling with rstanarm
Instruções do exercício
- Print the predicted scores from the first 10 iterations of
new_predictions
. - Convert
new_predictions
to a data frame and name the columns of the data frame "Adele", "Taylor Swift", and "Beyoncé". - Structure the data in long format, with only two columns:
artist_name
andpredict
. - Print the first six rows of the newly structured
plot_posterior
data frame.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# View new data predictions
___[___:___, ]
# Convert to data frame and rename variables
new_predictions <- ___(new_predictions)
___(___) <- c("___", "___", "___")
# Create tidy data structure
plot_posterior <- ___(new_predictions, key = "artist_name", value = "predict")
# Print formated data
___(plot_posterior)