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(15.9,15.5,15.3,14.5,14.4,14.7,19.1,21.6,20.2,17.9,15.7,14.5,14.1,13.9,14.2,15.3,15.4,15.2,16.5,18.2,18.6,21.0,19.2,18.7,18.4,17.8,17.2,16.2,15.5,15.3,18.3,19.2,19.0,18.7,18.1,18.5,21.1,21.0,20.4,19.5,18.6,18.8,23.7,24.8,25.0,23.6,22.3,21.8,20.8,19.7,18.3,17.4,17.0,18.1,23.9,25.6,25.3,23.6,21.9,21.4,20.6,20.5,20.2,20.6,19.7,19.3,22.8,23.5,23.8,22.6,22.0,21.7,20.7,20.2,19.1,19.5,18.7,18.6,22.2,23.2,23.5,21.3,20.0,18.7,18.9,18.3,18.4,19.9,19.2,18.5,20.9,20.5,19.4,18.1,17.0,17.0,17.3,16.7,15.5,15.3,13.7,14.1,17.3,18.1,18.1) > x <- c(7.5,7.2,6.9,6.7,6.4,6.3,6.8,7.3,7.1,7.1,6.8,6.5,6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.2,8.3,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8.0,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9,8.0,8.0,7.9,8.0,7.7,7.2,7.5,7.3,7.0,7.0,7.0,7.2,7.3,7.1,6.8,6.6,6.2,6.2,6.8,6.9,6.8) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '1' > par3 = '0' > par2 = '1' > 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] -0.3 -0.3 -0.2 -0.3 -0.1 0.5 0.5 -0.2 0.0 -0.3 -0.3 -0.2 -0.2 0.0 0.2 [16] 0.0 -0.3 0.2 0.2 0.4 0.7 0.0 0.1 0.0 -0.2 -0.1 -0.2 -0.2 -0.1 0.7 [31] 0.1 0.2 0.2 0.1 0.1 0.1 -0.1 -0.2 -0.1 -0.3 0.0 0.6 0.1 0.1 0.0 [46] 0.0 0.2 0.3 -0.1 -0.5 -0.8 -0.3 0.3 1.3 0.5 0.0 -0.6 -0.5 0.1 0.2 [61] 0.1 0.0 -0.4 -0.1 -0.1 0.6 0.1 0.1 -0.3 -0.1 0.1 0.2 0.0 -0.1 -0.1 [76] -0.2 -0.2 0.1 -0.1 0.0 -0.2 0.0 0.0 0.1 0.0 -0.1 0.1 -0.3 -0.5 0.3 [91] -0.2 -0.3 0.0 0.0 0.2 0.1 -0.2 -0.3 -0.2 -0.4 0.0 0.6 0.1 -0.1 > y [1] -0.4 -0.2 -0.8 -0.1 0.3 4.4 2.5 -1.4 -2.3 -2.2 -1.2 -0.4 -0.2 0.3 1.1 [16] 0.1 -0.2 1.3 1.7 0.4 2.4 -1.8 -0.5 -0.3 -0.6 -0.6 -1.0 -0.7 -0.2 3.0 [31] 0.9 -0.2 -0.3 -0.6 0.4 2.6 -0.1 -0.6 -0.9 -0.9 0.2 4.9 1.1 0.2 -1.4 [46] -1.3 -0.5 -1.0 -1.1 -1.4 -0.9 -0.4 1.1 5.8 1.7 -0.3 -1.7 -1.7 -0.5 -0.8 [61] -0.1 -0.3 0.4 -0.9 -0.4 3.5 0.7 0.3 -1.2 -0.6 -0.3 -1.0 -0.5 -1.1 0.4 [76] -0.8 -0.1 3.6 1.0 0.3 -2.2 -1.3 -1.3 0.2 -0.6 0.1 1.5 -0.7 -0.7 2.4 [91] -0.4 -1.1 -1.3 -1.1 0.0 0.3 -0.6 -1.2 -0.2 -1.6 0.4 3.2 0.8 0.0 > postscript(file="/var/www/html/rcomp/tmp/1zlji1228242166.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 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -0.120 -0.202 -0.197 -0.096 0.040 0.440 0.104 -0.034 0.013 0.002 0.140 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.147 -0.116 -0.360 -0.389 -0.234 0.171 0.747 0.285 -0.022 -0.114 -0.165 5 6 7 8 9 10 11 12 13 14 15 0.049 0.147 -0.012 -0.205 -0.238 -0.217 0.055 0.443 0.106 -0.032 -0.070 16 17 -0.038 0.167 > 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/25eg71228242166.tab") > > system("convert tmp/1zlji1228242166.ps tmp/1zlji1228242166.png") > > > proc.time() user system elapsed 0.409 0.155 0.687