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(2.84,2.78,2.63,2.54,2.56,2.19,2.09,2.06,2.08,2.05,2.03,2.04,2.03,2.01,2.01,2.01,2.01,2.01,2.01,2.02,2.02,2.03,2.05,2.08,2.07,2.06,2.05,2.05,2.05,2.05,2.05,2.06,2.06,2.07,2.07,2.30,2.31,2.31,2.53,2.58,2.59,2.73,2.82,3.00,3.04,3.23,3.32,3.49,3.57,3.56,3.72,3.82,3.82,3.98,4.06,4.08,4.19,4.16,4.17,4.21,4.21,4.17,4.19,4.25,4.25,4.20,4.33,4.41,4.56) > x <- c(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,104.5,143.6) > par7 = '1' > par6 = '1' > par5 = '-1.7' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '0.5' > #'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.34453113 -0.46188216 1.42675299 0.58446536 -0.82306414 0.91728678 [7] -0.69184799 1.60338761 1.19701801 1.20094468 0.59708818 0.31718497 [13] 0.91554478 0.93281875 0.26579332 -0.08521354 0.28792744 0.54143313 [19] 0.78858896 0.44356684 0.37204659 -0.91372422 0.65623773 0.25598926 [25] 0.34870799 0.58339498 0.58265544 -0.57713874 2.31295749 0.60589132 [31] 0.42402592 0.31801066 0.43819996 1.87094852 1.24566618 0.68627287 [37] 1.48630805 0.61365098 0.60193845 1.73144917 0.16751421 1.21579053 [43] 1.93549683 0.89354177 0.72041262 1.13284451 0.47919959 0.71851470 [49] 0.31971322 1.48922718 0.09190649 2.05480823 0.57255198 0.40279398 [55] 1.19382577 0.52520894 1.11932417 > y [1] 6.910593e-04 1.022812e-02 6.931356e-03 -1.597286e-03 3.616688e-02 [6] 1.283151e-02 5.688536e-03 -2.804962e-03 5.723398e-03 5.835471e-03 [11] 2.766691e-03 7.518768e-05 1.584767e-03 -1.430251e-03 0.000000e+00 [16] 0.000000e+00 0.000000e+00 0.000000e+00 -7.795870e-05 0.000000e+00 [21] -7.655727e-05 -2.917735e-03 2.376845e-02 2.442374e-03 1.411627e-03 [26] 2.173590e-02 3.972682e-03 7.697669e-04 9.987311e-03 5.722985e-03 [31] 8.649584e-03 2.023359e-03 7.289520e-03 3.658546e-03 -2.177803e-02 [36] 1.606735e-03 -3.231772e-04 -1.541354e-02 -1.192933e-03 -7.697669e-04 [41] -5.927088e-03 -3.853374e-03 -9.627845e-03 3.591619e-04 -9.334081e-03 [46] -3.446202e-03 -5.389839e-03 -2.655774e-03 -5.126156e-04 -4.471514e-03 [51] -1.549921e-03 0.000000e+00 -5.081781e-03 7.205690e-04 1.040291e-03 [56] 2.268443e-04 > postscript(file="/var/www/html/rcomp/tmp/103vu1228230814.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.004 0.111 -0.048 -0.117 -0.026 -0.201 -0.196 -0.060 -0.230 -0.205 -0.328 -3 -2 -1 0 1 2 3 4 5 6 7 -0.230 -0.025 -0.421 -0.223 -0.048 -0.392 0.221 0.062 -0.236 0.182 -0.114 8 9 10 11 12 13 14 0.038 -0.007 -0.073 0.052 -0.052 0.005 0.092 > 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/24ogc1228230814.tab") > > system("convert tmp/103vu1228230814.ps tmp/103vu1228230814.png") > > > proc.time() user system elapsed 0.399 0.175 0.444