Rで学ぶ予測入門
Rob J. Hyndman
Professor of Statistics at Monash University
set.seed(3) # Reproducibility
wn <- ts(rnorm(36)) # White noise
autoplot(wn) # Plot!

「ホワイトノイズ」は独立同分布(iid)の時系列です
ggAcf(wn) +
ggtitle("Sample ACF for white noise")

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

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

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

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

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

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

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

Ljung-Box 検定は最初の h 個の自己相関をまとめて評価します。
有意(p 値が小さい)なら、データはホワイトノイズではない可能性が高い。
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
Rで学ぶ予測入門