R version 2.7.0 (2008-04-22) 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(24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68) > x <- c(0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '1' > par3 = '0' > par2 = '1' > par1 = '0.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.0376937393 -0.0145974333 0.0030570136 0.0003052383 0.0204618142 [6] 0.0167519045 0.0423736317 0.0142111442 0.0031751184 0.0038168837 [11] 0.0662230707 0.0070748449 -0.0256265619 -0.0209479182 0.0075069702 [16] 0.0415897318 0.0008684263 0.0495927952 0.0268492639 0.0026746478 [21] -0.0315197432 -0.0232932833 0.0018676263 0.0110575127 0.0107010269 [26] -0.0075136008 0.0035125453 0.0224883228 0.0402919009 0.0324836789 [31] -0.0224140433 -0.0082536862 0.0146581791 -0.0206697490 -0.0195174823 [36] -0.0435014206 -0.0107813786 0.0213780920 -0.0029937481 -0.0202477766 [41] -0.0195811526 0.0060215782 0.0209949713 -0.0139816844 0.0069700645 [46] 0.0210723552 0.0407652583 -0.0096705908 0.0027483545 0.0102076148 [51] -0.0067412344 -0.0093754577 0.0217040673 0.0261335570 -0.0167764040 [56] 0.0059076857 0.0131233113 0.0210854199 -0.0003813107 > y [1] 0.92 0.50 2.28 -1.03 -2.88 3.00 2.77 2.10 -2.46 -5.00 [11] 0.61 1.80 0.96 1.34 -2.63 2.13 -0.32 0.83 1.11 -0.18 [21] 2.15 0.52 3.94 -1.59 2.21 4.09 1.10 6.20 -4.53 -4.39 [31] 4.01 1.62 7.53 -0.12 -1.46 3.50 2.51 6.15 -0.19 -4.62 [41] -3.03 1.30 6.10 -1.81 1.30 5.17 3.85 -2.28 4.66 -0.08 [51] -10.09 -4.21 -0.59 3.06 -7.46 3.30 3.58 5.73 0.03 > postscript(file="/var/www/html/rcomp/tmp/18l431228165711.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.050 -0.048 -0.106 -0.062 0.006 0.021 0.068 0.086 -0.156 -0.057 0.002 -3 -2 -1 0 1 2 3 4 5 6 7 0.100 -0.206 -0.127 0.193 -0.061 -0.102 -0.207 0.207 0.042 -0.191 -0.001 8 9 10 11 12 13 14 -0.117 -0.098 0.039 0.129 0.078 -0.148 -0.090 > 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/2kv8v1228165711.tab") > > system("convert tmp/18l431228165711.ps tmp/18l431228165711.png") > > > proc.time() user system elapsed 1.167 0.285 1.231