## 2.10 Exercises

Use the help function to explore what the series

`gafa_stock`

,`PBS`

,`vic_elec`

and`pelt`

represent.- Use
`autoplot()`

to plot some of the series in these data sets. - What is the time interval of each series?
- Use
`filter()`

to find what days corresponded to the peak closing price for each of the four stocks in`gafa_stock`

.

- Use
Download the file

`tute1.csv`

from the book website, open it in Excel (or some other spreadsheet application), and review its contents. You should find four columns of information. Columns B through D each contain a quarterly series, labelled Sales, AdBudget and GDP. Sales contains the quarterly sales for a small company over the period 1981-2005. AdBudget is the advertising budget and GDP is the gross domestic product. All series have been adjusted for inflation.You can read the data into R with the following script:

Convert the data to time series

Construct time series plots of each of the three series

`mytimeseries %>% gather("Key", "Value", -Quarter) %>% ggplot(aes(x = Quarter, y = Value, colour = Key)) + geom_line() + facet_grid(vars(Key), scales = "free_y")`

Check what happens when you don’t include

`facet_grid()`

.

Create time plots of the following time series:

`fma::bicoal`

,`fma::chicken`

,`fma::dole`

,`USAccDeaths`

,`fma::writing`

,`fma::fancy`

.- Use
`?`

(or`help()`

) to find out about the data in each series. - You will need to convert each series to a tsibble using
`as_tsibble()`

.

- Use
Use the

`gg_season()`

and`gg_subseries()`

functions to explore the seasonal patterns in the following time series:`fma::writing`

,`fma::fancy`

,`PBS`

for ATC2 “A10” and “H02”- What can you say about the seasonal patterns?
- Can you identify any unusual years?

Use the following graphics functions:

`autoplot()`

,`gg_season()`

,`gg_subseries()`

,`gg_lag()`

,`ACF()`

and explore features from the following time series:`fma::hsales`

,`USAccDeaths`

, bricks from`aus_production`

,`fpp2::sunspotarea`

,`fpp2::gasoline`

.- Can you spot any seasonality, cyclicity and trend?
- What do you learn about the series?

The

`fpp2::arrivals`

data set comprises quarterly international arrivals (in thousands) to Australia from Japan, New Zealand, UK and the US.- Use
`autoplot()`

,`gg_season()`

and`gg_subseries()`

to compare the differences between the arrivals from these four countries. - Can you identify any unusual observations?

- Use
The following time plots and ACF plots correspond to four different time series. Your task is to match each time plot in the first row with one of the ACF plots in the second row.

The

`aus_livestock`

data contains the monthly total number of pigs slaughtered in Victoria, Australia, from Jul 1972 to Dec 2018. Use`filter()`

to extract pig slaughters in Victoria between 1990 and 1995. Use`autoplot`

and`ACF`

for this data and compare these to white noise plots from Figures 2.16 and 2.17.Use

`mutate()`

and`difference()`

to compute the daily changes in Google closing stock prices. Plot these differences and their ACF. Do the changes in the stock prices look like white noise?