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(93.7,105.7,109.5,105.3,102.8,100.6,97.6,110.3,107.2,107.2,108.1,97.1,92.2,112.2,111.6,115.7,111.3,104.2,103.2,112.7,106.4,102.6,110.6,95.2,89,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153,149.9,150.9,141,138.9,157.4,142.9,151.7,161,138.5,135.9,151.5,164,159.1,157,142.1,144.8,152.1,154.6,148.7,157.7,146.4,136.5) > x <- c(89.8,103.3,107.9,101,94.6,94.2,92.3,107.1,102.6,103.1,104.1,92.7,87,109.3,113.9,103.3,100.8,97.4,98.9,110.8,103.5,99.8,104.9,95.2,85.7,110,113.7,101.1,103.6,96.2,98.3,119.7,109.4,103.5,118.2,98.7,96.8,121.8,124,119.6,122.5,109.7,111.6,131.2,124.4,116.9,131.8,107.4,111,134,126.2,131.2,130.1,123.1,126.3,148.6,130.1,142.3,154.4,121.6,124.8,143.6,146.9,144.6,137.1,134.7,130.8,153.5,137.6,146.5,156.7,137.6,131.4,147.4,158.5,151.5,142.5,131.3,133.4,136.9,143.2,136.4,145.9,138.8,122.9) > par7 = '1' > par6 = '1' > 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] 13.5 4.6 -6.9 -6.4 -0.4 -1.9 14.8 -4.5 0.5 1.0 -11.4 -5.7 [13] 22.3 4.6 -10.6 -2.5 -3.4 1.5 11.9 -7.3 -3.7 5.1 -9.7 -9.5 [25] 24.3 3.7 -12.6 2.5 -7.4 2.1 21.4 -10.3 -5.9 14.7 -19.5 -1.9 [37] 25.0 2.2 -4.4 2.9 -12.8 1.9 19.6 -6.8 -7.5 14.9 -24.4 3.6 [49] 23.0 -7.8 5.0 -1.1 -7.0 3.2 22.3 -18.5 12.2 12.1 -32.8 3.2 [61] 18.8 3.3 -2.3 -7.5 -2.4 -3.9 22.7 -15.9 8.9 10.2 -19.1 -6.2 [73] 16.0 11.1 -7.0 -9.0 -11.2 2.1 3.5 6.3 -6.8 9.5 -7.1 -15.9 > y [1] -8.2 -8.0 1.7 0.3 -0.8 15.7 -15.8 3.1 0.9 -11.9 6.1 24.9 [13] -20.6 4.7 -8.5 -2.7 6.1 10.5 -15.8 2.5 11.8 -23.4 9.2 29.7 [25] -19.2 -13.9 16.0 -18.2 12.6 19.3 -32.5 12.6 10.9 -32.4 21.7 22.3 [37] -19.0 -6.7 10.1 -26.7 22.2 13.3 -20.1 -2.7 21.7 -41.1 32.3 14.9 [49] -28.5 16.4 -4.5 -14.4 11.3 20.9 -41.1 29.0 1.8 -44.4 37.4 11.4 [61] -7.5 -11.8 4.1 -10.9 7.8 20.6 -33.0 23.3 0.5 -31.8 19.9 18.2 [73] -3.1 -17.4 2.8 -12.8 17.6 4.6 -4.8 -8.4 14.9 -20.3 1.4 > postscript(file="/var/www/html/freestat/rcomp/tmp/15qma1228260455.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.196 -0.420 0.322 -0.021 -0.596 0.574 0.255 -0.600 0.350 0.009 -0.468 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.434 0.164 -0.432 0.381 -0.013 -0.772 0.735 0.170 -0.523 0.354 -0.052 6 7 8 9 10 11 12 13 14 15 16 -0.451 0.461 0.105 -0.425 0.447 -0.101 -0.580 0.560 0.129 -0.409 0.322 > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/226kv1228260455.tab") > > system("convert tmp/15qma1228260455.ps tmp/15qma1228260455.png") > > > proc.time() user system elapsed 0.612 0.271 4.827