Generalised Additive Models (GAM) are non-parametric models that add smoother to the data. On this exercise, we will look at GAMs using cubic spline using the
mgcv package. Dataset used can be downloaded here. The dataset is the experiment result at grassland richness over time in 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 dataset and required package before running the exercise.
observe the dataset and try to classify the response and explanatory variables. We will focus on ROCK as an explanatory variable.
do some scatter plot
since it is not linear, try to do GAM with ROCK variables
check the result. what can be inferred
do some validation plots
plot base graph
add predict across the data and add some lines
plot the fitted values
Why we only use ROCK variables? Because it is proofed to give the most fitted data without incorporation all the explanatory variables. Try to play around with other explanatory variables to see the difference.