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(108.65,107.03,104.21,108.65,101.45,100.34,112.6,118.56,119.32,116.97,109.56,109.58,110.74,110.41,109.44,107.3,105.78,105.99,120.23,122.17,121.66,120.64,118.46,119.16,120.77,120.27,118.62,118.44,116.51,117.94,132.44,134.86,134.46,131.54,127.33,129.06,130.81,130.47,129.19,126.46,124.84,126.25,138.07,142.08,142.51,142.21,138.22,138.52,137.45,137.11,135.95,133.32,132.01,132.37,144.4,146.3,146.14,142.4,138.51,138.91,138.04,137.27,134.88,133.58,133.24,133.28,144.13,145.58,144.21,136.7,131.61,129.64,130.41,127.68,123.68,122.34,118.88,116,129.19,131.34,126,122.61,118.6,119.63) > x <- c(98.8,100.5,110.4,96.4,101.9,106.2,81.0,94.7,101.0,109.4,102.3,90.7,96.2,96.1,106.0,103.1,102.0,104.7,86.0,92.1,106.9,112.6,101.7,92.0,97.4,97.0,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97.0,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.0,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102.0,106.0,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100.0) > par7 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '1' > #'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.6 -4.4 -4.4 6.7 0.1 -1.5 5.0 -2.6 5.9 3.2 -0.6 1.3 1.2 0.9 -0.6 [16] -0.4 -3.9 -0.2 1.4 -2.2 2.9 -0.9 -3.1 4.9 -2.3 0.0 7.3 0.2 -0.7 6.9 [31] 0.0 6.9 4.3 -1.4 5.3 4.7 -0.5 -1.1 -8.0 -0.1 0.7 2.5 -6.5 -1.1 -0.9 [46] -4.4 4.9 0.7 4.4 4.8 10.8 -2.1 11.8 0.7 4.5 4.8 1.6 10.6 4.1 -0.3 [61] 7.0 4.6 3.3 5.4 -0.6 2.6 7.1 3.7 -2.3 5.9 0.4 -2.0 > y [1] 1.290000e+00 1.850000e+00 -6.580000e+00 5.680000e+00 1.320000e+00 [6] 1.980000e+00 -4.020000e+00 -1.270000e+00 1.330000e+00 5.230000e+00 [11] 6.800000e-01 4.500000e-01 -1.700000e-01 -6.800000e-01 1.960000e+00 [16] -4.100000e-01 1.220000e+00 2.600000e-01 4.800000e-01 1.100000e-01 [21] -1.900000e+00 -2.030000e+00 1.030000e+00 1.400000e-01 1.600000e-01 [26] 3.700000e-01 -2.550000e+00 3.100000e-01 -2.000000e-02 -2.680000e+00 [31] 1.590000e+00 8.300000e-01 2.620000e+00 2.200000e-01 -1.430000e+00 [36] -2.820000e+00 2.842171e-14 1.200000e-01 1.000000e-01 3.100000e-01 [41] -1.050000e+00 2.100000e-01 -2.110000e+00 -5.900000e-01 -3.440000e+00 [46] 1.000000e-01 1.000000e-01 2.000000e-01 -4.300000e-01 -1.230000e+00 [51] 1.330000e+00 9.700000e-01 -3.200000e-01 -1.180000e+00 -4.500000e-01 [56] -1.210000e+00 -3.770000e+00 -1.200000e+00 -2.370000e+00 1.640000e+00 [61] -1.960000e+00 -1.610000e+00 -4.000000e-02 -3.120000e+00 -2.920000e+00 [66] 2.340000e+00 7.000000e-01 -3.970000e+00 4.120000e+00 1.080000e+00 [71] 3.000000e+00 > postscript(file="/var/www/html/rcomp/tmp/1lsnv1229956778.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.056 -0.019 0.092 -0.079 0.065 -0.014 -0.151 -0.105 -0.036 -0.087 0.113 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.057 -0.220 0.089 -0.005 -0.061 0.003 -0.147 0.032 -0.020 -0.098 -0.289 7 8 9 10 11 12 13 14 15 -0.008 -0.138 0.018 -0.069 -0.110 -0.022 -0.150 -0.057 -0.047 > 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/2q1qy1229956778.tab") > > system("convert tmp/1lsnv1229956778.ps tmp/1lsnv1229956778.png") > > > proc.time() user system elapsed 0.392 0.167 0.472