R version 2.8.0 (2008-10-20) 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(1.43,1.43,1.43,1.43,1.43,1.43,1.44,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.48,1.57,1.58,1.58,1.58,1.58,1.59,1.60,1.60,1.61,1.61,1.61,1.62,1.63,1.63,1.64,1.64,1.64,1.64,1.64,1.65,1.65,1.65,1.65,1.65,1.66,1.66,1.67,1.68,1.68,1.68,1.68,1.69,1.70,1.70,1.71,1.72,1.73,1.74,1.74,1.75,1.75,1.75,1.76,1.79,1.83,1.84,1.85) > x <- c(2.36,1.95,2.16,2.76,2.09,1.49,1.17,1.3,1.26,2.17,2.03,2.18,2.61,2.58,3.86,3.81,2.41,1.47,1.33,1.38,1.57,2.6,2.18,2.36,2.24,2.41,2.51,2.98,1.87,1.9,1.47,1.45,2.71,2.9,2.11,2.18,2.24,2.05,2.42,2.77,1.99,1.47,1.09,0.93,1.32,2.03,2.04,2.78,2.8,3.03,3.11,2.75,2.78,1.76,1.29,1.28,1.43,1.71,1.89,1.84,2.08,2.09,2.36,2.99,2.75,1.58,1.69,1.3,1.97,1.84,1.96,1.86,2.75,2.62,2.41,3.61,2.03,1.45,1.4,1.3,1.58,2.1,2.27,2.54) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '-0.7' > #'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.053299953 0.159298525 0.278270021 0.141798730 0.080932675 [6] -0.010270705 0.109833929 0.048675229 0.173414644 0.098729931 [11] 0.042362805 0.044725087 -0.082438648 -0.035959596 -0.195122057 [16] -0.105111759 -0.149975542 0.179349860 0.079166597 0.038816415 [21] 0.330846396 0.053857424 -0.019131988 -0.044725087 0.000000000 [26] -0.092545594 -0.019420682 -0.034912294 0.039269472 -0.179349860 [31] -0.254054403 -0.401618821 -0.465327089 -0.192281330 -0.020242391 [36] 0.129562715 0.117471805 0.206824899 0.123930842 -0.003560319 [41] 0.184133943 0.129179451 0.149607855 0.301153967 0.064092925 [46] -0.111035072 -0.047627661 -0.233897833 -0.160723651 -0.195211979 [51] -0.137574386 0.040030714 -0.005324138 -0.075443322 0.205912372 [56] 0.012973210 0.223416834 0.049062759 0.022997236 0.007028259 [61] 0.151904031 0.124774063 0.011409753 0.082009188 -0.166601382 [66] -0.064247169 -0.139366547 0.000000000 -0.148409231 0.082381674 [71] 0.087121056 0.181308990 > y [1] 0.43 0.43 0.43 0.43 0.43 0.43 0.44 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 [16] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 [31] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.57 0.58 0.58 0.58 0.58 0.59 0.60 0.60 [46] 0.61 0.61 0.61 0.62 0.63 0.63 0.64 0.64 0.64 0.64 0.64 0.65 0.65 0.65 0.65 [61] 0.65 0.66 0.66 0.67 0.68 0.68 0.68 0.68 0.69 0.70 0.70 0.71 0.72 0.73 0.74 [76] 0.74 0.75 0.75 0.75 0.76 0.79 0.83 0.84 0.85 > postscript(file="/var/www/html/rcomp/tmp/1lliv1228301807.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.123 -0.109 -0.096 -0.091 -0.053 -0.024 -0.018 -0.010 -0.030 -0.024 -0.017 -4 -3 -2 -1 0 1 2 3 4 5 6 0.008 -0.005 0.007 0.005 0.018 -0.001 0.002 0.035 0.035 0.037 0.026 7 8 9 10 11 12 13 14 15 0.014 0.024 0.062 0.086 0.109 0.122 0.125 0.117 0.079 > 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/2cgnu1228301807.tab") > > system("convert tmp/1lliv1228301807.ps tmp/1lliv1228301807.png") > > > proc.time() user system elapsed 0.378 0.186 0.477