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(104.3,103.9,103.9,103.9,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.0,108.2,112.3,111.3,111.3,115.3,117.2,118.3,118.3,118.3,119.0,120.6,122.6,122.6,127.4,125.9,121.5,118.8,121.6,122.3,122.7,120.8,120.1,120.1,120.1,120.1,128.4,129.8,129.8,128.6,128.6,133.7,130.0,125.9,129.4,129.4,130.6,130.6,130.6,130.8,129.7,125.8,126.0,125.6,125.4,124.7,126.9,129.1) > x <- c(97.5,97.1,97.5,98.5,100.5,102.8,105.2,107.4,108.0,107.6,107.0,105.8,104.3,103.8,104.4,106.2,108.5,109.8,110.3,109.7,108.7,108.9,109.7,110.4,111.4,112.6,113.6,113.8,113.2,113.6,113.9,113.4,113.8,116.0,118.3,120.5,121.9,121.2,120.2,120.6,110.2,109.2,108.7,109.9,112.2,114.5,114.7,113.2,112.1,112.6,113.6,114.0,114.5,115.0,114.9,114.8,114.3,113.7,114.5,116.0,116.6,116.2,115.7,115.6,115.2,115.0,115.7,115.9,115.6,115.9,117.0,117.9,118.8,119.9) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > 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] 96.5 96.1 96.5 97.5 99.5 101.8 104.2 106.4 107.0 106.6 106.0 104.8 [13] 103.3 102.8 103.4 105.2 107.5 108.8 109.3 108.7 107.7 107.9 108.7 109.4 [25] 110.4 111.6 112.6 112.8 112.2 112.6 112.9 112.4 112.8 115.0 117.3 119.5 [37] 120.9 120.2 119.2 119.6 109.2 108.2 107.7 108.9 111.2 113.5 113.7 112.2 [49] 111.1 111.6 112.6 113.0 113.5 114.0 113.9 113.8 113.3 112.7 113.5 115.0 [61] 115.6 115.2 114.7 114.6 114.2 114.0 114.7 114.9 114.6 114.9 116.0 116.9 [73] 117.8 118.9 > y [1] 103.3 102.9 102.9 102.9 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 [13] 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 107.0 [25] 107.0 107.0 107.0 107.2 111.3 110.3 110.3 114.3 116.2 117.3 117.3 117.3 [37] 118.0 119.6 121.6 121.6 126.4 124.9 120.5 117.8 120.6 121.3 121.7 119.8 [49] 119.1 119.1 119.1 119.1 127.4 128.8 128.8 127.6 127.6 132.7 129.0 124.9 [61] 128.4 128.4 129.6 129.6 129.6 129.8 128.7 124.8 125.0 124.6 124.4 123.7 [73] 125.9 128.1 > postscript(file="/var/www/html/rcomp/tmp/18dbs1230055996.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 0.479 0.486 0.497 0.507 0.535 0.558 0.579 0.600 0.622 0.633 0.641 0.649 0.680 -2 -1 0 1 2 3 4 5 6 7 8 9 10 0.704 0.711 0.708 0.640 0.573 0.516 0.464 0.420 0.378 0.338 0.298 0.264 0.241 11 12 13 14 15 0.217 0.186 0.160 0.126 0.097 > 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/2vzal1230055996.tab") > > system("convert tmp/18dbs1230055996.ps tmp/18dbs1230055996.png") > > > proc.time() user system elapsed 0.396 0.180 0.456