R version 2.7.0 (2008-04-22) 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(103.68,103.64,103.37,104.3,104.15,104.09,104.21,104.27,104,103.36,104.2,104.12,103.79,104.65,103.84,103.98,103.83,104.34,103.76,103.57,103.06,103.06,102.6,103.41,103.15,103.33,103.96,104.91,104.23,103.68,104.16,104.49,104.23,104.21,103.74,103.96,104.02,104.15,103.74,103.23,103.69,103.46,102.14,102.39,102.19,102.02,102.64,103.52,103.32,103.65,104.25,101.74,102.08,101.35,102.79,102.21,101.78,101.25,101.8,103,104.17,104.08,105.24,104.72,104.77,104.39,104.14,105.15,105.07,104.54,106.03,107.24,108.2,109.15,110.1,109.48,109.96,110.13,110.53,110.82,110.06,110.05,109.49,109.95) > x <- c(101.02,100.67,100.47,100.38,100.33,100.34,100.37,100.39,100.21,100.21,100.22,100.28,100.25,100.25,100.21,100.16,100.18,100.1,99.96,99.88,99.88,99.86,99.84,99.8,99.82,99.81,99.92,100.03,99.99,100.02,100.01,100.13,100.33,100.13,99.96,100.05,99.83,99.8,100.01,100.1,100.13,100.16,100.41,101.34,101.65,101.85,102.07,102.12,102.14,102.21,102.28,102.19,102.33,102.54,102.44,102.78,102.9,103.08,102.77,102.65,102.71,103.29,102.86,103.45,103.72,103.65,103.83,104.45,105.14,105.07,105.31,105.19,105.3,105.02,105.17,105.28,105.45,105.38,105.8,105.96,105.08,105.11,105.61,105.5) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > par3 = '0' > 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] 100.02 99.67 99.47 99.38 99.33 99.34 99.37 99.39 99.21 99.21 [11] 99.22 99.28 99.25 99.25 99.21 99.16 99.18 99.10 98.96 98.88 [21] 98.88 98.86 98.84 98.80 98.82 98.81 98.92 99.03 98.99 99.02 [31] 99.01 99.13 99.33 99.13 98.96 99.05 98.83 98.80 99.01 99.10 [41] 99.13 99.16 99.41 100.34 100.65 100.85 101.07 101.12 101.14 101.21 [51] 101.28 101.19 101.33 101.54 101.44 101.78 101.90 102.08 101.77 101.65 [61] 101.71 102.29 101.86 102.45 102.72 102.65 102.83 103.45 104.14 104.07 [71] 104.31 104.19 104.30 104.02 104.17 104.28 104.45 104.38 104.80 104.96 [81] 104.08 104.11 104.61 104.50 > y [1] 102.68 102.64 102.37 103.30 103.15 103.09 103.21 103.27 103.00 102.36 [11] 103.20 103.12 102.79 103.65 102.84 102.98 102.83 103.34 102.76 102.57 [21] 102.06 102.06 101.60 102.41 102.15 102.33 102.96 103.91 103.23 102.68 [31] 103.16 103.49 103.23 103.21 102.74 102.96 103.02 103.15 102.74 102.23 [41] 102.69 102.46 101.14 101.39 101.19 101.02 101.64 102.52 102.32 102.65 [51] 103.25 100.74 101.08 100.35 101.79 101.21 100.78 100.25 100.80 102.00 [61] 103.17 103.08 104.24 103.72 103.77 103.39 103.14 104.15 104.07 103.54 [71] 105.03 106.24 107.20 108.15 109.10 108.48 108.96 109.13 109.53 109.82 [81] 109.06 109.05 108.49 108.95 > postscript(file="/var/www/html/rcomp/tmp/1l4sf1228303265.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 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 0.477 0.501 0.518 0.538 0.559 0.585 0.602 0.620 0.636 0.658 0.674 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.689 0.704 0.699 0.690 0.687 0.682 0.627 0.574 0.518 0.459 0.396 6 7 8 9 10 11 12 13 14 15 16 0.332 0.270 0.206 0.142 0.070 0.014 -0.036 -0.077 -0.101 -0.116 -0.134 > 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/2zpwb1228303265.tab") > > system("convert tmp/1l4sf1228303265.ps tmp/1l4sf1228303265.png") > > > proc.time() user system elapsed 1.183 0.280 1.235