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(467037,460070,447988,442867,436087,431328,484015,509673,512927,502831,470984,471067,476049,474605,470439,461251,454724,455626,516847,525192,522975,518585,509239,512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590) > 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,75.5,85.7,72.2,79.9,85.3,52.2,61.2,82.4,85.4,78.2,70.2,70.2,69.3,77.5,66.1,69,79.2,56.2,63.3,77.8,92,78.1,65.1,71.1,70.9,72,81.9,70.6,72.5,65.1,54.9) > 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] 97.1 100.1 110.1 92.3 99.0 107.0 69.4 74.4 104.5 111.3 101.5 92.5 [13] 85.7 94.2 102.8 96.0 94.5 100.0 66.5 63.0 105.7 99.6 100.2 92.1 [25] 83.2 84.8 90.8 91.4 79.3 78.7 61.5 56.1 99.8 99.7 85.2 82.2 [37] 70.7 76.5 88.8 79.3 77.7 92.8 56.6 59.6 90.0 84.3 76.4 76.3 [49] 67.3 68.9 80.7 74.1 68.9 83.0 53.3 59.0 88.9 76.0 84.3 76.6 [61] 68.2 74.5 84.7 71.2 78.9 84.3 51.2 60.2 81.4 84.4 77.2 69.2 [73] 69.2 68.3 76.5 65.1 68.0 78.2 55.2 62.3 76.8 91.0 77.1 64.1 [85] 70.1 69.9 71.0 80.9 69.6 71.5 64.1 53.9 > y [1] 467036 460069 447987 442866 436086 431327 484014 509672 512926 502830 [11] 470983 471066 476048 474604 470438 461250 454723 455625 516846 525191 [21] 522974 518584 509238 512237 519163 517008 509932 509126 500856 506970 [31] 569322 579713 577991 565463 547343 554787 562324 560853 555331 543598 [41] 536661 542721 593529 610762 612612 611323 594166 595453 590864 589378 [51] 584427 573099 567455 569027 620734 628883 628231 612116 595403 597140 [61] 593407 590071 579798 574204 572774 572941 619566 625808 619915 587624 [71] 565741 557273 560575 548853 531672 525918 511037 498661 555361 564590 [81] 541656 527069 509845 514257 516921 507560 492621 490242 469356 477579 [91] 528378 533589 > postscript(file="/var/www/html/rcomp/tmp/1zqdo1228240022.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.037 -0.126 -0.205 -0.247 -0.268 -0.117 -0.021 -0.134 -0.256 -0.313 -0.316 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.289 -0.278 -0.374 -0.477 -0.517 -0.505 -0.310 -0.174 -0.270 -0.402 -0.446 6 7 8 9 10 11 12 13 14 15 16 -0.424 -0.403 -0.371 -0.416 -0.474 -0.466 -0.440 -0.271 -0.151 -0.231 -0.323 > 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/2vls01228240023.tab") > > system("convert tmp/1zqdo1228240022.ps tmp/1zqdo1228240022.png") > > > proc.time() user system elapsed 0.406 0.165 0.479