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(72.5,72.0,98.8,75.2,81.2,88.0,54.6,68.6,101.5,93.4,84.5,91.4,64.5,64.5,117.3,73.5,79.7,102.6,57.9,73.1,102.4,82.3,89.1,84.7,81.4,67.5,113.9,83.8,73.9,103.9,67.9,62.5,125.4,79.1,106.3,96.2,94.3,85.6,117.4,88.5,124.2,119.3,76.8,70.6,122.1,109.5,119.9,102.3,79.6,78.2,103.6,77.8,99.1,105.7,84.1,88.7,108.0,98.1,101.0,82.0) > x <- c(93.0,99.2,112.2,112.1,103.3,108.2,90.4,72.8,111.0,117.9,111.3,110.5,94.8,100.4,132.1,114.6,101.9,130.2,84.0,86.4,122.3,120.9,110.2,112.6,102.0,105.0,130.5,115.5,103.7,130.9,89.1,93.8,123.8,111.9,118.3,116.9,103.6,116.6,141.3,107.0,125.2,136.4,91.6,95.3,132.3,130.6,131.9,118.6,114.3,111.3,126.5,112.1,119.3,142.4,101.1,97.4,129.1,136.9,129.8,123.9) > par7 = '0' > par6 = '0' > par5 = '-1.6' > par4 = '12' > par3 = '0' > 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] 4324.000 4919.820 6293.920 6282.705 5334.945 5853.120 4085.580 [8] 2649.420 6160.000 6949.705 6193.345 6104.625 4493.020 5039.580 [15] 8724.705 6566.080 5191.305 8475.520 3527.500 3731.980 7478.145 [22] 7307.905 6071.520 6338.880 5201.500 5512.000 8514.625 6669.625 [29] 5376.345 8566.905 3968.905 4398.720 7662.720 6260.305 6996.945 [36] 6832.305 5365.980 6797.280 9982.345 5724.000 7837.020 9301.980 [43] 4194.780 4540.545 8751.145 8527.680 8698.305 7032.480 6531.745 [50] 6193.345 8000.625 6282.705 7115.745 10138.380 5110.105 4742.880 [57] 8332.905 9370.305 8423.520 7675.105 > y [1] 0.6243403 0.6243330 0.6245980 0.6243778 0.6244497 0.6245162 0.6239616 [8] 0.6242793 0.6246149 0.6245601 0.6244837 0.6245446 0.6242046 0.6242046 [15] 0.6246945 0.6243546 0.6244330 0.6246215 0.6240546 0.6243490 0.6246203 [22] 0.6244614 0.6245257 0.6244856 0.6244519 0.6242604 0.6246798 0.6244768 [29] 0.6243602 0.6246291 0.6242674 0.6241635 0.6247255 0.6244262 0.6246424 [36] 0.6245804 0.6245668 0.6244943 0.6246949 0.6245205 0.6247212 0.6247027 [43] 0.6243984 0.6243117 0.6247135 0.6246590 0.6247050 0.6246197 0.6244319 [50] 0.6244155 0.6246273 0.6244107 0.6245999 0.6246391 0.6244798 0.6245222 [57] 0.6246513 0.6245934 0.6246119 0.6244583 > postscript(file="/var/www/html/rcomp/tmp/1ipvu1229690101.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.122 -0.012 0.514 0.074 -0.180 0.160 -0.016 0.069 0.512 0.103 -0.187 -3 -2 -1 0 1 2 3 4 5 6 7 0.201 -0.089 0.024 0.807 0.212 -0.181 0.231 -0.013 0.091 0.582 0.064 8 9 10 11 12 13 14 -0.183 0.169 -0.151 -0.032 0.696 0.076 -0.229 > 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/2j23m1229690102.tab") > > system("convert tmp/1ipvu1229690101.ps tmp/1ipvu1229690101.png") > > > proc.time() user system elapsed 0.396 0.183 0.472