Generalized Additive Models (GAM) are non-parametric models that add smoother to the data. In this exercise, we will look at GAMs using cubic spline using the
mgcv package. Data-sets used can be downloaded here. The data-set is the experiment result of grassland richness over time in the Yellowstone National Park (Skkink et al. 2007).
Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page. Load the data-set and required package before running the exercise.
Observe the data-set and try to classify the response and explanatory variables. We will focus on ROCK as an explanatory variable.
Do some scatter-plots.
Since it is not linear, try to do GAM with ROCK variables.
Check the result. What can be inferred?
Do some validation plots.
Plot the base graph.
Add “predict” across the data and add some lines.
Plot the fitted values.
Why do we only use ROCK variables? It is proven to give the most fitted data without incorporation of all the explanatory variables. Try to play around with other explanatory variables to see the difference.