Question
Question 3 (load the data with R commands: library(gamair); data(co2)) ( Use R to provide R codes for this question ) This question is about
Question 3 (load the data with R commands: library(gamair); data(co2)) ( Use R to provide R codes for this question )
This question is about modeling data with seasonality, and the need to be very careful if trying to extrapolate with GAMs (or any statistical model). The data frame co2 contains monthly measurements of CO2 at the south pole from January 1957 onwards. The columns are co2, the month of the year, month, and the cumulative number of months since January 1957, c.month. There are missing co2 observations in some months.
a) Plot the CO2 observations against cumulative months.
b) Fit the model, co2 = f(c.month) + i where f is a smooth function and the i are i.i.d. with constant variance, using the gam function. Use the cr basis, and a basis dimension of 300.
c) Obtain the predicted CO2 for each month of the data plus 36 months after the end of the data as well as associated standard errors. Produce a plot of the predictions with twice standard error bands. Are the predictions in the last 36 months credible?
d) Fit the model co2 = f1(c.month) + f2(month) + i where f1 and f2 are smooth functions, but f2 is cyclic (you will need to use the knot's argument of gam to ensure that f2 wraps appropriately; it's important to make sure that January is the same as January, not that December and January are the same).
e) Repeat the prediction and plotting in part (c) for the new model. Are the predictions more credible now? Explain the differences between the new results and those from part (c).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started