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 = '1' > par2 = '1' > 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] 0.000000e+00 1.000000e-01 -1.000000e-01 2.000000e-01 6.000000e-01 [6] 0.000000e+00 -7.000000e-01 2.000000e-01 -3.000000e-01 0.000000e+00 [11] 1.000000e-01 0.000000e+00 2.000000e-01 2.000000e-01 -2.000000e-01 [16] -3.000000e-01 5.000000e-01 0.000000e+00 2.000000e-01 3.000000e-01 [21] -7.000000e-01 1.000000e-01 -1.000000e-01 -2.000000e-01 1.000000e-01 [26] -1.000000e-01 8.881784e-16 1.000000e-01 8.000000e-01 -6.000000e-01 [31] 1.000000e-01 0.000000e+00 -1.000000e-01 0.000000e+00 1.776357e-15 [36] -2.000000e-01 -1.000000e-01 1.000000e-01 -2.000000e-01 3.000000e-01 [41] 6.000000e-01 -5.000000e-01 -1.776357e-15 -1.000000e-01 0.000000e+00 [46] 2.000000e-01 1.000000e-01 -4.000000e-01 -4.000000e-01 -3.000000e-01 [51] 5.000000e-01 6.000000e-01 1.000000e+00 -8.000000e-01 -5.000000e-01 [56] -6.000000e-01 1.000000e-01 6.000000e-01 1.000000e-01 -1.000000e-01 [61] -1.000000e-01 -4.000000e-01 3.000000e-01 0.000000e+00 7.000000e-01 [66] -5.000000e-01 1.776357e-15 -4.000000e-01 2.000000e-01 2.000000e-01 [71] 1.000000e-01 -2.000000e-01 -1.000000e-01 0.000000e+00 -1.000000e-01 [76] -1.776357e-15 3.000000e-01 -2.000000e-01 1.000000e-01 -2.000000e-01 [81] 2.000000e-01 0.000000e+00 1.000000e-01 -1.000000e-01 -1.000000e-01 [86] 2.000000e-01 -4.000000e-01 -2.000000e-01 8.000000e-01 -5.000000e-01 [91] -1.000000e-01 3.000000e-01 0.000000e+00 2.000000e-01 -1.000000e-01 [96] -3.000000e-01 -1.000000e-01 1.000000e-01 -2.000000e-01 4.000000e-01 [101] 6.000000e-01 -5.000000e-01 -2.000000e-01 > 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/18nj21228234951.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 0.080 0.082 0.034 -0.038 -0.216 -0.059 0.005 -0.010 0.000 -0.059 -0.066 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.043 0.154 0.170 0.097 -0.095 -0.354 -0.140 0.002 0.051 0.071 -0.023 5 6 7 8 9 10 11 12 13 14 15 -0.049 0.023 0.089 0.111 0.092 -0.035 -0.211 -0.057 0.012 0.039 0.017 16 17 -0.088 -0.097 > 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/2uuun1228234951.tab") > > system("convert tmp/18nj21228234951.ps tmp/18nj21228234951.png") > > > proc.time() user system elapsed 0.397 0.179 0.461