Perform the following steps to measure the performance of the regression model:
- Load the Quartet dataset from the car package:
> library(car) > data(Quartet)
- Plot the attribute, y3, against x using the lm function:
> plot(Quartet$x, Quartet$y3) > lmfit = lm(Quartet$y3~Quartet$x) > abline(lmfit, col="red")
- You can retrieve predicted values by using the predict function:
> predicted= predict(lmfit, newdata=Quartet[c("x")])
- Now, you can calculate the root mean square error:
> actual = Quartet$y3 > rmse = (mean((predicted - actual)^2))^0.5 > rmse Output [1] 1.118286
- You can calculate the ...