R version 2.7.0 (2008-04-22) 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(104.3,119.8,116.8,118.2,107.4,110.8,94.8,96.5,113.4,109.8,118.7,117.2,110.3,111.6,128.1,121.3,107.3,120.5,98.5,97.7,113.2,114.6,118.3,123.9,113.6,117.5,130.1,124.7,114.2,127.3,105.9,101.5,120.2,117.1,131.1,130,120.6,123.1,135.3,134.1,123.7,134.6,108.3,110.4,127.8,126.6,131.4,141.1,127,127.3,143.6,149.4,126.6,136.5,116,118,131.4,140.7,144.9,143.9,127.1) > x <- c(569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478,528) > 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] 568 579 577 564 546 554 561 560 554 543 536 542 593 610 612 610 593 594 590 [20] 588 583 572 566 568 620 628 627 611 594 596 592 589 579 573 572 572 619 625 [39] 619 587 565 556 560 548 531 525 510 498 554 564 541 526 509 513 516 507 492 [58] 489 468 477 527 > y [1] 103.3 118.8 115.8 117.2 106.4 109.8 93.8 95.5 112.4 108.8 117.7 116.2 [13] 109.3 110.6 127.1 120.3 106.3 119.5 97.5 96.7 112.2 113.6 117.3 122.9 [25] 112.6 116.5 129.1 123.7 113.2 126.3 104.9 100.5 119.2 116.1 130.1 129.0 [37] 119.6 122.1 134.3 133.1 122.7 133.6 107.3 109.4 126.8 125.6 130.4 140.1 [49] 126.0 126.3 142.6 148.4 125.6 135.5 115.0 117.0 130.4 139.7 143.9 142.9 [61] 126.1 > postscript(file="/var/www/html/rcomp/tmp/14za91228228614.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.145 0.086 0.020 0.037 0.084 0.102 0.043 -0.181 -0.393 -0.408 -0.427 -3 -2 -1 0 1 2 3 4 5 6 7 -0.329 -0.249 -0.331 -0.406 -0.363 -0.266 -0.206 -0.195 -0.408 -0.623 -0.627 8 9 10 11 12 13 14 -0.613 -0.483 -0.333 -0.328 -0.363 -0.301 -0.210 > 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/2wcqf1228228614.tab") > > system("convert tmp/14za91228228614.ps tmp/14za91228228614.png") > > > proc.time() user system elapsed 1.176 0.286 1.236