Today we are going to take a look at a number of the time series dataset, tibbles, that are used in the fpp3 book.

The first datast to look at is the beer data.

library(fpp3)

See the information about the tsibble package and find the description of the aus_retail dataset.

aus_retail

class(aus_retail)

Note that the dataset is not in the R Environment. This makes it hard to see what the dataset contains. To load the dataset we use the data() R function.

data(aus_production)

View(aus_production)

Open the dataset, does it look like there is more than on time series contained in the dataset?

When the dataset is piped into autoplot, the first time series column is plotted.

aus_production %>% autoplot()
aus_production %>% autoplot(Beer)

Why does this look different from the picture in Section 4?

aus_prod_2000 <- aus_production %>% select(Quarter, Beer) %>% 
  filter(Quarter >= yearquarter("2000 Q1"))

aus_prod_2000

Now try plotting.

aus_prod_2000 %>% autoplot()

Try this for each of the time series.

aus_prod_2000 <- aus_production %>% select(Quarter, Bricks) %>% 
  filter(Quarter >= yearquarter("2000 Q1"))

aus_prod_2000 %>% autoplot()

In Section 1.7

For Homework 1 you need to work with the following datasets from the tsibble R package.

gafa_stock
PBS
vic_elec
pelt
pelt %>% autoplot()

There is a clear pattern in the pelt time time series data. We will measure the Autocorrelation in time series data using the ACF function.

ACF(pelt)

And we can plot the ACF. Can you see the positive and negative correlations in the time series?

ACF(pelt) %>% autoplot()
LS0tCnRpdGxlOiAiVGltZSBTZXJpZXMgZGF0YSBhbmQgYXV0b3Bsb3QoKSIKYXV0aG9yOiAiUHJvZi4gRXJpYyBBLiBTdWVzcyIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKVG9kYXkgd2UgYXJlIGdvaW5nIHRvIHRha2UgYSBsb29rIGF0IGEgbnVtYmVyIG9mIHRoZSB0aW1lIHNlcmllcyBkYXRhc2V0LCB0aWJibGVzLCB0aGF0IGFyZSB1c2VkIGluIHRoZSBbZnBwM10oaHR0cHM6Ly9vdGV4dHMuY29tL2ZwcDMvKSBib29rLgoKVGhlIGZpcnN0IGRhdGFzdCB0byBsb29rIGF0IGlzIHRoZSAqKmJlZXIqKiBkYXRhLgoKYGBge3J9CmxpYnJhcnkoZnBwMykKYGBg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