---
title: 'Project #2'
author: "Milica Cudina"
date: "`r Sys.Date()`"
output:
  html_document:
    df_print: paged
urlcolor: blue
---
<!-- The author of this template is Dr. Gordan Zitkovic.-->
<!-- The code chunk below contains some settings that will  -->
<!-- make your R code look better in the output pdf file.  -->
<!-- If you are curious about what each option below does, -->
<!-- go to https://yihui.org/knitr/options/ -->
<!-- If not, feel free to disregard everything ...  -->
```{r echo=FALSE, warning=FALSE, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  fig.align="center",
  fig.pos="t",
  strip.white = TRUE
)
```
<!-- ... down to here. -->

---

# Problems

## Problem #1 **(20+5+10+10=45 points)**
Solve **Problem 3.7.15** (page 128) from the textbook. 

*Hint:* The command `lapply` could be useful. 

## Problem #2 **(5+5+10+5+5+5=35 points)**
Solve **Problem 5.4.8** (pages 222-223) from the textbook. 

## Problem #3 **(20 points)**
The Mauna Loa Observatory in Hawaii has recorded atmospheric CO₂ concentrations since 1958. The dataset `mauna-loa.csv` contains monthly mean $CO_2$ values (in parts per million, ppm).

Your task is to fit a smoothing spline to the monthly $CO_2$ measurements. Make sure that you experiment with different smoothing parameters (or degrees of freedom) and comment on your findings. In particular, briefly explain how the smoothing parameter affects bias and variance.

Finally, fit a polynomial model with the same number of degrees of freedom. Plot all of your findings in the same coordinate system. What do you notice? 

