R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(1.77,1.76,1.77,1.95,1.98,1.93,1.94,1.92,1.94,1.92,1.92,1.94,1.91,1.88,1.98,2.4,2.47,2.22,1.98,1.89,1.87,1.88,1.86,1.81,1.79,1.78,1.73,1.88,1.91,1.9,1.84,1.85,1.83,1.82,1.82,1.81,1.75,1.74,1.73,1.96,2.07,1.96,1.87,1.84,1.81,1.78,1.72,1.73,1.64,1.61,1.63,1.92,1.88,1.68,1.58,1.49,1.46,1.44,1.44,1.42,1.4,1.38,1.36,1.48,1.56,1.51,1.51,1.42,1.4,1.38,1.35,1.29) > x <- c(1.19,1.18,1.18,1.33,1.3,1.25,1.22,1.17,1.18,1.19,1.21,1.21,1.2,1.2,1.29,1.83,1.85,1.54,1.52,1.43,1.4,1.4,1.39,1.37,1.33,1.36,1.34,1.75,1.84,1.73,1.63,1.5,1.45,1.38,1.38,1.27,1.31,1.29,1.32,1.48,1.39,1.45,1.44,1.44,1.42,1.39,1.4,1.39,1.3,1.32,1.35,1.51,1.37,1.25,1.15,1.09,1.09,1.06,1.02,1.01,1,1,1.05,1.3,1.34,1.24,1.22,1.06,1,1,1,1.01) > 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] 0.19 0.18 0.18 0.33 0.30 0.25 0.22 0.17 0.18 0.19 0.21 0.21 0.20 0.20 0.29 [16] 0.83 0.85 0.54 0.52 0.43 0.40 0.40 0.39 0.37 0.33 0.36 0.34 0.75 0.84 0.73 [31] 0.63 0.50 0.45 0.38 0.38 0.27 0.31 0.29 0.32 0.48 0.39 0.45 0.44 0.44 0.42 [46] 0.39 0.40 0.39 0.30 0.32 0.35 0.51 0.37 0.25 0.15 0.09 0.09 0.06 0.02 0.01 [61] 0.00 0.00 0.05 0.30 0.34 0.24 0.22 0.06 0.00 0.00 0.00 0.01 > y [1] 0.77 0.76 0.77 0.95 0.98 0.93 0.94 0.92 0.94 0.92 0.92 0.94 0.91 0.88 0.98 [16] 1.40 1.47 1.22 0.98 0.89 0.87 0.88 0.86 0.81 0.79 0.78 0.73 0.88 0.91 0.90 [31] 0.84 0.85 0.83 0.82 0.82 0.81 0.75 0.74 0.73 0.96 1.07 0.96 0.87 0.84 0.81 [46] 0.78 0.72 0.73 0.64 0.61 0.63 0.92 0.88 0.68 0.58 0.49 0.46 0.44 0.44 0.42 [61] 0.40 0.38 0.36 0.48 0.56 0.51 0.51 0.42 0.40 0.38 0.35 0.29 > postscript(file="/var/www/html/rcomp/tmp/1a58k1261066627.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.054 0.036 0.160 0.226 0.186 0.152 0.139 0.120 0.125 0.151 0.173 -4 -3 -2 -1 0 1 2 3 4 5 6 0.218 0.306 0.459 0.647 0.746 0.625 0.498 0.423 0.388 0.378 0.379 7 8 9 10 11 12 13 14 15 0.376 0.373 0.389 0.446 0.546 0.604 0.504 0.367 0.255 > 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/2zlkq1261066627.tab") > > try(system("convert tmp/1a58k1261066627.ps tmp/1a58k1261066627.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.383 0.175 0.466