R 언어 그래 픽: 시간 서열 분석 ggplot 2 ACF PACF 그리 기
2851 단어 빅 데이터 언어 - R 언어
방법 1
Acf(DATA, type = "correlation")
Acf(DATA, type = "partial") 방법 2
library(ggfortify)
autoplot(acf(DATA, plot = FALSE)) 방법 3 운 용 ggplot 2 (이런 방식 을 추천 합 니 다)
bacf DATA, plot = FALSE)
bacfdf bacf, data.frame(lag, acf))
ggplot(data = bacfdf, mapping = aes(x = lag, y = acf)) +
geom_segment(mapping = aes(xend = lag, yend = 0),color='blue',size=5,alpha=I(1/2)) +
geom_hline(aes(yintercept = 0.05), linetype = 2, color = 'darkblue')+ geom_hline(aes(yintercept=0))
# pacf
bpacf DATA, plot = FALSE)
bpacf bpacf, data.frame(lag, acf))
ggplot(data = bpacf, mapping = aes(x = lag, y = acf)) +
geom_segment(mapping = aes(xend = lag, yend = 0),color='blue',size=5,alpha=I(1/2)) +
geom_hline(aes(yintercept = 0.05), linetype = 2, color = 'darkblue')+ geom_hline(aes(yintercept=0))
방법
library("forecast")
forecast::ggtsdisplay(DATA) 방법
ggAcf(DATA)
ggPacf(DATA)