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 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '1' > 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.1378 -0.0880 -0.0701 -0.0080 0.0088 -0.0188 -0.0051 0.0611 -0.0045 [10] 0.0362 -0.0446 0.0187 0.0447 0.0358 -0.0221 0.0263 0.0028 -0.0504 [19] 0.0023 0.0086 0.0240 -0.0461 0.0262 0.0499 0.0125 -0.0048 -0.0128 [28] 0.0162 0.0409 0.0743 0.0514 -0.0105 -0.0060 0.0536 -0.0347 -0.0730 [37] -0.0513 -0.0078 0.0345 -0.0256 -0.0660 -0.0266 0.0014 0.0571 -0.0138 [46] -0.0616 -0.0167 0.0491 -0.0198 -0.0041 0.0143 0.0419 0.0050 -0.0712 [55] -0.0318 -0.0418 -0.0118 -0.0112 0.0415 -0.0193 0.0467 > y [1] -24.81 -11.20 2.89 -0.02 2.62 -1.79 -0.47 0.98 -1.75 -6.61 [11] -3.05 -3.52 4.47 0.31 -9.54 0.62 -1.08 3.43 2.81 -2.55 [21] 0.08 2.51 2.72 -0.08 -1.33 0.38 0.60 -0.94 5.56 2.58 [31] 2.62 -2.09 0.04 2.74 -2.06 1.42 0.53 0.11 0.77 1.31 [41] -1.53 -8.87 4.06 3.93 0.27 -5.21 -1.54 0.40 2.28 3.41 [51] 3.07 4.28 -3.84 -0.31 -6.01 -1.21 -1.83 -0.22 2.04 -0.36 [61] -4.01 > postscript(file="/var/www/html/rcomp/tmp/1e5bg1228223797.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.155 0.069 -0.107 -0.053 0.127 0.166 0.038 -0.044 0.158 0.100 -0.003 -3 -2 -1 0 1 2 3 4 5 6 7 -0.112 -0.178 0.163 0.521 0.363 0.061 0.014 -0.055 0.076 -0.231 -0.076 8 9 10 11 12 13 14 0.047 -0.038 0.059 -0.071 -0.075 -0.119 -0.051 > 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/2rwfd1228223797.tab") > > system("convert tmp/1e5bg1228223797.ps tmp/1e5bg1228223797.png") > > > proc.time() user system elapsed 0.404 0.171 0.479