This worksheet revisits the regression and prediction topic but this time from a non-linear point of view. After completing this worksheet you should know how to use local regression models for fitting relationships within your data sets.
First things first: the following analysis is build on top of your script from W02-1. Please copy your script “W02-1.R”, rename the copy to “W08-1.R” and use it for the programming tasks of this worksheet.
Please visualize once again the relation between animal activity and coverage.
Perhaps there are models that fit better than the linear regression! Let's try a polynomial regression using the loess() function. Add the prediction of the loess model in our scatterplot using the lines() function which works almost identical to regLine().
Now let's check out how the loess model compares to the linear regression when it comes to predictions. Please compute a leave-one-out validation as in W06-1 but this time use the loess model. How do the error statistics compare to the linear prediction model?