---
title: 'Lab 2: Simple forecasting tools'
author: "Introduction to Time Series Analysis"
output:
  html_document:
    df_print: paged
  word_document: default
  pdf_document: default
header-includes:
- \usepackage{amsmath}
---

\newcommand{\ba}{{\mathbf a}}

Name:  
This lab is to be done in class (completed outside of class if need be). You can collaborate with your classmates, but you must identify their names above, and you must submit **your own** lab as an knitted pdf file. To answer the questions, display the results and write your answers if asked.


```{r, include= FALSE}
knitr::opts_chunk$set(cache=TRUE, autodep=TRUE, cache.comments=TRUE)
library(tidyverse)
library(fable)
library(tsibble)
library(feasts)
library(lubridate)
library(tsibbledata)
```


1.  Consider the GDP information in global_economy. Plot the GDP per capita for each country over time. Which country has the highest GDP per capita? How has this changed over time?


2.  For each of the following series, make a graph of the data. Try to find an appropriate Box-Cox transformation in order to stabilize the variance. If transforming seems appropriate, do so and describe the effect. If not, why is a Box-Cox transformation unhelpful?

   * United States GDP from `global_economy`
   * Slaughter of Victorian ``Bulls, bullocks and steers'' in `aus_livestock`
   * Gas production from `aus_production`
   * Victorian Electricity Demand from `vic_elec`
   * `canadian_gas` from `fpp3` package

3. Produce forecasts for the following series using whichever of `NAIVE(y)`, `SNAIVE(y)` or `RW(y ~ drift())` is more appropriate in each case:

   * Australian Population (`global_economy`)
   * Bricks (`aus_production`)
   * NSW Lambs (`aus_livestock`)
4. Use the Facebook stock price (data set `gafa_stock`) to do the following:

   * Produce a time plot of the series.
   * Produce forecasts using the drift method and plot them.
   * Show that the forecasts are identical to extending the line drawn between the first and last observations.
   * Try using some of the other benchmark functions to forecast the same data set. Which do you think is best? Why?
5. Produce forecasts for all of the Victorian series in `aus_livestock` using `SNAIVE()`. Plot the resulting forecasts including the historical data. Is this a reasonable benchmark for these series?

