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 = '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] 98.4 101.7 108.3 92.9 94.3 100.8 84.6 80.1 108.5 103.0 93.5 78.0 [13] 91.8 94.6 100.7 89.8 88.5 90.8 82.8 76.4 111.7 97.8 84.7 71.8 [25] 95.9 94.0 93.2 86.3 79.6 86.9 78.6 70.9 93.6 90.4 85.6 67.5 [37] 89.1 90.6 94.4 84.4 80.6 87.9 83.1 73.7 96.1 94.3 84.1 66.3 [49] 79.6 86.9 88.2 80.3 78.7 82.7 81.1 68.3 90.2 84.7 84.2 69.0 [61] 84.8 90.4 96.5 86.1 84.1 93.1 84.8 73.7 98.9 89.7 85.8 73.8 [73] 90.8 96.6 99.8 84.4 83.0 89.6 79.5 72.9 92.6 > y [1] 100.5 98.2 106.8 91.3 98.2 100.6 86.0 70.4 103.7 114.1 101.5 74.3 [13] 95.7 93.6 97.6 98.5 91.0 92.6 88.3 65.9 107.8 112.2 104.5 76.8 [25] 101.1 96.0 94.5 98.3 85.4 91.4 84.7 60.9 103.9 106.9 94.6 78.8 [37] 93.8 92.7 107.1 95.9 87.8 105.7 85.8 68.8 109.9 104.4 98.2 83.4 [49] 86.2 90.9 96.9 93.5 84.0 99.3 77.7 64.8 103.8 95.0 102.3 81.9 [61] 90.4 93.5 108.3 91.1 98.3 108.6 86.5 72.1 109.7 110.6 109.7 83.0 [73] 100.6 101.1 112.9 98.0 99.4 108.5 92.0 75.8 104.3 > postscript(file="/var/www/html/rcomp/tmp/1q4cs1260970900.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.003 -0.204 -0.203 0.079 0.551 -0.240 -0.405 -0.120 0.358 0.127 -0.088 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.099 0.118 -0.148 -0.142 0.200 0.779 -0.161 -0.382 -0.044 0.398 0.147 6 7 8 9 10 11 12 13 14 15 16 -0.048 -0.081 0.094 -0.144 -0.162 0.109 0.598 -0.180 -0.350 -0.050 0.311 > 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/24gwc1260970900.tab") > > try(system("convert tmp/1q4cs1260970900.ps tmp/1q4cs1260970900.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.408 0.171 0.470