Three-dimensional scatter plots with a regression plane
In this recipe, we will see how we can visualize a three-dimensional scatter plot with a fitted regression plane.
Let's recall the
airquality data from the datasets library. In this particular recipe, we will use
Ozone as a dependent variable and
Temp as independent variables in order to fit the regression model, and then we visualized it.
How to do it…
To produce this plot, we will perform the following steps:
- Attach the dataset using the
- Create a basic three-dimensional scatter plot and store it in an R object.
- Fit the linear regression model, relating
Ozoneas a dependent variable and
Tempas independent variables and store it as an R object. ...