How it works...

The regression model has the income ~ prestige + women form, where income is the response vector, and prestige and women specifies a predictor. We can illustrate a simple regression model in the formula y=α+β1x1 + β2x2, where α is the intercept while the slope, β1 and β2, describes the change in y when x changes. By using the least squares method, we can estimate and (where indicates the mean value of y and denotes the mean value of x1 and x2).

In this example, we load the Prestige dataset from the car package. To generate the regression line, we use the lm function to generate a model of the three variables. Further, we use scatter3d to plot a regression line in a 3d plot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset