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(200.7,146.5,143.6,141.5,137.5,138.7,135.5,136.4,112.1,109,123.8,151.2,139.2,115.7,147.6,126.1,122.8,137.3,142,137.4,89.4,108,117.7,127.3,121,104.1,119.5,116.7,96.1,125,118.8,114.9,79.3,90.5,87.8,109.4,88.9,97.4,112,86.8,82.9,105.2,89.1,85.5,87.1,85.2,88.2,104,96.4,82.3,114.1,88.9,93.6,101.8,96.6,93.7,68.4,68.7,81.2,85.1,75.4,71.6,83,72.3,90.2,89,84.9,90.9,46.6,55.4,88.7,76,76.9,72.1,90,92.3,78,93.9,84.5,80.4,60.5,75.3,91.5,105.2,92.7) > x <- c(61.5,88.5,93.3,89.2,101.3,97,102.2,100.3,78.2,105.9,119.9,108,77,93.1,109.5,100.4,99,113.9,102.1,101.6,84,110.7,111.6,110.7,73.1,87.5,109.6,99.3,92.1,109.3,94.5,91.4,82.9,103.3,96,104.8,65.8,78.7,100.3,85,94.5,97.9,91.9,87.2,84.4,99.2,105.4,110.9,69.8,86.8,106.7,88.8,96.9,108.1,93.7,94.8,79.8,95.6,107.9,104.9,61.9,85.7,92.4,86.4,99.3,95.5,97,102.1,77.8,105.5,113.2,108.8,66.9,89.3,93.6,92,99.5,98.6,94.6,96.7,75.3,102.5,115.1,104.7,71.4) > par7 = '1' > par6 = '1' > par5 = '1' > par4 = '1' > 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] -22.2 -8.9 16.2 -16.4 9.5 -7.1 -20.2 49.8 -13.7 -25.9 -19.1 47.1 [13] 0.3 -25.5 7.7 16.3 -26.7 11.3 -17.1 44.3 -25.8 -1.8 -36.7 52.0 [25] 7.7 -32.4 3.1 24.4 -32.0 11.7 -5.4 28.9 -27.7 16.1 -47.8 51.9 [37] 8.7 -36.9 24.8 -6.1 -9.4 1.3 1.9 17.6 -8.6 -0.7 -46.6 58.1 [49] 2.9 -37.8 26.0 3.1 -25.6 15.5 -16.1 30.8 -3.5 -15.3 -40.0 66.8 [61] -17.1 -12.7 18.9 -16.7 5.3 3.6 -29.4 52.0 -20.0 -12.1 -37.5 64.3 [73] -18.1 -5.9 9.1 -8.4 -3.1 6.1 -23.5 48.6 -14.6 -23.0 -22.9 > y [1] 51.3 0.8 -1.9 5.2 -4.4 4.1 -25.2 21.2 17.9 12.6 -39.4 -11.5 [13] 55.4 -53.4 18.2 17.8 -9.8 -9.3 -43.4 66.6 -8.9 -0.1 -15.9 -10.6 [25] 32.3 -18.2 -17.8 49.5 -35.1 2.3 -31.7 46.8 -13.9 24.3 -42.1 29.0 [37] 6.1 -39.8 21.3 26.2 -38.4 12.5 5.2 -3.5 4.9 12.8 -23.4 -6.5 [49] 45.9 -57.0 29.9 3.5 -13.4 2.3 -22.4 25.6 12.2 -8.6 -13.6 5.9 [61] 15.2 -22.1 28.6 -19.1 -2.9 10.1 -50.3 53.1 24.5 -46.0 13.6 -5.7 [73] 22.7 -15.6 -16.6 30.2 -25.3 5.3 -15.8 34.7 1.4 -2.5 -26.2 > postscript(file="/var/www/html/freestat/rcomp/tmp/1m50o1228249618.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.058 0.086 -0.174 -0.028 0.438 -0.394 0.017 -0.084 0.359 -0.217 -0.047 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.047 0.021 0.095 -0.297 0.080 0.495 -0.552 0.067 0.008 0.206 -0.101 6 7 8 9 10 11 12 13 14 15 16 -0.103 0.093 -0.035 0.168 -0.380 0.187 0.393 -0.523 0.141 -0.020 0.103 > 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/2gcr31228249618.tab") > > system("convert tmp/1m50o1228249618.ps tmp/1m50o1228249618.png") > > > proc.time() user system elapsed 0.539 0.219 0.801