我使用传输函数使用R分析我的数据。在参考书中,我找到了这段代码:
xt<-data[,1]
yt<-data[,2]
acf(xt,lag.max=25,type="correlation",main="ACF for xt")
acf(xt, lag.max=25,type="partial",main="PACF for xt", ylab="PACF")
从ACF和PACF图中,似乎xt有AR(1)。然后,将AR(1)拟合到xt:
xt.ar1<-arima(xt,order=c(1, 0, 0),include.mean=FALSE)
xt.ar1
Call:
arima(x = xt, order = c(1, 0, 0), include.mean = FALSE)
Coefficients:
ar1
0.7292
s.e. 0.0686
sigma^2 estimated as 0.01009: log likelihood = 87.54, aic = -171.08
在检查残差看起来是否合适之后,下一步是使用系数为0.73的AR(1)对两个系列进行预处理以显示CCF:
T<-length(xt)
alphat<-xt[2:T]-0.73*xt[1:(T-1)]
betat<- yt[2:T]-0.73*yt[1:(T-1)]
ralbe<-ccf(betat,alphat,main='CCF of alpha(t) and beta(t)', ylab='CCF')
abline(v=0,col='blue')
如果我有另一组数据,xt适合ARIMA(2,0,2),我该怎么做prewhitening?如何计算alphat
和betat
?