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 = '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] 0.3031 0.3241 0.2961 0.2865 0.2305 0.2101 0.2125 0.2350 0.2014 0.1992 [11] 0.1791 0.1832 0.2159 0.1922 0.2114 0.2614 0.2812 0.2786 0.2772 0.2815 [21] 0.2679 0.2765 0.3247 0.3191 0.3029 0.3234 0.3354 0.3651 0.3453 0.3534 [31] 0.3706 0.3638 0.4268 0.4485 0.4635 0.4587 0.4876 0.5189 0.5783 0.5633 [41] 0.5554 0.5757 0.5593 0.4660 0.4065 0.2759 0.2705 0.3954 0.2793 0.2694 [51] 0.3282 0.3230 0.4135 0.4042 0.4253 0.4322 0.4632 0.4713 0.5016 0.4318 > y [1] -0.3077 -0.3114 -0.3145 -0.3255 -0.3231 -0.3242 -0.3104 -0.3157 -0.3182 [10] -0.3226 -0.3179 -0.3115 -0.3171 -0.3204 -0.3024 -0.3076 -0.3151 -0.3079 [19] -0.3161 -0.3273 -0.3224 -0.3308 -0.3262 -0.3260 -0.3365 -0.3263 -0.3212 [28] -0.3172 -0.3205 -0.3260 -0.3256 -0.3236 -0.3013 -0.3033 -0.2884 -0.2643 [37] -0.2545 -0.2361 -0.2042 -0.2136 -0.2147 -0.2097 -0.2134 -0.1961 -0.2084 [46] -0.2097 -0.1758 -0.0433 -0.1150 -0.1135 -0.0742 -0.1052 -0.1238 -0.1473 [55] -0.1464 -0.1195 -0.0845 -0.1039 -0.0873 -0.1143 > postscript(file="/var/www/html/rcomp/tmp/1d27i1292161811.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.712 0.681 0.677 0.658 0.630 0.623 0.581 0.546 0.525 0.499 0.466 -3 -2 -1 0 1 2 3 4 5 6 7 0.453 0.427 0.445 0.475 0.425 0.388 0.359 0.318 0.283 0.236 0.186 8 9 10 11 12 13 14 0.142 0.100 0.048 0.010 -0.035 -0.076 -0.090 > 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/2uvlf1292161811.tab") > > try(system("convert tmp/1d27i1292161811.ps tmp/1d27i1292161811.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.379 0.183 0.802