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(109.86,108.68,113.38,117.12,116.23,114.75,115.81,115.86,117.80,117.11,116.31,118.38,121.57,121.65,124.20,126.12,128.60,128.16,130.12,135.83,138.05,134.99,132.38,128.94,128.12,127.84,132.43,134.13,134.78,133.13,129.08,134.48,132.86,134.08,134.54,134.51,135.97,136.09,139.14,135.63,136.55,138.83,138.84,135.37,132.22,134.75,135.98,136.06,138.05,139.59,140.58,139.81,140.77,140.96,143.59,142.70,145.11,146.70,148.53,148.99,149.65,151.11,154.82,156.56,157.60,155.24,160.68,163.22,164.55,166.76,159.05,159.82,164.95,162.89) > x <- c(0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,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,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684) > par7 = '0' > par6 = '1' > par5 = '-0.2' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '1.8' > #'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.0161355673 0.0037362197 -0.0082739476 -0.0119704910 0.0052023487 [6] 0.0090344449 0.0287134362 0.0364268202 0.0360262866 -0.0142269190 [11] 0.0029502161 0.0002954192 0.0201577189 0.0170330095 0.0453074420 [16] 0.0159368398 0.0036132336 0.0043692447 0.0804494498 0.0091353359 [21] -0.0325819984 -0.0256121782 0.0090750058 0.0524022236 0.0011335994 [26] 0.0675425134 0.0389643363 0.0039776159 -0.0457694360 -0.0323132523 [31] 0.0025447893 0.0152303094 0.0150090937 -0.0105664170 0.0049232476 [36] 0.0322116950 0.0608110394 0.0520689895 -0.0362262168 -0.0130051849 [41] 0.0232197164 -0.0325808008 -0.0297571117 -0.0629525540 -0.0149096227 [46] 0.0298273258 -0.0042412256 -0.0281359796 -0.0263200420 0.0080024195 [51] 0.0285395207 -0.0191170742 0.0094743662 0.0293227572 0.0597301059 [56] -0.0145377578 0.0041078816 0.0154220977 -0.0102142074 -0.0140168884 [61] 0.0327839740 0.0410718948 -0.0265698518 0.0092723534 0.0209247711 [66] 0.0345850391 -0.0006361863 -0.0116722016 0.0379100997 -0.0120702735 [71] 0.0353686848 0.0434762133 0.0613676935 > y [1] -4.223636e-03 1.650650e-02 1.255893e-02 -2.944553e-03 -4.956970e-03 [6] 3.557993e-03 1.668638e-04 6.408401e-03 -2.264670e-03 -2.645834e-03 [11] 6.801860e-03 1.020741e-02 2.518412e-04 7.924876e-03 5.839206e-03 [16] 7.386354e-03 -1.297945e-03 5.741087e-03 1.615103e-02 6.060789e-03 [21] -8.385132e-03 -7.334314e-03 -9.936201e-03 -2.415519e-03 -8.290634e-04 [26] 1.332291e-02 4.794449e-03 1.813937e-03 -4.625306e-03 -1.165085e-02 [31] 1.544026e-02 -4.552829e-03 3.434816e-03 1.285371e-03 -8.366767e-05 [36] 4.046059e-03 3.302324e-04 8.277980e-03 -9.545773e-03 2.530455e-03 [41] 6.183937e-03 2.685352e-05 -9.460109e-03 -8.843194e-03 7.122275e-03 [46] 3.404877e-03 2.201743e-04 5.427368e-03 4.136034e-03 2.630072e-03 [51] -2.043681e-03 2.545900e-03 5.014065e-04 6.858320e-03 -2.303883e-03 [56] 6.199253e-03 4.022709e-03 4.565642e-03 1.137038e-03 1.624065e-03 [61] 3.562290e-03 8.869345e-03 4.072324e-03 2.408188e-03 -5.492526e-03 [66] 1.251408e-02 5.670069e-03 2.926899e-03 4.801261e-03 -1.709386e-02 [71] 1.751425e-03 1.141589e-02 -4.532277e-03 > postscript(file="/var/www/html/rcomp/tmp/1cmcq1228581510.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 -0.210 -0.028 -0.062 0.097 0.074 -0.019 -0.078 -0.038 0.112 -0.197 0.008 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.069 0.019 -0.077 0.066 0.409 0.098 -0.233 -0.225 -0.027 0.256 0.116 7 8 9 10 11 12 13 14 15 0.135 -0.003 0.034 0.047 -0.066 0.123 0.066 -0.107 -0.042 > 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/2f4xd1228581510.tab") > > system("convert tmp/1cmcq1228581510.ps tmp/1cmcq1228581510.png") > > > proc.time() user system elapsed 0.414 0.202 0.513