June 2017
Beginner to intermediate
576 pages
15h 22m
English
Another R object produced by our linear regression is the error object. The error object is a vector that was computed by taking the difference between the predicted value of height and the actual height. These values are also known as the residual errors, or just residuals.
error <- women$height-prediction
Since the error object is a vector, you cannot use the nrow() function to get its size. But you can use the length() function:
>length(error)[1] 15
In all of the previous cases, the counts all total 15, so all is good. If we want to see the raw data, predictions, and the prediction errors for all of the data, we can use the cbind() function (Column bind) to concatenate all three of those values, and ...