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 = '0' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > 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.0590 0.1047 0.0606 0.0795 -0.0217 0.0004 0.0193 -0.0223 -0.0779 [10] -0.0030 -0.0148 0.0114 -0.0457 -0.0331 -0.0274 0.0094 -0.0297 0.0092 [19] 0.0005 -0.0274 -0.0168 -0.0075 0.0214 -0.0332 -0.0270 0.0116 0.0084 [28] -0.0127 -0.0034 0.0120 -0.0499 -0.0251 -0.0082 0.0165 -0.0247 -0.0070 [37] 0.0229 0.0241 0.0036 -0.0255 0.0128 0.0529 0.0244 0.0263 -0.0187 [46] 0.0105 0.0289 -0.0417 -0.0501 -0.0272 -0.0042 0.0090 -0.0128 -0.0131 [55] -0.0022 0.0277 0.0384 -0.0033 -0.0327 -0.0584 -0.0010 -0.0470 -0.0083 [64] 0.0233 0.0291 -0.0081 -0.0734 -0.0041 -0.0034 -0.0151 -0.0439 -0.0169 [73] -0.0203 -0.0003 -0.0030 0.0144 -0.0368 -0.0384 -0.0312 -0.0100 -0.0058 [82] 0.0133 0.0091 -0.0041 0.0176 0.0052 -0.0106 -0.0398 -0.0075 0.0210 [91] 0.0178 0.0175 0.0122 0.0166 -0.0410 -0.0409 -0.0012 0.0169 0.0320 [100] 0.0356 0.0095 -0.0432 0.0410 0.0173 0.0191 0.0303 -0.0027 0.0228 [109] 0.0368 -0.0205 0.0103 -0.0251 0.0025 0.0250 0.0076 0.0179 0.0325 [118] 0.0400 > y [1] 10.24 19.68 10.43 4.82 -2.19 -3.95 -0.75 -4.97 1.38 0.71 4.87 -0.66 [13] 2.06 -5.13 -0.77 7.71 -2.21 -1.33 -2.54 -5.44 2.36 -1.04 -1.74 -3.71 [25] -1.46 -0.66 -0.46 -1.83 -1.59 -2.41 0.89 -2.63 -0.19 -0.96 0.77 -0.99 [37] -1.54 -1.99 -0.08 -1.23 -2.53 3.15 3.47 -0.01 -2.28 -0.92 3.51 -3.05 [49] -0.12 -1.46 0.03 -0.46 -1.22 1.62 -5.40 4.05 1.65 -0.65 -1.70 -4.59 [61] 0.28 0.82 3.44 2.61 3.06 -2.22 -5.71 -1.96 0.44 -2.48 -1.92 -2.55 [73] -0.08 -3.19 -2.07 0.80 0.69 -1.94 -0.05 -1.06 1.48 0.89 -3.74 -4.70 [85] 1.18 -1.66 1.14 -2.13 -2.91 2.20 3.86 -0.03 -3.25 2.49 -8.96 -7.35 [97] -0.52 0.37 4.65 3.63 -0.68 -2.62 1.83 2.67 5.05 -1.11 -2.81 4.53 [109] 5.27 -1.13 7.71 3.61 1.61 4.39 -1.55 2.04 0.58 0.57 > postscript(file="/var/www/html/freestat/rcomp/tmp/1xhzt1228565043.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.060 -0.048 0.064 0.077 0.028 0.055 0.049 0.053 0.156 0.142 0.084 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.087 0.172 -0.079 -0.087 -0.036 0.277 0.609 0.365 0.144 0.097 -0.007 5 6 7 8 9 10 11 12 13 14 15 0.054 -0.057 -0.029 -0.079 0.029 -0.047 -0.086 -0.018 -0.073 -0.016 -0.096 16 17 -0.054 0.013 > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/2ku991228565044.tab") > > system("convert tmp/1xhzt1228565043.ps tmp/1xhzt1228565043.png") > > > proc.time() user system elapsed 0.546 0.213 0.599