Hi all,

I have two time series that I would like to correlate but as they are
autocorrelated, I am "pre-whitening" them first by fitting ARIMA models,
then correlating their residuals....as described in
https://onlinecourses.science.psu.edu/stat510/?q=node/75

However, http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm discusses some
issues with ARIMA in R. In particular, for issue 2, if there is any
differencing, a constant term is not included, but the solution is to 1)
input a series that has already been differenced and not include an order
for differencing in the function, or 2) include an xreg argument.

I have some sample code:

set.seed(66)
x = arima.sim(list(order=c(1,1,0), ar=.9), n=100) + 50
y=c(x[-1:-3],x[98:100])

# Method 1
m1a=arima(diff(x),order=c(1,0,0))
m1b=arima(diff(y),order=c(1,0,0))
a=ccf(resid(m1a),resid(m1b))


# Method 2
m2a=arima(x,order=c(1,1,0),xreg=1:length(x))
m2b=arima(y,order=c(1,1,0),xreg=1:length(y))
b=ccf(resid(m2a),resid(m2b))


My question is why do the two methods generate different results for the CCF
(one having a peak correlation at lag 4 and the other at lag 3, and the
correlations are also of slightly different values)? I am assuming Method 2
is the correct method since it gives the peak correlation at the correct lag
(lag 3), but I'm wondering why Method 1 does not work.

Could anyone explain this? Thanks in advance!
Emily

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to