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(99.5,98.2,108.9,100.0,105.0,108.4,96.7,100.5,115.6,114.9,110.7,107.7,113.5,106.9,119.6,109.4,106.9,118.7,108.9,113.1,125.1,126.5,122.7,127.5,107.1,112.0,122.1,111.5,113.2,128.2,115.1,117.4,132.0,130.8,128.0,132.7,117.0,110.9,123.5,117.4,122.7,123.5,111.5,113.8,131.2,127.0,126.2,121.2,118.8,117.9,135.2,120.7,126.4,129.6,113.4,120.5,135.5,137.6,130.6,133.1,121.5,120.5,136.9,123.7,128.5,135.0,120.9,121.1,132.2,134.5,133.6,136.1,124.5,124.6,133.5,132.3,125.3,135.5,121.2,117.5,135.9) > x <- c(85.0,95.9,108.9,96.2,100.1,105.7,64.5,66.8,110.3,96.1,102.5,97.6,83.6,86.5,96.0,91.1,87.2,84.5,59.2,61.5,98.8,97.9,92.7,84.2,74.5,79.7,86.8,79.8,87.0,91.4,58.7,62.8,87.9,90.4,80.6,73.5,71.4,70.6,78.3,76.0,77.4,80.9,63.4,58.1,88.2,81.2,84.9,76.4,71.5,76.1,82.9,78.0,82.0,84.7,55.7,59.5,83.2,87.6,76.2,76.4,68.3,70.0,76.3,70.9,72.4,80.1,57.4,62.7,82.6,88.9,80.4,72.0,69.4,69.2,77.3,79.4,78.6,76.1,61.8,59.4,78.1) > par7 = '1' > par6 = '0' > par5 = '1' > par4 = '1' > 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] 10.9 13.0 -12.7 3.9 5.6 -41.2 2.3 43.5 -14.2 6.4 -4.9 -14.0 [13] 2.9 9.5 -4.9 -3.9 -2.7 -25.3 2.3 37.3 -0.9 -5.2 -8.5 -9.7 [25] 5.2 7.1 -7.0 7.2 4.4 -32.7 4.1 25.1 2.5 -9.8 -7.1 -2.1 [37] -0.8 7.7 -2.3 1.4 3.5 -17.5 -5.3 30.1 -7.0 3.7 -8.5 -4.9 [49] 4.6 6.8 -4.9 4.0 2.7 -29.0 3.8 23.7 4.4 -11.4 0.2 -8.1 [61] 1.7 6.3 -5.4 1.5 7.7 -22.7 5.3 19.9 6.3 -8.5 -8.4 -2.6 [73] -0.2 8.1 2.1 -0.8 -2.5 -14.3 -2.4 18.7 > y [1] -1.3 10.7 -8.9 5.0 3.4 -11.7 3.8 15.1 -0.7 -4.2 -3.0 5.8 [13] -6.6 12.7 -10.2 -2.5 11.8 -9.8 4.2 12.0 1.4 -3.8 4.8 -20.4 [25] 4.9 10.1 -10.6 1.7 15.0 -13.1 2.3 14.6 -1.2 -2.8 4.7 -15.7 [37] -6.1 12.6 -6.1 5.3 0.8 -12.0 2.3 17.4 -4.2 -0.8 -5.0 -2.4 [49] -0.9 17.3 -14.5 5.7 3.2 -16.2 7.1 15.0 2.1 -7.0 2.5 -11.6 [61] -1.0 16.4 -13.2 4.8 6.5 -14.1 0.2 11.1 2.3 -0.9 2.5 -11.6 [73] 0.1 8.9 -1.2 -7.0 10.2 -14.3 -3.7 18.4 > postscript(file="/var/www/html/rcomp/tmp/1cpo31229168988.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.209 0.201 -0.414 -0.007 0.639 -0.200 -0.305 0.303 -0.281 -0.068 0.510 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.188 -0.129 0.111 -0.370 -0.070 0.718 -0.180 -0.350 0.329 -0.279 -0.143 6 7 8 9 10 11 12 13 14 15 16 0.479 -0.102 -0.141 0.089 -0.297 -0.044 0.517 -0.069 -0.309 0.217 -0.191 > 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/2x6ft1229168988.tab") > > system("convert tmp/1cpo31229168988.ps tmp/1cpo31229168988.png") > > > proc.time() user system elapsed 2.047 0.521 2.821