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(109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207,206.6,210.6,211.1,215,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221,213.6,243.4,253.8,265.3,268.2,268.5,266.9,268.4,250.8,231.2,192) > x <- c(105.4,107.1,110.7,117.1,118.7,126.5,127.5,134.6,131.8,135.9,142.7,141.7,153.4,145,137.7,148.3,152.2,169.4,168.6,161.1,174.1,179,190.6,190,181.6,174.8,180.5,196.8,193.8,197,216.3,221.4,217.9,229.7,227.4,204.2,196.6,198.8,207.5,190.7,201.6,210.5,223.5,223.8,231.2,244,234.7,250.2,265.7,287.6,283.3,295.4,312.3,333.8,347.7,383.2,407.1,413.6,362.7,321.9,239.4) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '2' > 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] 1.9 2.8 -4.8 6.2 -6.8 6.1 -9.9 6.9 2.7 -7.8 12.7 -20.1 [13] 1.1 17.9 -6.7 13.3 -18.0 -6.7 20.5 -8.1 6.7 -12.2 -7.8 1.6 [25] 12.5 10.6 -19.3 6.2 16.1 -14.2 -8.6 15.3 -14.1 -20.9 15.6 9.8 [37] 6.5 -25.5 27.7 -2.0 4.1 -12.7 7.1 5.4 -22.1 24.8 0.0 6.4 [49] -26.2 16.4 4.8 4.6 -7.6 21.6 -11.6 -17.4 -57.4 10.1 -41.7 > y [1] 2.3 2.7 7.7 5.8 2.3 -1.9 -4.5 0.5 3.4 0.2 0.8 3.0 [13] 3.7 -1.1 10.5 2.8 3.6 -2.2 -7.3 -2.5 0.9 5.8 2.3 0.6 [25] 2.6 6.4 10.0 4.8 1.2 14.0 18.0 -10.4 9.4 0.0 -2.8 5.3 [37] -0.4 4.0 0.5 3.9 8.9 14.3 0.7 -9.3 2.6 -10.1 -0.5 5.7 [49] -6.3 -7.4 29.8 10.4 11.5 2.9 0.3 -1.6 1.5 -17.6 -19.6 -39.2 > postscript(file="/var/www/html/rcomp/tmp/1whaq1228250499.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.055 -0.085 0.143 -0.061 0.021 -0.049 -0.086 -0.016 -0.013 0.074 -0.088 -3 -2 -1 0 1 2 3 4 5 6 7 -0.018 0.275 0.359 -0.083 0.223 -0.013 0.038 -0.160 -0.085 -0.131 -0.103 8 9 10 11 12 13 14 -0.109 0.067 0.184 0.045 0.017 0.265 -0.074 > 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/22ow91228250499.tab") > > system("convert tmp/1whaq1228250499.ps tmp/1whaq1228250499.png") > > > proc.time() user system elapsed 0.386 0.168 0.456