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(19.2,26.6,26.6,31.4,31.2,26.4,20.7,20.7,15,13.3,8.7,10.2,4.3,-0.1,-4.6,-3.9,-3.5,-3.4,-2.5,-1.1,0.3,-0.9,3.6,2.7,-0.2,-1,5.8,6.4,9.6,13.2,10.6,10.9,12.9,15.9,12.2,9.1,9,17.4,14.7,17,13.7,9.5,14.8,13.6,12.6,8.9,10.2,12.7,16,10.4,9.9,9.5,8.6,10,3.5,-4.2,-4.4,-1.5,-0.1,0.8) > x <- c(4.8,5.5,5.4,5.9,5.8,5.1,4.1,4.4,3.6,3.5,3.1,2.9,2.2,1.4,1.2,1.3,1.3,1.3,1.8,1.8,1.8,1.7,2.1,2,1.7,1.9,2.3,2.4,2.5,2.8,2.6,2.2,2.8,2.8,2.8,2.3,2.2,3,2.9,2.7,2.7,2.3,2.4,2.8,2.3,2,1.9,2.3,2.7,1.8,2,2.1,2,2.4,1.7,1,1.2,1.4,1.7,1.8) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '0.0' > #'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#output/ > #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.13613217 -0.01834914 0.08855340 -0.01709443 -0.12861738 -0.21825357 [7] 0.07061757 -0.20067070 -0.02817088 -0.12136086 -0.06669137 -0.27625338 [13] -0.45198512 -0.15415068 0.08004271 0.00000000 0.00000000 0.32542240 [19] 0.00000000 0.00000000 -0.05715841 0.21130909 -0.04879016 -0.16251893 [25] 0.11122564 0.19105524 0.04255961 0.04082199 0.11332869 -0.07410797 [31] -0.16705408 0.24116206 0.00000000 0.00000000 -0.19671029 -0.04445176 [37] 0.31015493 -0.03390155 -0.07145896 0.00000000 -0.16034265 0.04255961 [43] 0.15415068 -0.19671029 -0.13976194 -0.05129329 0.19105524 0.16034265 [49] -0.40546511 0.10536052 0.04879016 -0.04879016 0.18232156 -0.34484049 [55] -0.53062825 0.18232156 0.15415068 0.19415601 0.05715841 > y [1] 7.4 0.0 4.8 -0.2 -4.8 -5.7 0.0 -5.7 -1.7 -4.6 1.5 -5.9 -4.4 -4.5 0.7 [16] 0.4 0.1 0.9 1.4 1.4 -1.2 4.5 -0.9 -2.9 -0.8 6.8 0.6 3.2 3.6 -2.6 [31] 0.3 2.0 3.0 -3.7 -3.1 -0.1 8.4 -2.7 2.3 -3.3 -4.2 5.3 -1.2 -1.0 -3.7 [46] 1.3 2.5 3.3 -5.6 -0.5 -0.4 -0.9 1.4 -6.5 -7.7 -0.2 2.9 1.4 0.9 > postscript(file="/var/www/html/rcomp/tmp/1isq21229184652.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.008 -0.157 -0.209 0.140 0.217 -0.093 -0.036 -0.098 0.008 0.134 0.069 -3 -2 -1 0 1 2 3 4 5 6 7 -0.067 -0.083 0.159 0.775 0.181 -0.214 -0.006 0.053 0.066 0.190 -0.176 8 9 10 11 12 13 14 -0.067 -0.085 0.000 0.166 -0.378 -0.301 0.166 > 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/24mt11229184652.tab") > system("convert tmp/1isq21229184652.ps tmp/1isq21229184652.png") > > > proc.time() user system elapsed 0.383 0.167 0.447