White noise

Forecasting in R

Rob J. Hyndman

Professor of Statistics at Monash University

White noise

set.seed(3)          # Reproducibility
wn <- ts(rnorm(36))  # White noise
autoplot(wn)         # Plot!

ch1_vid3_white_noise.png

"White noise" is just a time series of iid data

Forecasting in R

White noise ACF

ggAcf(wn) +
    ggtitle("Sample ACF for white noise")

ch1_vid3_slides.008.png

Forecasting in R

White noise ACF

ggAcf(wn) +
    ggtitle("Sample ACF for white noise")

ch1_vid3_slides.009.png

Forecasting in R

White noise ACF

ggAcf(wn) +
    ggtitle("Sample ACF for white noise")

ch1_vid3_slides.010.png

Forecasting in R

White noise ACF

ggAcf(wn) +
    ggtitle("Sample ACF for white noise")

ch1_vid3_slides.011.png

Forecasting in R

Example: Pigs slaughtered

pigs <- window(pigs, start=1990)
autoplot(pigs/1000) +
  xlab("Year") +
  ylab("thousands") +
  ggtitle("Monthly number of pigs slaughtered in Victoria")

ch1_vid3_pigs.png

Forecasting in R

Example: Pigs slaughtered

ggAcf(pigs) +
  ggtitle("ACF of monthly pigs slaughtered
          in Victoria")

ch1_vid3_slides.017.png

Forecasting in R

Example: Pigs slaughtered

ggAcf(pigs) +
  ggtitle("ACF of monthly pigs slaughtered
          in Victoria")

ch1_vid3_slides.018.png

Forecasting in R

Example: Pigs slaughtered

ggAcf(pigs) +
  ggtitle("ACF of monthly pigs slaughtered
          in Victoria")

ch1_vid3_slides.019.png

Forecasting in R

Ljung-Box test

The Ljung-Box test considers the first h autocorrelation values together.

A significant test (small p-value) indicates the data are probably not white noise.

Box.test(pigs, lag = 24, fitdf = 0, type = "Lj")
Box-Ljung test
data:  pigs
X-squared = 634.15, df = 24, p-value < 2.2e-16
Forecasting in R

White noise summary

  • White noise is a time series that is purely random
  • We can test for white noise by looking at an ACF plot or by doing a Ljung-Box test
Forecasting in R

Let's practice!

Forecasting in R

Preparing Video For Download...