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(13,8,7,3,3,4,4,0,-4,-14,-18,-8,-1,1,2,0,1,0,-1,-3,-3,-3,-4,-8,-9,-13,-18,-11,-9,-10,-13,-11,-5,-15,-6,-6,-3,-1,-3,-4,-6,0,-4,-2,-2,-6,-7,-6,-6,-3,-2,-5,-11,-11,-11,-10,-14,-8,-9,-5,-1) > x <- c(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2,71.7,77.5,89.8,80.3,78.7,93.8,57.6,60.6,91,85.3,77.4,77.3,68.3,69.9,81.7,75.1,69.9,84,54.3,60,89.9,77,85.3,77.6,69.2) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '1' > par3 = '1' > par2 = '0' > par1 = '0.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.047721702 0.150359644 -0.277239993 0.109532224 0.122445603 [6] -0.669058011 0.105356386 0.526339989 0.099839988 -0.145740444 [11] -0.145345052 -0.118422155 0.146813846 0.136990050 -0.107421345 [16] -0.024605835 0.088585040 -0.626625494 -0.080918826 0.794882121 [21] -0.093632080 0.009433010 -0.131826208 -0.157322687 0.029353096 [26] 0.105857326 0.010240447 -0.219158402 -0.011624439 -0.372107121 [31] -0.136023903 0.876328832 -0.001574271 -0.244677207 -0.055216009 [36] -0.229753625 0.119715453 0.229274803 -0.174342513 -0.031174687 [41] 0.273996662 -0.749506936 0.076343537 0.625511340 -0.101228828 [46] -0.150868092 -0.001997035 -0.190019407 0.035367660 0.240398380 [51] -0.130280356 -0.110118024 0.283578955 -0.664915136 0.149578227 [56] 0.621421407 -0.241016795 0.158870215 -0.146880977 -0.176018638 > y [1] -5 -1 -4 0 1 0 -4 -4 -10 -4 10 7 2 1 -2 1 -1 -1 -2 [20] 0 0 -1 -4 -1 -4 -5 7 2 -1 -3 2 6 -10 9 0 3 2 -2 [39] -1 -2 6 -4 2 0 -4 -1 1 0 3 1 -3 -6 0 0 1 -4 6 [58] -1 4 4 > postscript(file="/var/www/html/rcomp/tmp/1ysy61228757750.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.092 -0.192 0.086 0.011 -0.014 0.044 -0.069 0.029 -0.116 -0.066 0.150 -3 -2 -1 0 1 2 3 4 5 6 7 0.154 0.079 -0.253 0.017 -0.015 -0.014 0.133 -0.032 -0.034 -0.061 -0.101 8 9 10 11 12 13 14 -0.023 0.380 -0.007 -0.250 0.052 -0.076 -0.022 > 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/2doat1228757750.tab") > > system("convert tmp/1ysy61228757750.ps tmp/1ysy61228757750.png") > > > proc.time() user system elapsed 0.397 0.186 0.575