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(92.1,88.5,84.6,87,83.6,84.8,84.1,84.1,80.5,82.6,85.6,83.3,86.1,84.7,85.7,84.9,84.2,85.2,86.1,86,84.5,87.2,83.5,81.9,78.5,81.1,79.2,80.9,81.8,79.4,83.4,81.1,79.8,79.7,84,83.7,83.5,83.6,86,86.8,86.9,89,87.8,86.8,88.8,85.9,86.7,87.9,88.5,88.7,88.1,85.7,86.1,85.7,84.3,86.4,85.4,86.9,85.6,86.4) > x <- c(110.4,112.9,109.4,111.9,108.9,113.8,114.5,113.2,111,114.6,113.1,113.2,115.1,117.6,117.8,115.7,115.7,118.3,117.9,117.3,119.4,117.1,119,120,118.9,116,115.6,119.7,119.7,120.8,120,120.2,121.7,116.9,122.4,122.6,123.7,120.9,124.2,122.6,125.7,123.1,122.2,126.2,124.4,127.8,124.2,126.7,126.1,128.2,130.4,130.2,129.2,129.7,131,129.2,131.1,132.9,135.2,132.3) > 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] 109.4 111.9 108.4 110.9 107.9 112.8 113.5 112.2 110.0 113.6 112.1 112.2 [13] 114.1 116.6 116.8 114.7 114.7 117.3 116.9 116.3 118.4 116.1 118.0 119.0 [25] 117.9 115.0 114.6 118.7 118.7 119.8 119.0 119.2 120.7 115.9 121.4 121.6 [37] 122.7 119.9 123.2 121.6 124.7 122.1 121.2 125.2 123.4 126.8 123.2 125.7 [49] 125.1 127.2 129.4 129.2 128.2 128.7 130.0 128.2 130.1 131.9 134.2 131.3 > y [1] 91.1 87.5 83.6 86.0 82.6 83.8 83.1 83.1 79.5 81.6 84.6 82.3 85.1 83.7 84.7 [16] 83.9 83.2 84.2 85.1 85.0 83.5 86.2 82.5 80.9 77.5 80.1 78.2 79.9 80.8 78.4 [31] 82.4 80.1 78.8 78.7 83.0 82.7 82.5 82.6 85.0 85.8 85.9 88.0 86.8 85.8 87.8 [46] 84.9 85.7 86.9 87.5 87.7 87.1 84.7 85.1 84.7 83.3 85.4 84.4 85.9 84.6 85.4 > postscript(file="/var/www/html/rcomp/tmp/1nutd1228168923.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.201 0.189 0.204 0.182 0.186 0.218 0.280 0.307 0.312 0.321 0.342 -3 -2 -1 0 1 2 3 4 5 6 7 0.315 0.309 0.309 0.268 0.264 0.247 0.190 0.186 0.168 0.199 0.165 8 9 10 11 12 13 14 0.163 0.184 0.139 0.072 0.008 0.024 -0.038 > 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/2ea151228168923.tab") > > system("convert tmp/1nutd1228168923.ps tmp/1nutd1228168923.png") > > > proc.time() user system elapsed 0.391 0.165 0.468