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(105.2,91.5,75.3,60.5,80.4,84.5,93.9,78,92.3,90,72.1,76.9,76,88.7,55.4,46.6,90.9,84.9,89,90.2,72.3,83,71.6,75.4,85.1,81.2,68.7,68.4,93.7,96.6,101.8,93.6,88.9,114.1,82.3,96.4,104,88.2,85.2,87.1,85.5,89.1,105.2,82.9,86.8,112,97.4,88.9,109.4,87.8,90.5,79.3,114.9,118.8,125,96.1,116.7,119.5,104.1,121,127.3,117.7,108,89.4,137.4,142,137.3,122.8,126.1,147.6,115.7,139.2,151.2,123.8,109,112.1,136.4,135.5,138.7,137.5,141.5,143.6,146.5,200.7,196.2) > x <- c(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.1,77,108,119.9,105.9,78.2,100.3,102.2,97,101.3,89.2,93.3,88.5,61.5,95) > par7 = '1' > par6 = '0' > par5 = '0.1' > par4 = '12' > par3 = '1' > 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#output/ > #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] 4.1 -1.9 3.0 2.5 5.4 2.4 -3.1 -0.2 -5.6 -1.2 -3.6 -5.0 [13] -3.9 -5.3 -9.9 2.0 -7.3 -3.3 12.6 -2.4 2.4 14.3 1.1 7.9 [25] 6.0 -2.5 3.6 4.6 -7.6 -1.8 -10.2 -2.4 -3.8 -6.4 -8.1 -4.0 [37] -6.1 -9.4 4.1 -1.5 4.2 2.6 11.4 -2.4 14.3 9.3 8.8 7.3 [49] 5.9 15.6 7.4 1.1 10.2 7.6 4.6 6.9 1.1 -0.1 5.6 3.9 [61] -2.7 8.3 -4.8 -5.8 -1.3 0.1 -16.9 2.3 -11.2 -16.2 -4.6 -15.5 [73] -13.0 > y [1] -0.509586115 -0.048745621 -0.465618186 -0.388357015 0.191513967 [6] 0.007361488 -0.084182071 0.226305997 -0.379322882 -0.126469653 [11] -0.010670565 -0.030380880 0.175379112 -0.137738583 0.324947071 [16] 0.574476620 0.047698528 0.202599857 0.211921268 0.058148339 [21] 0.320423990 0.503018521 0.214978755 0.383253917 0.315942544 [26] 0.128888590 0.332143586 0.373260720 -0.143547635 -0.127133377 [31] 0.052247558 -0.189974861 -0.037399809 -0.029804817 0.264050653 [36] -0.127380600 0.080746751 -0.007112565 0.094410642 -0.145967385 [41] 0.468009769 0.457259231 0.277086884 0.231530303 0.469447439 [46] 0.104237103 0.105509402 0.490393443 0.244180601 0.465277006 [51] 0.279863192 0.186762260 0.289982433 0.290215708 0.152822068 [56] 0.391805219 0.125174732 0.344352460 0.169007202 0.227944248 [61] 0.281771204 0.081603803 0.014727053 0.358661402 -0.011946441 [66] -0.076731129 0.016605044 0.183955534 0.187983925 -0.045210375 [71] 0.384084037 0.610513656 0.435997870 > postscript(file="/var/www/html/rcomp/tmp/1dvf81229593764.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -0.033 -0.080 -0.086 -0.126 -0.053 -0.145 -0.040 -0.099 -0.082 -0.016 0.064 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.044 0.188 0.168 0.056 0.267 0.189 0.201 0.268 0.284 0.196 0.325 7 8 9 10 11 12 13 14 15 0.046 0.159 -0.015 -0.120 -0.039 -0.074 -0.292 -0.123 -0.265 > 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/2yp8s1229593764.tab") > > system("convert tmp/1dvf81229593764.ps tmp/1dvf81229593764.png") > > > proc.time() user system elapsed 1.165 0.280 1.231