Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # First trial - CROSS-CORRELATION
- # testing for stationarity (p-value>0.05 indicate non-stationarity):
- adf.test(data$count1)# non-stationary
- > adf.test(data$count2)# non-stationary
- # I get the differences (lag=1) of each time series:
- diffcount1<- diff(data$count1,1)
- > diffcount2<- diff(data$count2,1)
- # testing for stationarity (p-value>0.05) indicates now the series are now stationary:
- (acf(diffcount1))# now it is stationary
- (acf(diffcount2))# now it is stationary
- (ccf1<- ccf(y=diffcount2,x=diffcount1))# cross correlation test
- library(tseries)
- cointegration(data$count1,data$count2)
Add Comment
Please, Sign In to add comment