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(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 = '1' > par6 = '0' > 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] -0.77 -0.42 -0.26 -0.22 -0.15 -0.24 -0.41 -0.51 -0.33 -0.35 -0.38 -0.48 [13] -0.43 -0.44 -0.29 -0.13 -0.19 -0.08 0.05 0.25 0.45 0.27 0.12 0.25 [25] 0.01 -0.01 0.09 0.07 0.14 0.14 0.40 1.21 1.32 1.72 2.11 2.07 [37] 2.31 2.41 2.27 2.09 2.20 2.38 2.03 1.44 1.25 1.23 0.70 0.53 [49] 0.57 1.08 0.58 1.26 1.39 1.11 1.39 1.67 2.24 1.99 2.54 2.54 [61] 2.59 1.73 2.31 1.83 1.73 1.73 1.97 1.51 -0.06 0.04 0.30 0.31 > y [1] 0.11 1.01 0.47 -0.32 -0.32 0.25 -0.45 -0.70 -0.94 -0.30 -1.60 -0.71 [13] -0.64 -1.32 0.12 0.93 0.40 -0.66 0.40 0.92 1.17 1.15 1.14 0.55 [25] 0.87 0.82 -0.22 -1.68 -0.54 -0.22 -2.02 -2.10 -2.04 -2.19 -1.10 -0.44 [37] -0.70 -0.50 0.51 -1.49 -1.61 -2.11 0.65 -0.18 -0.41 -0.77 -0.84 -0.52 [49] 0.85 0.43 0.99 2.98 2.69 3.04 1.35 2.94 3.29 3.29 4.23 4.24 [61] 4.03 5.07 4.86 4.76 5.19 5.74 6.39 5.67 4.99 5.51 3.46 2.71 > postscript(file="/var/www/html/rcomp/tmp/1p6hi1228304606.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.404 0.389 0.393 0.402 0.430 0.448 0.448 0.451 0.470 0.473 0.462 -4 -3 -2 -1 0 1 2 3 4 5 6 0.474 0.459 0.427 0.370 0.317 0.252 0.182 0.147 0.098 0.065 0.032 7 8 9 10 11 12 13 14 15 0.013 -0.028 -0.050 -0.081 -0.081 -0.089 -0.088 -0.075 -0.097 > 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/2ejgv1228304606.tab") > > system("convert tmp/1p6hi1228304606.ps tmp/1p6hi1228304606.png") > > > proc.time() user system elapsed 0.395 0.170 3.067