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(97.8,107.4,117.5,105.6,97.4,99.5,98.0,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117.0,103.8,100.8,110.6,104.0,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111.0,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128.0,129.6,125.8,119.5,115.7,113.6,129.7,112.0,116.8,127.0,112.1,114.2,121.1,131.6,125.0,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > x <- c(78.4,114.6,113.3,117.0,99.6,99.4,101.9,115.2,108.5,113.8,121.0,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98.0,106.6,90.1,96.9,125.9,112.0,100.0,123.9,79.8,83.4,113.6,112.9,104.0,109.9,99.0,106.3,128.9,111.1,102.9,130.0,87.0,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137.0,91.0,90.5,122.4,123.3,124.3,120.0,118.1,119.0,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128.0,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > par7 = '1' > par6 = '0' > par5 = '-0.1' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '0.7' > #'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] 3.12084534 -3.21579039 3.16401419 -5.71528757 -2.50263048 -1.52389656 [7] -0.09996865 -1.16295066 -0.63961562 -1.31430518 -1.69952767 -1.58608510 [13] -5.59686441 -0.07505406 -6.31624468 1.04275733 4.24505103 -0.85063108 [19] -1.15829587 3.70444561 1.49342629 -2.08432222 2.38503850 -1.67392641 [25] 3.81450070 3.04940132 3.05539796 1.50272583 0.80945391 2.27380976 [31] 2.35028320 0.70076813 -0.21877722 0.72531749 1.42644924 1.91000856 [37] 1.07965870 0.96201333 -2.33114957 1.67199868 0.65686771 0.87720893 [43] 1.49178476 1.54765522 -1.47239824 5.97352529 1.61240103 1.04053633 [49] 0.78039104 1.14155846 4.81664594 3.23117266 1.77658662 3.80621537 [55] 1.58696336 1.61522030 4.46566372 0.44251929 3.28583133 4.86581580 [61] 2.22058535 1.89643664 2.99728003 1.26259889 1.88405192 0.83268866 [67] 3.92537687 0.24806455 5.48261863 1.52231263 1.10315527 3.09305184 [73] 0.30160817 > y [1] -0.015067093 0.005803367 -0.002648175 -0.010798005 0.021669411 [6] 0.066413229 0.037458063 0.047925933 0.040526733 -0.013881708 [11] 0.034620037 0.050011820 0.042834391 0.083091470 0.040451911 [16] 0.051499390 0.118694385 -0.059476433 0.001810074 0.041622059 [21] 0.001166609 0.024994555 0.083475254 0.015355411 0.039276239 [26] 0.021993266 -0.019095361 0.036419747 0.033487744 0.048643235 [31] 0.007183460 -0.003094960 0.021722759 0.045238028 -0.027677943 [36] -0.061461341 -0.006361013 -0.005296939 -0.020295789 0.001553880 [41] -0.063181720 0.013087783 0.039633905 0.053256215 -0.012474972 [46] 0.044515151 0.019267632 0.026002157 0.028909673 0.003376575 [51] 0.062143766 0.030208758 0.017381377 0.025840806 0.006619111 [56] -0.004249677 0.016387479 -0.010538583 0.015242966 0.061651183 [61] 0.007684913 -0.034205766 0.009408108 -0.003935178 0.004648840 [66] 0.010647909 0.020992554 -0.044883694 0.080339708 -0.024455831 [71] -0.012260205 0.016992857 -0.050128971 > postscript(file="/var/www/html/rcomp/tmp/1f1at1228249334.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.235 0.045 -0.151 -0.182 -0.270 -0.379 -0.157 -0.160 -0.209 -0.064 -0.118 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.363 -0.006 -0.262 -0.433 0.163 -0.192 -0.099 0.188 -0.019 -0.134 0.024 7 8 9 10 11 12 13 14 15 -0.179 0.044 0.069 -0.061 0.045 0.105 0.000 0.082 -0.061 > 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/28r921228249334.tab") > > system("convert tmp/1f1at1228249334.ps tmp/1f1at1228249334.png") > > > proc.time() user system elapsed 0.402 0.181 0.663