Multivariate linear regression (Part 2)
Now you will make predictions using the blood pressure model bloodpressure_model that you fit in the previous exercise.
You will also compare the predictions to outcomes graphically. ggplot2 has already been loaded. Recall the plot command takes the form:
ggplot(dframe, aes(x = pred, y = outcome)) +
geom_point() +
geom_abline(color = "blue")
bloodpressure and bloodpressure_model are available for you to use.
Latihan ini adalah bagian dari kursus
Supervised Learning in R: Regression
Petunjuk latihan
- Use
predict()to predict blood pressure in thebloodpressuredataset. Assign the predictions to the columnprediction. - Graphically compare the predictions to actual blood pressures. Put predictions on the x axis. How close are the results to the line of perfect prediction?
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# 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")