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(106.7,110.2,125.9,100.1,106.4,114.8,81.3,87,104.2,108,105,94.5,92,95.9,108.8,103.4,102.1,110.1,83.2,82.7,106.8,113.7,102.5,96.6,92.1,95.6,102.3,98.6,98.2,104.5,84,73.8,103.9,106,97.2,102.6,89,93.8,116.7,106.8,98.5,118.7,90,91.9,113.3,113.1,104.1,108.7,96.7,101,116.9,105.8,99,129.4,83,88.9,115.9,104.2,113.4,112.2,100.8,107.3,126.6,102.9,117.9,128.8,87.5,93.8,122.7,126.2,124.6,116.7,115.2,111.1,129.9,113.3,118.5,137.9,103.6,101.7,127.4,137.5,128.3,118.2) > x <- c(101,98.7,105.1,98.4,101.7,102.9,92.2,94.9,92.8,98.5,94.3,87.4,103.4,101.2,109.6,111.9,108.9,105.6,107.8,97.5,102.4,105.6,99.8,96.2,113.1,107.4,116.8,112.9,105.3,109.3,107.9,101.1,114.7,116.2,108.4,113.4,108.7,112.6,124.2,114.9,110.5,121.5,118.1,111.7,132.7,119,116.7,120.1,113.4,106.6,116.3,112.6,111.6,125.1,110.7,109.6,114.2,113.4,116,109.6,117.8,115.8,125.3,113,120.5,116.6,111.8,115.2,118.6,122.4,116.4,114.5,119.8,115.8,127.8,118.8,119.7,118.6,120.8,115.9,109.7,114.8,116.2,112.2) > 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] 100.0 97.7 104.1 97.4 100.7 101.9 91.2 93.9 91.8 97.5 93.3 86.4 [13] 102.4 100.2 108.6 110.9 107.9 104.6 106.8 96.5 101.4 104.6 98.8 95.2 [25] 112.1 106.4 115.8 111.9 104.3 108.3 106.9 100.1 113.7 115.2 107.4 112.4 [37] 107.7 111.6 123.2 113.9 109.5 120.5 117.1 110.7 131.7 118.0 115.7 119.1 [49] 112.4 105.6 115.3 111.6 110.6 124.1 109.7 108.6 113.2 112.4 115.0 108.6 [61] 116.8 114.8 124.3 112.0 119.5 115.6 110.8 114.2 117.6 121.4 115.4 113.5 [73] 118.8 114.8 126.8 117.8 118.7 117.6 119.8 114.9 108.7 113.8 115.2 111.2 > y [1] 105.7 109.2 124.9 99.1 105.4 113.8 80.3 86.0 103.2 107.0 104.0 93.5 [13] 91.0 94.9 107.8 102.4 101.1 109.1 82.2 81.7 105.8 112.7 101.5 95.6 [25] 91.1 94.6 101.3 97.6 97.2 103.5 83.0 72.8 102.9 105.0 96.2 101.6 [37] 88.0 92.8 115.7 105.8 97.5 117.7 89.0 90.9 112.3 112.1 103.1 107.7 [49] 95.7 100.0 115.9 104.8 98.0 128.4 82.0 87.9 114.9 103.2 112.4 111.2 [61] 99.8 106.3 125.6 101.9 116.9 127.8 86.5 92.8 121.7 125.2 123.6 115.7 [73] 114.2 110.1 128.9 112.3 117.5 136.9 102.6 100.7 126.4 136.5 127.3 117.2 > postscript(file="/var/www/html/freestat/rcomp/tmp/1mz0r1228241867.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.169 0.341 0.278 0.234 0.517 0.328 0.132 0.398 0.412 0.345 0.466 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.345 0.191 0.404 0.249 0.232 0.500 0.224 0.084 0.222 0.210 0.159 6 7 8 9 10 11 12 13 14 15 16 0.140 0.033 -0.079 0.054 -0.035 -0.027 0.135 -0.010 -0.119 -0.043 -0.017 > 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/2mq7b1228241867.tab") > > system("convert tmp/1mz0r1228241867.ps tmp/1mz0r1228241867.png") > > > proc.time() user system elapsed 0.536 0.210 1.223