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(91.2,99.2,108.2,101.5,106.9,104.4,77.9,60,99.5,95,105.6,102.5,93.3,97.3,127,111.7,96.4,133,72.2,95.8,124.1,127.6,110.7,104.6,112.7,115.3,139.4,119,97.4,154,81.5,88.8,127.7,105.1,114.9,106.4,104.5,121.6,141.4,99,126.7,134.1,81.3,88.6,132.7,132.9,134.4,103.7,119.7,115,132.9,108.5,113.9,142,97.7,92.2,128.8,134.9,128.2,114.8,117.9,119.1,120.7,129.1,117.6,129.2,100,87.3) > x <- c(97.4,97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,97.6) > par7 = '1' > par6 = '0' > par5 = '-0.1' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '-2.0' > #'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] -2.580178e-06 0.000000e+00 5.641823e-06 1.840990e-07 -7.494780e-07 [6] 5.496279e-06 0.000000e+00 8.505372e-06 3.067020e-06 -1.023749e-06 [11] 5.113120e-06 4.812751e-06 -5.859547e-07 -1.226067e-06 -6.245660e-06 [16] -9.191520e-08 7.494780e-07 1.749256e-06 -1.094076e-05 -1.233726e-06 [21] -6.131233e-07 -3.486065e-06 4.077976e-06 6.606122e-07 4.855963e-06 [26] 5.059395e-06 8.131183e-06 -1.993924e-06 1.055801e-05 4.693940e-07 [31] 7.839024e-06 5.090427e-06 1.080061e-06 7.744027e-06 3.012131e-06 [36] -2.814544e-07 6.515381e-06 4.213853e-06 2.053333e-06 4.891303e-06 [41] -4.557494e-07 1.670446e-06 1.012057e-05 3.453202e-06 -1.567142e-06 [46] 3.465959e-06 2.764871e-07 -1.941561e-06 3.698450e-06 5.797116e-06 [51] -6.045764e-06 8.076894e-06 -1.535900e-07 -8.211709e-07 4.183343e-06 [56] -6.438727e-06 > y [1] 0.014480313 -0.012223721 0.099490385 0.060041336 -0.065135495 [6] 0.150283979 -0.049343547 0.303552383 0.137937985 0.184371427 [11] 0.029527996 0.012751797 0.118896631 0.106484969 0.057125452 [16] 0.039379572 0.006532032 0.089244104 0.078503287 -0.048263270 [21] 0.017632276 -0.120617192 0.023214923 0.010707966 -0.047275868 [26] 0.033004280 0.008688297 -0.115152518 0.164208138 -0.084195315 [31] -0.001582499 -0.001439840 0.023602585 0.145625804 0.096782953 [36] -0.016138223 0.084732011 -0.034625087 -0.037902177 0.057608622 [41] -0.065976854 0.034972282 0.117286304 0.025385372 -0.018323816 [46] 0.009153363 -0.028999714 0.063605019 -0.009396887 0.021758382 [51] -0.059335692 0.107852496 0.019877938 -0.057822537 0.014698605 [56] -0.034832353 > postscript(file="/var/www/html/rcomp/tmp/1ycmw1228232051.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.149 -0.048 -0.061 0.078 -0.056 0.093 0.083 -0.072 0.210 0.098 -0.121 -3 -2 -1 0 1 2 3 4 5 6 7 0.185 0.120 -0.152 0.404 -0.320 0.011 0.028 -0.226 -0.179 -0.161 -0.317 8 9 10 11 12 13 14 0.006 -0.154 -0.108 -0.277 -0.099 -0.136 -0.026 > 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/2n2j91228232051.tab") > > system("convert tmp/1ycmw1228232051.ps tmp/1ycmw1228232051.png") > > > proc.time() user system elapsed 0.379 0.176 0.444