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(133.52,153.2,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.6,156.56,154.82,151.11,149.65,148.99,148.53,146.7,145.11,142.7,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.6,126.12,124.2,121.65,121.57,118.38) > x <- c(1.3322,1.4369,1.4975,1.577,1.5553,1.5557,1.575,1.5527,1.4748,1.4718,1.457,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.265,1.277,1.2271,1.202,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.249,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) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '2' > 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.3322 0.4369 0.4975 0.5770 0.5553 0.5557 0.5750 0.5527 0.4748 [10] 0.4718 0.4570 0.4684 0.4227 0.3896 0.3622 0.3716 0.3419 0.3511 [19] 0.3516 0.3242 0.3074 0.2999 0.3213 0.2881 0.2611 0.2727 0.2811 [28] 0.2684 0.2650 0.2770 0.2271 0.2020 0.1938 0.2103 0.1856 0.1786 [37] 0.2015 0.2256 0.2292 0.2037 0.2165 0.2694 0.2938 0.3201 0.3014 [46] 0.3119 0.3408 0.2991 0.2490 0.2218 0.2176 0.2266 0.2138 0.2007 [55] 0.1985 0.2262 0.2646 0.2613 0.2286 0.1702 0.1692 0.1222 0.1139 [64] 0.1372 0.1663 0.1582 0.0848 0.0807 0.0773 0.0622 0.0183 0.0014 [73] -0.0189 -0.0192 > y [1] 132.52 152.20 162.63 167.45 165.26 161.31 160.56 155.59 156.97 157.68 [11] 162.55 161.89 163.95 158.82 158.05 165.76 163.55 162.22 159.68 154.24 [21] 156.60 155.56 153.82 150.11 148.65 147.99 147.53 145.70 144.11 141.70 [31] 142.59 139.96 139.77 138.81 139.58 138.59 137.05 135.06 134.98 133.75 [41] 131.22 134.37 137.84 137.83 135.55 134.63 138.14 135.09 134.97 133.51 [51] 133.54 133.08 131.86 133.48 128.08 132.13 133.78 133.13 131.43 126.84 [61] 127.12 127.94 131.38 133.99 137.05 134.83 129.12 127.16 127.60 125.12 [71] 123.20 120.65 120.57 117.38 > postscript(file="/var/www/html/freestat/rcomp/tmp/156ad1228221819.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 0.327 0.376 0.418 0.468 0.515 0.559 0.591 0.612 0.642 0.669 0.695 0.716 0.750 -2 -1 0 1 2 3 4 5 6 7 8 9 10 0.792 0.841 0.866 0.804 0.733 0.657 0.590 0.528 0.469 0.425 0.388 0.358 0.336 11 12 13 14 15 0.309 0.286 0.252 0.219 0.180 > 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/2pmxs1228221819.tab") > > system("convert tmp/156ad1228221819.ps tmp/156ad1228221819.png") > > > proc.time() user system elapsed 0.549 0.224 0.643