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(13.92,13.22,13.31,12.91,13.19,12.92,13.43,13.72,13.97,14.91,14.46,14.12,14.23,15.04,14.80,14.49,15.14,14.34,15.12,15.14,14.34,14.36,14.91,15.56,16.50,15.57,15.14,15.19,15.07,14.48,14.27,14.72,14.65,14.38,13.95,14.85,14.87,14.83,15.03,15.47,16.21,16.55,17.04,17.22,17.47,17.75,17.84,18.47,18.38,18.55,18.39,18.88,20.21,19.67,20.09,18.78,19.74,20.64,20.34,21.75,22.10,22.81,22.91,22.46,21.78,25.05,23.70,23.02,24.34,24.15,25.85,26.42,26.54,26.36,26.99,27.52,26.63,26.26,24.86,26.84,26.57,24.67,27.24,27.77,27.61,27.27,28.46,26.97,29.95,29.88,29.67,31.19,30.24,30.03,31.02,30.45,31.70,32.10,32.32,32.18,33.43,33.07,35.32,35.17,35.29,37.89,38.32,37.07,39.77,39.20,40.46,44.95,41.69,41.88,45.86) > x <- c(0.95,0.98,1.23,1.17,0.84,0.74,0.65,0.91,1.19,1.30,1.53,1.94,1.79,1.95,2.26,2.04,2.16,2.75,2.79,2.88,3.36,2.97,3.10,2.49,2.20,2.25,2.09,2.79,3.14,2.93,2.65,2.67,2.26,2.35,2.13,2.18,2.90,2.63,2.67,1.81,1.33,0.88,1.28,1.26,1.26,1.29,1.10,1.37,1.21,1.74,1.76,1.48,1.04,1.62,1.49,1.79,1.8,1.58,1.86,1.74,1.59,1.26,1.13,1.92,2.61,2.26,2.41,2.26,2.03,2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64,1.66,1.77,1.82,1.78,1.28,1.29,1.37,1.12,1.51,2.24,2.94,3.09,3.46,3.64,4.39,4.15,5.21,5.80,5.91) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > 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] -0.05 -0.02 0.23 0.17 -0.16 -0.26 -0.35 -0.09 0.19 0.30 0.53 0.94 [13] 0.79 0.95 1.26 1.04 1.16 1.75 1.79 1.88 2.36 1.97 2.10 1.49 [25] 1.20 1.25 1.09 1.79 2.14 1.93 1.65 1.67 1.26 1.35 1.13 1.18 [37] 1.90 1.63 1.67 0.81 0.33 -0.12 0.28 0.26 0.26 0.29 0.10 0.37 [49] 0.21 0.74 0.76 0.48 0.04 0.62 0.49 0.79 0.80 0.58 0.86 0.74 [61] 0.59 0.26 0.13 0.92 1.61 1.26 1.41 1.26 1.03 1.86 1.55 1.27 [73] 1.26 1.57 2.07 1.76 1.51 1.87 2.14 2.11 2.16 1.47 1.57 1.89 [85] 1.63 1.38 0.69 0.96 1.19 0.87 0.60 0.63 0.22 0.21 0.49 0.64 [97] 0.66 0.77 0.82 0.78 0.28 0.29 0.37 0.12 0.51 1.24 1.94 2.09 [109] 2.46 2.64 3.39 3.15 4.21 4.80 4.91 > y [1] 12.92 12.22 12.31 11.91 12.19 11.92 12.43 12.72 12.97 13.91 13.46 13.12 [13] 13.23 14.04 13.80 13.49 14.14 13.34 14.12 14.14 13.34 13.36 13.91 14.56 [25] 15.50 14.57 14.14 14.19 14.07 13.48 13.27 13.72 13.65 13.38 12.95 13.85 [37] 13.87 13.83 14.03 14.47 15.21 15.55 16.04 16.22 16.47 16.75 16.84 17.47 [49] 17.38 17.55 17.39 17.88 19.21 18.67 19.09 17.78 18.74 19.64 19.34 20.75 [61] 21.10 21.81 21.91 21.46 20.78 24.05 22.70 22.02 23.34 23.15 24.85 25.42 [73] 25.54 25.36 25.99 26.52 25.63 25.26 23.86 25.84 25.57 23.67 26.24 26.77 [85] 26.61 26.27 27.46 25.97 28.95 28.88 28.67 30.19 29.24 29.03 30.02 29.45 [97] 30.70 31.10 31.32 31.18 32.43 32.07 34.32 34.17 34.29 36.89 37.32 36.07 [109] 38.77 38.20 39.46 43.95 40.69 40.88 44.86 > postscript(file="/var/www/html/rcomp/tmp/1cdc61228166923.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.005 -0.006 -0.009 -0.026 -0.042 -0.051 -0.065 -0.068 -0.056 -0.027 0.007 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.051 0.094 0.151 0.200 0.275 0.362 0.440 0.418 0.406 0.395 0.368 5 6 7 8 9 10 11 12 13 14 15 0.344 0.320 0.292 0.275 0.249 0.222 0.207 0.197 0.179 0.168 0.158 16 17 0.148 0.142 > 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/2mh5s1228166923.tab") > > system("convert tmp/1cdc61228166923.ps tmp/1cdc61228166923.png") > > > proc.time() user system elapsed 0.395 0.163 0.819