ACF和PACF解释

时间:2017-04-12 12:58:58

标签: r time-series forecasting

我很难阅读ACF和PACF图并确定模型的滞后。

我预测每日电力负荷数据如下:

           date  temperature   load   weekday month weekend day
1    2010-01-01         -28 256131       5    01       0   1
2    2010-01-02         -24 277749       6    01       1   2
3    2010-01-03         -53 264166       0    01       1   3
4    2010-01-04         -42 319847       1    01       0   4
5    2010-01-05         -17 321376       2    01       0   5

要获得ACF和PACF,我已执行以下操作:

#create time series     
NLdailyts <- ts(NLdaily$load, frequency =365.25, start = c(2010,1,1))
#difference time series 
NLdailytsdiff <- diff(NLdailyts,differences = 365.25)

#ACF plot in days 
## Calculate, but not plot, acf
acfpl<- acf(NLdailytsdiff, plot = FALSE)
## Transform the lags from years to days 
acfpl$lag <- acfpl$lag * 365.25
## Plot the acf 
plot(acfpl, xlab="Lag (days)")

#PACF plot in days 
## Calculate, but not plot, acf
pacfpl<- pacf(NLdailytsdiff, plot = FALSE)
## Transform the lags from years to days 
pacfpl$lag <- pacfpl$lag * 365
## Plot the acf 
plot(pacfpl, xlab="Lag (days)")

这给了我以下情节:

ACFPACF

编辑:我发现交替的正负值意味着数据是静止的。

我应该如何解读两者?我应该使用哪个滞后?

1 个答案:

答案 0 :(得分:2)

我认为我们需要确定ACF和PACF之间的差异。它们都显示了点和滞后点之间是否存在显着相关性。不同之处在于PACF考虑了每个中间滞后点之间的相关性。

看看ACF可能会误导哪些重要点。例如,如果y_(t-1)强相关,则该相关性可能出现在y_(t-2),y_(t-3)等处。

You can read this for more info.

查看您的PACF情节,您似乎想要使用AR(8)。但是,您还有每周数据,因此您可能希望设置每周季节性而不是每年季节性。

你可以做这样的事情

library(forecast)
NLdailyts <- ts(NLdaily$load, frequency = 7, start = c(2010,1,1))
fit = auto.arima(NLdailyts)

这应该确定自动使用的AR术语的数量。