开始使用免费开始使用

多元线性回归(第 2 部分)

现在,您将使用在上一个练习中拟合的血压模型 bloodpressure_model 进行预测。

您还将用图形方式将预测值与实际结果进行比较。ggplot2 已加载。回顾绘图命令的形式:

ggplot(dframe, aes(x = pred, y = outcome)) + 
     geom_point() + 
     geom_abline(color = "blue")

bloodpressurebloodpressure_model 已为您准备好,可直接使用。

本练习是课程的一部分

R 中的监督学习:回归

查看课程

练习说明

  • 使用 predict()bloodpressure 数据集上预测血压。将预测结果赋给列 prediction
  • 以图形方式将预测值与实际血压进行比较。将预测值放在 x 轴上。结果与完美预测的直线有多接近?

交互式实操练习

通过完成这段示例代码来试试这个练习。

# bloodpressure is available
summary(bloodpressure)

# bloodpressure_model is available
bloodpressure_model

# Predict blood pressure using bloodpressure_model: prediction
bloodpressure$prediction <- ___

# Plot the results
___ + 
    ___ +
    geom_abline(color = "blue")
编辑并运行代码