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(124.1,110.7,128.1,108.9,111.2,131.9,120.5,115.4,130.8,112.6,111.1,129.5,131.8,127.7,142.6,115.8,119.5,139.8,130.6,126.2,141.7,118.9,120.3,141.2,138.9,141.3,153.7,131,136.5,160.1,139.8,143.8,155.8,131,131.8,151.7,153.8,152.9,156.1,147.2,145.7,165.3,147.4,154.4,165.3,145.2,139.7,158.4,169.1,162.1,166.2,157.2,161.4,169,171.8,161.4,175.7,164.7,146.1,173) > x <- c(101.3,91.5,152.6,86.6,86.6,98.5,86.7,89.1,111,92.6,85.1,116.1,98.3,97.7,177.9,94.2,83.8,109.5,102.3,102.5,162.7,85.3,88.2,104.7,99.4,113.8,166.6,89.2,93.2,115,97.2,112.5,121.8,100.2,93.8,113.6,110.7,127.6,185.9,105.9,108,125.2,106.2,123.3,145.2,114.3,108.4,120.9,126.3,141.3,208.2,131.6,119.8,122.5,137.6,141,154.1,127,106.1,129.9) > 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] -3.0 6.2 25.3 7.6 -2.8 11.0 15.6 13.4 51.7 -7.3 3.1 -11.4 [13] 1.1 16.1 -11.3 -5.0 9.4 5.5 -5.1 10.0 -40.9 14.9 5.6 8.9 [25] 11.3 13.8 19.3 16.7 14.8 10.2 9.0 10.8 23.4 14.1 14.6 7.3 [37] 15.6 13.7 22.3 25.7 11.8 -2.7 31.4 17.7 8.9 12.7 -2.3 9.0 > y [1] 7.7 17.0 14.5 6.9 8.3 7.9 10.1 10.8 10.9 6.3 9.2 11.7 7.1 13.6 11.1 [16] 15.2 17.0 20.3 9.2 17.6 14.1 12.1 11.5 10.5 14.9 11.6 2.4 16.2 9.2 5.2 [31] 7.6 10.6 9.5 14.2 7.9 6.7 15.3 9.2 10.1 10.0 15.7 3.7 24.4 7.0 10.4 [46] 19.5 6.4 14.6 > postscript(file="/var/www/html/rcomp/tmp/1j1it1229703475.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 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -0.087 0.132 0.189 0.007 0.214 0.113 -0.144 0.097 -0.098 -0.212 0.020 -2 -1 0 1 2 3 4 5 6 7 8 -0.198 -0.302 0.133 -0.227 -0.017 -0.226 -0.200 -0.042 0.167 0.055 -0.010 9 10 11 12 13 0.081 0.000 0.212 0.085 -0.090 > 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/29rza1229703475.tab") > > system("convert tmp/1j1it1229703475.ps tmp/1j1it1229703475.png") > > > proc.time() user system elapsed 0.383 0.183 0.879