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(0.6923,0.6886,0.6855,0.6745,0.6769,0.6758,0.6896,0.6843,0.6818,0.6774,0.6821,0.6885,0.6829,0.6796,0.6976,0.6924,0.6849,0.6921,0.6839,0.6727,0.6776,0.6692,0.6738,0.6740,0.6635,0.6737,0.6788,0.6828,0.6795,0.6740,0.6744,0.6764,0.6987,0.6967,0.7116,0.7357,0.7455,0.7639,0.7958,0.7864,0.7853,0.7903,0.7866,0.8039,0.7916,0.7903,0.8242,0.9567,0.8850,0.8865,0.9258,0.8948,0.8762,0.8527,0.8536,0.8805,0.9155,0.8961,0.9127,0.8857) > x <- c(1.3031,1.3241,1.2961,1.2865,1.2305,1.2101,1.2125,1.2350,1.2014,1.1992,1.1791,1.1832,1.2159,1.1922,1.2114,1.2614,1.2812,1.2786,1.2772,1.2815,1.2679,1.2765,1.3247,1.3191,1.3029,1.3234,1.3354,1.3651,1.3453,1.3534,1.3706,1.3638,1.4268,1.4485,1.4635,1.4587,1.4876,1.5189,1.5783,1.5633,1.5554,1.5757,1.5593,1.4660,1.4065,1.2759,1.2705,1.3954,1.2793,1.2694,1.3282,1.3230,1.4135,1.4042,1.4253,1.4322,1.4632,1.4713,1.5016,1.4318) > par7 = '1' > par6 = '2' > par5 = '0.0' > par4 = '12' > par3 = '1' > par2 = '2' > par1 = '0.0' > #'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] 0.073020749 0.010530299 0.012199783 -0.045393505 -0.017763071 [6] -0.011948651 0.031939690 -0.008321304 0.045374448 -0.061674823 [11] -0.031911518 0.074914884 -0.042245523 -0.011499000 -0.011736887 [16] 0.038219891 0.005689885 -0.022058967 0.064163296 -0.047494137 [21] -0.035096167 0.027712906 0.031024458 -0.026764919 0.024124568 [26] -0.060881400 0.041090586 -0.002580463 -0.030055233 -0.033634449 [31] -0.029866788 -0.025954393 0.098003324 0.111599365 -0.203542302 [36] 0.077895503 0.035509376 -0.001291775 0.065606648 -0.090801261 [41] 0.044945211 0.041151617 -0.003681456 0.040125734 -0.078346952 [46] -0.165995532 > y [1] 0.030138744 -0.021958761 -0.023137631 0.026526846 -0.044217280 [6] 0.023336349 0.019714678 -0.016917491 0.005935782 -0.008978291 [11] 0.001507889 0.027634475 -0.038699958 0.031957364 -0.007311283 [16] -0.024630958 0.031096776 0.006961412 0.005705717 -0.015571560 [21] 0.004703081 0.018698999 -0.004075727 -0.019808262 0.024243680 [26] -0.051127169 0.021202786 0.011028934 -0.019759988 0.024079869 [31] -0.066649331 0.049078488 0.019616575 0.094930628 -0.206905098 [36] 0.068446649 0.025154371 -0.024641765 0.002569574 -0.013927304 [41] 0.039281074 0.003524530 0.045126901 -0.074173862 -0.003870616 [46] -0.155460217 > postscript(file="/var/www/html/rcomp/tmp/1jvwn1292163878.ps",horizontal=F,onefile=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 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -0.111 -0.244 0.258 -0.177 0.237 -0.189 -0.077 0.074 0.068 -0.089 0.108 -2 -1 0 1 2 3 4 5 6 7 8 -0.193 -0.197 0.713 -0.155 0.082 -0.129 -0.092 0.180 -0.053 -0.085 0.015 9 10 11 12 13 -0.013 -0.037 0.257 -0.113 -0.120 > 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/28etg1292163878.tab") > > try(system("convert tmp/1jvwn1292163878.ps tmp/1jvwn1292163878.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.388 0.169 0.770