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(123.28,133.52,153.20,163.63,168.45,166.26,162.31,161.56,156.59,157.97,158.68,163.55,162.89,164.95,159.82,159.05,166.76,164.55,163.22,160.68,155.24,157.60,156.56,154.82,151.11,149.65,148.99,148.53,146.70,145.11,142.70,143.59,140.96,140.77,139.81,140.58,139.59,138.05,136.06,135.98,134.75,132.22,135.37,138.84,138.83,136.55,135.63,139.14,136.09,135.97,134.51,134.54,134.08,132.86,134.48,129.08,133.13,134.78,134.13,132.43,127.84,128.12,128.94,132.38,134.99,138.05,135.83,130.12,128.16,128.60,126.12,124.20,121.65,121.57,118.38,116.31,117.11,117.80,115.86,115.81,114.75,116.23,117.12,113.38,108.68,109.86,108.20,109.34,107.21,104.30,106.50,110.36,110.33,107.08,109.57,100.61,93.26,92.74,93.11,97.76,101.39,100.71,98.09,99.92,102.59,107.64,106.53,103.72,108.25,113.52,112.39,120.10,123.71,125.32,129.71,128.16,130.20,130.78,131.35) > x <- c(1.2732,1.3322,1.4369,1.4975,1.5770,1.5553,1.5557,1.5750,1.5527,1.4748,1.4718,1.4570,1.4684,1.4227,1.3896,1.3622,1.3716,1.3419,1.3511,1.3516,1.3242,1.3074,1.2999,1.3213,1.2881,1.2611,1.2727,1.2811,1.2684,1.2650,1.2770,1.2271,1.2020,1.1938,1.2103,1.1856,1.1786,1.2015,1.2256,1.2292,1.2037,1.2165,1.2694,1.2938,1.3201,1.3014,1.3119,1.3408,1.2991,1.2490,1.2218,1.2176,1.2266,1.2138,1.2007,1.1985,1.2262,1.2646,1.2613,1.2286,1.1702,1.1692,1.1222,1.1139,1.1372,1.1663,1.1582,1.0848,1.0807,1.0773,1.0622,1.0183,1.0014,0.9811,0.9808,0.9778,0.9922,0.9554,0.9170,0.8858,0.8758,0.8700,0.8833,0.8924,0.8883,0.9059,0.9111,0.9005,0.8607,0.8532,0.8742,0.8920,0.9095,0.9217,0.9383,0.8973,0.8564,0.8552,0.8721,0.9041,0.9397,0.9492,0.9060,0.9470,0.9643,0.9834,1.0137,1.0110,1.0338,1.0706,1.0501,1.0604,1.0353,1.0378,1.0628,1.0704,1.0883,1.1208,1.1608) > par7 = '2' > par6 = '2' > par5 = '1' > par4 = '12' > par3 = '2' > par2 = '2' > 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.0591 -0.0587 -0.0758 -0.0137 -0.0403 -0.0256 0.0390 -0.0599 0.0810 [10] -0.1108 0.1531 -0.0396 -0.0634 -0.0084 0.0499 -0.0194 0.0482 0.0866 [19] -0.0756 -0.0682 -0.0109 0.1297 -0.1606 -0.0620 0.0591 0.0608 0.0503 [28] -0.0891 -0.0651 0.0060 0.0509 0.1176 -0.0754 -0.1074 0.1332 0.1041 [37] -0.0906 -0.0278 -0.0239 0.0877 0.0035 -0.1156 0.0114 -0.0657 0.1009 [46] 0.0484 0.0078 -0.1266 0.1349 -0.0571 -0.0326 -0.0846 0.0725 0.1487 [55] -0.0875 0.0135 0.0008 0.0240 -0.0929 0.0859 -0.0984 0.0283 -0.0324 [64] 0.1405 -0.0055 -0.0829 0.0266 -0.0130 -0.0455 -0.0780 0.0535 -0.0071 [73] 0.0629 0.0440 0.0794 -0.1419 -0.1113 0.0978 -0.0019 0.0166 0.0215 [82] 0.0780 0.0121 -0.0437 -0.1059 -0.0152 -0.0718 0.1121 0.1564 -0.1890 [91] 0.0574 0.0057 -0.0105 > y [1] 24.62 -17.77 -23.94 13.07 -4.34 8.92 -1.94 -6.81 5.36 7.29 [11] -3.35 -2.33 -9.24 5.87 10.07 -11.70 8.20 -7.49 0.66 0.65 [21] -0.50 0.27 -5.01 6.28 0.36 -2.13 0.44 2.08 -9.34 -4.36 [31] 12.89 4.58 -5.79 -8.18 8.47 -1.54 2.77 1.55 -1.00 0.67 [41] -5.28 10.87 -18.63 4.93 3.04 7.09 -1.41 -4.34 -5.53 -2.63 [51] 4.04 -1.77 10.77 1.85 0.94 -4.66 2.95 -6.80 -2.59 5.81 [61] 3.92 3.18 -9.84 -0.11 5.09 -5.61 1.88 -5.90 4.00 -1.63 [71] 2.90 -2.46 3.46 -0.20 8.39 -2.86 -14.79 3.02 7.61 11.36 [81] -18.23 16.57 3.16 -7.04 -11.02 3.08 -5.33 5.84 11.77 -13.18 [91] -1.98 -9.44 18.05 > postscript(file="/var/www/html/rcomp/tmp/10fk01228229589.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 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 0.008 0.195 -0.019 0.036 -0.252 0.099 0.034 -0.022 -0.012 -0.020 0.085 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.064 0.031 -0.225 -0.086 -0.001 0.341 -0.015 -0.169 0.124 -0.105 0.094 6 7 8 9 10 11 12 13 14 15 16 -0.207 0.113 -0.012 0.029 0.037 -0.010 -0.019 -0.008 0.047 -0.148 0.055 > 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/2n21h1228229590.tab") > > system("convert tmp/10fk01228229589.ps tmp/10fk01228229589.png") > > > proc.time() user system elapsed 0.381 0.186 0.448