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(101.73,101.63,101.43,101.34,101.01,100.89,100.93,100.77,100.3,99.86,99.71,99.93,99.88,99.92,99.87,99.63,100.05,99.88,100.11,100.05,100.07,100.2,100.21,99.76,99.41,99.24,99.65,99.7,99.79,99.84,101,101.62,101.98,101.46,102.28,102.14,102.02,102.21,101.61,102.38,102.19,102.04,101.76,101.9,102.01,102.37,103.04,103.42,103.76,104.41,104.75,104.28,103.89,104.09,103.8,105.03,105.86,106.04,106.03,106.13,107.21,107.66,108.08,108.76,108.26,108.71,108.65,108.61,108.86,109.54,108.22,108.77,109.9,110.13,109.6,110.42,110.6,109.73,110.72,111.08,111.14,111.01,110.56,111.57) > 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 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '1' > 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] -0.35 -0.20 -0.09 -0.05 0.01 0.03 0.02 -0.18 0.00 0.01 0.06 -0.03 [13] 0.00 -0.04 -0.05 0.02 -0.08 -0.14 -0.08 0.00 -0.02 -0.02 -0.04 0.02 [25] -0.01 0.11 0.11 -0.04 0.03 -0.01 0.12 0.20 -0.20 -0.17 0.09 -0.22 [37] -0.03 0.21 0.09 0.03 0.03 0.25 0.93 0.31 0.20 0.22 0.05 0.02 [49] 0.07 0.07 -0.09 0.14 0.21 -0.10 0.34 0.12 0.18 -0.31 -0.12 0.06 [61] 0.58 -0.43 0.59 0.27 -0.07 0.18 0.62 0.69 -0.07 0.24 -0.12 0.11 [73] -0.28 0.15 0.11 0.17 -0.07 0.42 0.16 -0.88 0.03 0.50 -0.11 > y [1] -0.10 -0.20 -0.09 -0.33 -0.12 0.04 -0.16 -0.47 -0.44 -0.15 0.22 -0.05 [13] 0.04 -0.05 -0.24 0.42 -0.17 0.23 -0.06 0.02 0.13 0.01 -0.45 -0.35 [25] -0.17 0.41 0.05 0.09 0.05 1.16 0.62 0.36 -0.52 0.82 -0.14 -0.12 [37] 0.19 -0.60 0.77 -0.19 -0.15 -0.28 0.14 0.11 0.36 0.67 0.38 0.34 [49] 0.65 0.34 -0.47 -0.39 0.20 -0.29 1.23 0.83 0.18 -0.01 0.10 1.08 [61] 0.45 0.42 0.68 -0.50 0.45 -0.06 -0.04 0.25 0.68 -1.32 0.55 1.13 [73] 0.23 -0.53 0.82 0.18 -0.87 0.99 0.36 0.06 -0.13 -0.45 1.01 > postscript(file="/var/www/html/rcomp/tmp/1yqy11229891453.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.063 0.123 -0.076 -0.078 0.210 0.086 -0.054 -0.133 0.236 -0.029 0.045 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.248 0.192 -0.088 0.121 0.148 0.113 0.034 -0.224 0.152 0.042 -0.094 6 7 8 9 10 11 12 13 14 15 16 0.184 0.185 -0.029 0.029 0.170 0.075 0.050 0.231 0.075 0.011 0.074 > 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/2zzb61229891453.tab") > > system("convert tmp/1yqy11229891453.ps tmp/1yqy11229891453.png") > > > proc.time() user system elapsed 0.405 0.178 0.473