R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > y <- c(15.9,15.5,15.3,14.5,14.4,14.7,19.1,21.6,20.2,17.9,15.7,14.5,14.1,13.9,14.2,15.3,15.4,15.2,16.5,18.2,18.6,21.0,19.2,18.7,18.4,17.8,17.2,16.2,15.5,15.3,18.3,19.2,19.0,18.7,18.1,18.5,21.1,21.0,20.4,19.5,18.6,18.8,23.7,24.8,25.0,23.6,22.3,21.8,20.8,19.7,18.3,17.4,17.0,18.1,23.9,25.6,25.3,23.6,21.9,21.4,20.6,20.5,20.2,20.6,19.7,19.3,22.8,23.5,23.8,22.6,22.0,21.7,20.7,20.2,19.1,19.5,18.7,18.6,22.2,23.2,23.5,21.3,20.0,18.7,18.9,18.3,18.4,19.9,19.2,18.5,20.9,20.5,19.4,18.1,17.0,17.0,17.3,16.7,15.5,15.3,13.7,14.1,17.3,18.1,18.1) > x <- c(7.5,7.2,6.9,6.7,6.4,6.3,6.8,7.3,7.1,7.1,6.8,6.5,6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.2,8.3,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8.0,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9,8.0,8.0,7.9,8.0,7.7,7.2,7.5,7.3,7.0,7.0,7.0,7.2,7.3,7.1,6.8,6.6,6.2,6.2,6.8,6.9,6.8) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > par3 = '0' > par2 = '0' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2008), Cross Correlation Function (v1.0.6) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_cross.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > par6 <- as.numeric(par6) > par7 <- as.numeric(par7) > if (par1 == 0) { + x <- log(x) + } else { + x <- (x ^ par1 - 1) / par1 + } > if (par5 == 0) { + y <- log(y) + } else { + y <- (y ^ par5 - 1) / par5 + } > if (par2 > 0) x <- diff(x,lag=1,difference=par2) > if (par6 > 0) y <- diff(y,lag=1,difference=par6) > if (par3 > 0) x <- diff(x,lag=par4,difference=par3) > if (par7 > 0) y <- diff(y,lag=par4,difference=par7) > x [1] 6.5 6.2 5.9 5.7 5.4 5.3 5.8 6.3 6.1 6.1 5.8 5.5 5.3 5.1 5.1 5.3 5.3 5.0 [19] 5.2 5.4 5.8 6.5 6.5 6.6 6.6 6.4 6.3 6.1 5.9 5.8 6.5 6.6 6.8 7.0 7.1 7.2 [37] 7.3 7.2 7.0 6.9 6.6 6.6 7.2 7.3 7.4 7.4 7.4 7.6 7.9 7.8 7.3 6.5 6.2 6.5 [55] 7.8 8.3 8.3 7.7 7.2 7.3 7.5 7.6 7.6 7.2 7.1 7.0 7.6 7.7 7.8 7.5 7.4 7.5 [73] 7.7 7.7 7.6 7.5 7.3 7.1 7.2 7.1 7.1 6.9 6.9 6.9 7.0 7.0 6.9 7.0 6.7 6.2 [91] 6.5 6.3 6.0 6.0 6.0 6.2 6.3 6.1 5.8 5.6 5.2 5.2 5.8 5.9 5.8 > y [1] 14.9 14.5 14.3 13.5 13.4 13.7 18.1 20.6 19.2 16.9 14.7 13.5 13.1 12.9 13.2 [16] 14.3 14.4 14.2 15.5 17.2 17.6 20.0 18.2 17.7 17.4 16.8 16.2 15.2 14.5 14.3 [31] 17.3 18.2 18.0 17.7 17.1 17.5 20.1 20.0 19.4 18.5 17.6 17.8 22.7 23.8 24.0 [46] 22.6 21.3 20.8 19.8 18.7 17.3 16.4 16.0 17.1 22.9 24.6 24.3 22.6 20.9 20.4 [61] 19.6 19.5 19.2 19.6 18.7 18.3 21.8 22.5 22.8 21.6 21.0 20.7 19.7 19.2 18.1 [76] 18.5 17.7 17.6 21.2 22.2 22.5 20.3 19.0 17.7 17.9 17.3 17.4 18.9 18.2 17.5 [91] 19.9 19.5 18.4 17.1 16.0 16.0 16.3 15.7 14.5 14.3 12.7 13.1 16.3 17.1 17.1 > postscript(file="/var/www/html/rcomp/tmp/1hr531228234580.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > (r <- ccf(x,y,main='Cross Correlation Function',ylab='CCF',xlab='Lag (k)')) Autocorrelations of series 'X', by lag -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 0.101 0.114 0.168 0.258 0.367 0.470 0.490 0.490 0.494 0.494 0.494 0.470 0.421 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 0.396 0.439 0.552 0.709 0.834 0.814 0.736 0.656 0.583 0.537 0.485 0.412 0.352 9 10 11 12 13 14 15 16 17 0.330 0.352 0.411 0.459 0.426 0.374 0.329 0.292 0.264 > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Cross Correlation Function',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'Value',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Box-Cox transformation parameter (lambda) of X series',header=TRUE) > a<-table.element(a,par1) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Degree of non-seasonal differencing (d) of X series',header=TRUE) > a<-table.element(a,par2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Degree of seasonal differencing (D) of X series',header=TRUE) > a<-table.element(a,par3) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Seasonal Period (s)',header=TRUE) > a<-table.element(a,par4) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Box-Cox transformation parameter (lambda) of Y series',header=TRUE) > a<-table.element(a,par5) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Degree of non-seasonal differencing (d) of Y series',header=TRUE) > a<-table.element(a,par6) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Degree of seasonal differencing (D) of Y series',header=TRUE) > a<-table.element(a,par7) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'k',header=TRUE) > a<-table.element(a,'rho(Y[t],X[t+k])',header=TRUE) > a<-table.row.end(a) > mylength <- length(r$acf) > myhalf <- floor((mylength-1)/2) > for (i in 1:mylength) { + a<-table.row.start(a) + a<-table.element(a,i-myhalf-1,header=TRUE) + a<-table.element(a,r$acf[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/2dvk41228234581.tab") > > system("convert tmp/1hr531228234580.ps tmp/1hr531228234580.png") > > > proc.time() user system elapsed 0.401 0.168 0.459