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(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 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > 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] 84.0 94.9 107.9 95.2 99.1 104.7 63.5 65.8 109.3 95.1 101.5 96.6 [13] 82.6 85.5 95.0 90.1 86.2 83.5 58.2 60.5 97.8 96.9 91.7 83.2 [25] 73.5 78.7 85.8 78.8 86.0 90.4 57.7 61.8 86.9 89.4 79.6 72.5 [37] 70.4 69.6 77.3 75.0 76.4 79.9 62.4 57.1 87.2 80.2 83.9 75.4 [49] 70.5 75.1 81.9 77.0 81.0 83.7 54.7 58.5 82.2 86.6 75.2 75.4 [61] 67.3 69.0 75.3 69.9 71.4 79.1 56.4 61.7 81.6 87.9 79.4 71.0 [73] 68.4 68.2 76.3 78.4 77.6 75.1 60.8 58.4 77.1 > y [1] 98.5 97.2 107.9 99.0 104.0 107.4 95.7 99.5 114.6 113.9 109.7 106.7 [13] 112.5 105.9 118.6 108.4 105.9 117.7 107.9 112.1 124.1 125.5 121.7 126.5 [25] 106.1 111.0 121.1 110.5 112.2 127.2 114.1 116.4 131.0 129.8 127.0 131.7 [37] 116.0 109.9 122.5 116.4 121.7 122.5 110.5 112.8 130.2 126.0 125.2 120.2 [49] 117.8 116.9 134.2 119.7 125.4 128.6 112.4 119.5 134.5 136.6 129.6 132.1 [61] 120.5 119.5 135.9 122.7 127.5 134.0 119.9 120.1 131.2 133.5 132.6 135.1 [73] 123.5 123.6 132.5 131.3 124.3 134.5 120.2 116.5 134.9 > postscript(file="/var/www/html/freestat/rcomp/tmp/13zj71229073951.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.307 -0.243 -0.393 -0.158 0.116 -0.195 -0.332 -0.196 -0.342 -0.237 -0.057 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.342 -0.454 -0.454 -0.572 -0.356 -0.047 -0.389 -0.544 -0.348 -0.478 -0.344 6 7 8 9 10 11 12 13 14 15 16 -0.063 -0.309 -0.458 -0.388 -0.427 -0.177 0.105 -0.119 -0.276 -0.126 -0.185 > 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/2vpbi1229073951.tab") > > system("convert tmp/13zj71229073951.ps tmp/13zj71229073951.png") > > > proc.time() user system elapsed 0.566 0.228 1.209