R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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 = '1' > par5 = '1' > par4 = '1' > par3 = '0' > par2 = '1' > 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.0210 -0.0280 -0.0096 -0.0560 -0.0204 0.0024 0.0225 -0.0336 -0.0022 [10] -0.0201 0.0041 0.0327 -0.0237 0.0192 0.0500 0.0198 -0.0026 -0.0014 [19] 0.0043 -0.0136 0.0086 0.0482 -0.0056 -0.0162 0.0205 0.0120 0.0297 [28] -0.0198 0.0081 0.0172 -0.0068 0.0630 0.0217 0.0150 -0.0048 0.0289 [37] 0.0313 0.0594 -0.0150 -0.0079 0.0203 -0.0164 -0.0933 -0.0595 -0.1306 [46] -0.0054 0.1249 -0.1161 -0.0099 0.0588 -0.0052 0.0905 -0.0093 0.0211 [55] 0.0069 0.0310 0.0081 0.0303 -0.0698 > y [1] -0.0037 -0.0031 -0.0110 0.0024 -0.0011 0.0138 -0.0053 -0.0025 -0.0044 [10] 0.0047 0.0064 -0.0056 -0.0033 0.0180 -0.0052 -0.0075 0.0072 -0.0082 [19] -0.0112 0.0049 -0.0084 0.0046 0.0002 -0.0105 0.0102 0.0051 0.0040 [28] -0.0033 -0.0055 0.0004 0.0020 0.0223 -0.0020 0.0149 0.0241 0.0098 [37] 0.0184 0.0319 -0.0094 -0.0011 0.0050 -0.0037 0.0173 -0.0123 -0.0013 [46] 0.0339 0.1325 -0.0717 0.0015 0.0393 -0.0310 -0.0186 -0.0235 0.0009 [55] 0.0269 0.0350 -0.0194 0.0166 -0.0270 > postscript(file="/var/www/rcomp/tmp/1z3fg1292429443.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.129 0.013 -0.116 0.061 -0.065 0.313 0.143 -0.169 0.098 0.070 -0.123 -3 -2 -1 0 1 2 3 4 5 6 7 0.125 -0.362 -0.299 0.544 -0.161 -0.077 0.060 -0.061 0.117 0.009 -0.062 8 9 10 11 12 13 14 -0.104 0.046 -0.118 0.060 -0.118 -0.120 -0.032 > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/264cs1292429443.tab") > > try(system("convert tmp/1z3fg1292429443.ps tmp/1z3fg1292429443.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.410 0.260 0.641