R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(101.5,99.2,107.8,92.3,99.2,101.6,87,71.4,104.7,115.1,102.5,75.3,96.7,94.6,98.6,99.5,92,93.6,89.3,66.9,108.8,113.2,105.5,77.8,102.1,97,95.5,99.3,86.4,92.4,85.7,61.9,104.9,107.9,95.6,79.8,94.8,93.7,108.1,96.9,88.8,106.7,86.8,69.8,110.9,105.4,99.2,84.4,87.2,91.9,97.9,94.5,85,100.3,78.7,65.8,104.8,96,103.3,82.9,91.4,94.5,109.3,92.1,99.3,109.6,87.5,73.1,110.7,111.6,110.7,84,101.6,102.1,113.9,99,100.4,109.5,93,76.8,105.3) > x <- c(99.4,102.7,109.3,93.9,95.3,101.8,85.6,81.1,109.5,104.0,94.5,79.0,92.8,95.6,101.7,90.8,89.5,91.8,83.8,77.4,112.7,98.8,85.7,72.8,96.9,95.0,94.2,87.3,80.6,87.9,79.6,71.9,94.6,91.4,86.6,68.5,90.1,91.6,95.4,85.4,81.6,88.9,84.1,74.7,97.1,95.3,85.1,67.3,80.6,87.9,89.2,81.3,79.7,83.7,82.1,69.3,91.2,85.7,85.2,70.0,85.8,91.4,97.5,87.1,85.1,94.1,85.8,74.7,99.9,90.7,86.8,74.8,91.8,97.6,100.8,85.4,84.0,90.6,80.5,73.9,93.6) > par7 = '1' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '1' > 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.5 -0.5 4.5 -2.7 -4.2 8.2 -1.9 6.9 -8.4 -3.6 2.6 10.3 [13] -4.7 -6.9 4.0 -5.4 5.0 -0.3 -1.3 -12.6 10.7 8.3 -5.2 -2.5 [25] 3.4 4.6 -3.1 2.9 0.0 3.5 -1.7 -0.3 1.4 -5.4 0.3 -8.3 [37] 5.8 -2.5 2.1 2.2 -3.3 3.2 -3.4 -0.5 -3.7 9.7 2.6 2.5 [49] -1.7 4.8 -2.5 -0.4 5.0 -6.7 1.7 3.3 -3.7 -3.4 3.2 1.2 [61] 0.2 -2.9 -5.0 0.6 -2.4 -1.8 4.5 -5.5 > y [1] -4.8 -4.6 -9.2 7.2 -7.2 -8.0 2.3 -4.5 4.1 -1.9 3.0 2.5 [13] 5.4 2.4 -3.1 -0.2 -5.6 -1.2 -3.6 -5.0 -3.9 -5.3 -9.9 2.0 [25] -7.3 -3.3 12.6 -2.4 2.4 14.3 1.1 7.9 6.0 -2.5 3.6 4.6 [37] -7.6 -1.8 -10.2 -2.4 -3.8 -6.4 -8.1 -4.0 -6.1 -9.4 4.1 -1.5 [49] 4.2 2.6 11.4 -2.4 14.3 9.3 8.8 7.3 5.9 15.6 7.4 1.1 [61] 10.2 7.6 4.6 6.9 1.1 -0.1 5.5 3.7 -5.4 > postscript(file="/var/www/html/rcomp/tmp/1gjoj1260971401.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 0.013 0.029 -0.146 0.123 0.027 0.021 0.088 0.145 0.025 0.084 0.210 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.130 0.166 -0.039 0.157 -0.194 -0.113 -0.037 -0.102 -0.130 -0.192 -0.056 7 8 9 10 11 12 13 14 15 -0.250 0.105 -0.177 -0.032 -0.039 0.014 0.062 0.009 0.045 > 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/2yliu1260971401.tab") > > try(system("convert tmp/1gjoj1260971401.ps tmp/1gjoj1260971401.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.416 0.190 0.668