ggplot2繪制 arima診斷圖
library(ggfortify)
autoplot(acf(gold[,2], plot = FALSE))
ggtsdiag(auto.arima(gold[,2]))
將數據改為時間格式
gold <- as.xts(gold[, 2], order.by = gold[, 1])
設置時間格式 繪制時間趨勢圖
gdp <- ts((0.001 * (gdp[, 2])), frequency = 4, start = c(1992, 1))
plot(gdp)
每年每月圖
monthplot(gdp, xlab="", ylab="")
每年每季度圖
seasonplot(gdp, s = 4, year.labels = T, col = rainbow(12))