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 = '0' > 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] 3.046551 3.042327 3.058834 3.071393 3.068448 3.063491 3.067049 3.067216 [9] 3.073624 3.071360 3.068714 3.075516 3.085723 3.085975 3.093900 3.099739 [17] 3.107126 3.105828 3.111569 3.127720 3.133781 3.125395 3.118061 3.108125 [25] 3.105709 3.104880 3.118203 3.122998 3.124812 3.120186 3.108535 3.123976 [33] 3.119423 3.122858 3.124143 3.124059 3.128105 3.128436 3.136714 3.127168 [41] 3.129698 3.135882 3.135909 3.126449 3.117606 3.124728 3.128133 3.128353 [49] 3.133781 3.137917 3.140547 3.138503 3.141049 3.141550 3.148409 3.146105 [57] 3.152304 3.156327 3.160892 3.162029 3.163653 3.167216 3.176085 3.180157 [65] 3.182566 3.177073 3.189587 3.195257 3.198184 3.202985 3.185891 3.187643 [73] 3.199059 3.194526 > postscript(file="/var/www/html/freestat/rcomp/tmp/139001228845756.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.038 -0.046 -0.051 -0.044 -0.027 -0.051 -0.034 -0.014 -0.009 0.019 0.003 -4 -3 -2 -1 0 1 2 3 4 5 6 0.042 0.024 0.062 0.081 0.055 0.013 0.047 0.068 0.051 0.001 -0.020 7 8 9 10 11 12 13 14 15 -0.025 0.002 0.023 -0.009 -0.004 -0.034 -0.035 -0.009 0.035 > 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/2dy001228845756.tab") > > system("convert tmp/139001228845756.ps tmp/139001228845756.png") > > > proc.time() user system elapsed 0.547 0.216 0.607