[R] How to analyse and model 2 time series, when one series needs to be differenced?

Bernardo Rangel Tura tura at centroin.com.br
Sun Feb 1 09:28:54 CET 2009


On Mon, 2009-01-26 at 08:52 +0000, Andreas Klein wrote:
> Hello.
> 
> How can I analyse the cross-correlation between two time series with ccf, if one of the time series need to be differenced, so it is stationary?
> The two time series differ when in length and maybe ccf produces not the correct cross-correlation?!
> 
> Another problem:
> How can I model the two time series as an VARI-process with the dse package? - 
> So how can I handle it, that one series has to be differenced and the other series not?
> 
> I hope you can give me some hints.
> 
> 
> Regards,
> Andreas.

Hi Andreas,

If I understand your problem this script solve tour question

t<-1:15
x<-rnorm(10)
y<-.2-.3*t+rnorm(15)
y.dif<-diff(y,1)
ccf(x,y.dif)

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil




More information about the R-help mailing list