Guest User

Untitled

a guest
Oct 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. # First trial - CROSS-CORRELATION
  2. # testing for stationarity (p-value>0.05 indicate non-stationarity):
  3. adf.test(data$count1)# non-stationary
  4. > adf.test(data$count2)# non-stationary
  5. # I get the differences (lag=1) of each time series:
  6. diffcount1<- diff(data$count1,1)
  7. > diffcount2<- diff(data$count2,1)
  8. # testing for stationarity (p-value>0.05) indicates now the series are now stationary:
  9. (acf(diffcount1))# now it is stationary
  10. (acf(diffcount2))# now it is stationary
  11. (ccf1<- ccf(y=diffcount2,x=diffcount1))# cross correlation test
  12.  
  13. library(tseries)
  14. cointegration(data$count1,data$count2)
Add Comment
Please, Sign In to add comment