BT Question Set P1-T2-20-21-2: Autocorrelation function (ACF)

20.21.2. Shown below is the autocorrelation function (ACF) for a time series object that contains the total quarterly beer production in Australia (in megalitres) from 1956:Q1 to 2010:Q2 (source: https://cran.r-project.org/web/packages/fpp2/index.html).

library(forecast)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
# install.packages("fpp2")
library(fpp2)
## -- Attaching packages ---------------------------------------------------------------------------------------- fpp2 2.4 --
## v ggplot2   3.3.2     v expsmooth 2.3  
## v fma       2.4
## 
beer2 <- ausbeer
beer2 <- window(ausbeer, start=1992)

acf_beer2 <- ggAcf(beer2) + 
  xlab("Lags") + 
  theme_bw() +
  geom_segment(size = 3) +
  theme(
    text = element_text(family = "Calibri"),
    plot.title = element_blank(),
    axis.title.x = element_text(size = 14, face = "bold"),
    axis.title.y = element_text(size = 14, face = "bold"),
    axis.text.x = element_text(size = 14, face = "bold"),
    axis.text.y = element_text(size = 14, face= "bold"),
    panel.grid.major.x = element_blank(),
    panel.grid.major.y = element_line(color="grey"),
    panel.border = element_blank()
  )

acf_beer2
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database

David Harper
David Harper
Founder & CEO of Bionic Turtle

I teach financial risk and enjoy learning data science

Related