开始使用免费开始使用

新歌的人气预测

Beyoncé 最新专辑《Lemonade》不在我们的 songs 数据集中。让我们来预测该专辑上一首歌的人气会如何。《Lemonade》在创建本数据集的 663 天之前发行。您在上一个练习中创建的 stan_model 对象已加载到您的环境中。

本练习是课程的一部分

使用 rstanarm 进行贝叶斯回归建模

查看课程

练习说明

  • 创建一个包含 song_ageartist_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[, ___])
编辑并运行代码