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(15.13,15.25,15.33,15.36,15.4,15.4,15.41,15.47,15.54,15.55,15.59,15.65,15.75,15.86,15.89,15.94,15.93,15.95,15.99,15.99,16.06,16.08,16.07,16.11,16.15,16.15,16.18,16.3,16.42,16.49,16.5,16.58,16.64,16.66,16.81,16.91,16.92,16.95,17.11,17.16,17.16,17.27,17.34,17.39,17.43,17.45,17.5,17.56,17.62,17.7,17.72,17.71,17.74,17.75,17.78,17.8) > x <- c(10.92,10.98,11.15,11.19,11.33,11.38,11.4,11.45,11.56,11.61,11.82,11.77,11.85,11.82,11.92,11.86,11.87,11.94,11.86,11.92,11.83,11.91,11.93,11.99,11.96,12.12,11.85,12.01,12.1,12.21,12.31,12.31,12.39,12.35,12.41,12.51,12.27,12.51,12.44,12.47,12.51,12.58,12.5,12.52,12.59,12.51,12.67,12.64,12.54,12.66,12.67,12.62,12.72,12.85,12.85,12.82) > par7 = '1' > par6 = '0' > par5 = '1' > par4 = '1' > 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/ > #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.06 0.17 0.04 0.14 0.05 0.02 0.05 0.11 0.05 0.21 -0.05 0.08 [13] -0.03 0.10 -0.06 0.01 0.07 -0.08 0.06 -0.09 0.08 0.02 0.06 -0.03 [25] 0.16 -0.27 0.16 0.09 0.11 0.10 0.00 0.08 -0.04 0.06 0.10 -0.24 [37] 0.24 -0.07 0.03 0.04 0.07 -0.08 0.02 0.07 -0.08 0.16 -0.03 -0.10 [49] 0.12 0.01 -0.05 0.10 0.13 0.00 -0.03 > y [1] 0.12 0.08 0.03 0.04 0.00 0.01 0.06 0.07 0.01 0.04 0.06 0.10 [13] 0.11 0.03 0.05 -0.01 0.02 0.04 0.00 0.07 0.02 -0.01 0.04 0.04 [25] 0.00 0.03 0.12 0.12 0.07 0.01 0.08 0.06 0.02 0.15 0.10 0.01 [37] 0.03 0.16 0.05 0.00 0.11 0.07 0.05 0.04 0.02 0.05 0.06 0.06 [49] 0.08 0.02 -0.01 0.03 0.01 0.03 0.02 > postscript(file="/var/www/rcomp/tmp/11njx1292339498.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.045 -0.003 -0.188 0.053 0.122 0.003 -0.131 0.046 0.096 -0.099 0.219 -3 -2 -1 0 1 2 3 4 5 6 7 0.077 -0.185 0.017 0.086 0.042 -0.015 0.151 -0.119 -0.043 0.005 -0.126 8 9 10 11 12 13 14 0.000 -0.019 0.002 0.015 0.093 -0.250 -0.029 > 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/2q6gq1292339498.tab") > > try(system("convert tmp/11njx1292339498.ps tmp/11njx1292339498.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.430 0.220 0.641