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.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > x <- c(0.527,0.472,0.000,0.052,0.313,0.364,0.363,-0.155,0.052,0.568,0.668,1.378,0.252,-0.402,-0.050,0.555,0.050,0.150,0.450,0.299,0.199,0.496,0.444,-0.393,-0.444,0.198,0.494,0.133,0.388,0.484,0.278,0.369,0.165,0.155,0.087,0.414,0.360,0.975,0.270,0.359,0.169,0.381,0.154,0.486,0.925,0.728,-0.014,0.046,-0.819,-1.674,-0.788,0.279,0.396,-0.141,-0.019,0.099,0.742,0.005,0.448) > 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.473 -0.528 -1.000 -0.948 -0.687 -0.636 -0.637 -1.155 -0.948 -0.432 [11] -0.332 0.378 -0.748 -1.402 -1.050 -0.445 -0.950 -0.850 -0.550 -0.701 [21] -0.801 -0.504 -0.556 -1.393 -1.444 -0.802 -0.506 -0.867 -0.612 -0.516 [31] -0.722 -0.631 -0.835 -0.845 -0.913 -0.586 -0.640 -0.025 -0.730 -0.641 [41] -0.831 -0.619 -0.846 -0.514 -0.075 -0.272 -1.014 -0.954 -1.819 -2.674 [51] -1.788 -0.721 -0.604 -1.141 -1.019 -0.901 -0.258 -0.995 -0.552 > y [1] -0.2539 -0.2225 -0.2210 -0.2256 -0.2095 -0.2281 -0.2189 -0.2443 -0.2363 [10] -0.2405 -0.2529 -0.2385 -0.2513 -0.2611 -0.2663 -0.2490 -0.2618 -0.2841 [19] -0.2458 -0.2364 -0.2567 -0.2342 -0.2373 -0.2520 -0.2308 -0.2150 -0.2087 [28] -0.2280 -0.2120 -0.1930 -0.1732 -0.1756 -0.1513 -0.1428 -0.1786 -0.1173 [37] -0.0784 -0.1135 -0.1184 -0.1116 -0.0534 -0.0820 -0.0663 -0.0441 -0.0374 [46] -0.0566 -0.1361 -0.2004 -0.3320 -0.3428 -0.3072 -0.3562 -0.3546 -0.3127 [55] -0.2735 -0.2088 -0.1886 -0.1719 -0.1607 > postscript(file="/var/www/html/rcomp/tmp/1sh001260466816.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -0.032 -0.088 -0.123 -0.082 -0.064 -0.128 -0.113 -0.048 0.018 0.113 0.230 -3 -2 -1 0 1 2 3 4 5 6 7 0.325 0.356 0.387 0.428 0.348 0.147 -0.047 -0.175 -0.227 -0.237 -0.216 8 9 10 11 12 13 14 -0.249 -0.255 -0.240 -0.187 -0.177 -0.191 -0.163 > 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/2h2x51260466816.tab") > > system("convert tmp/1sh001260466816.ps tmp/1sh001260466816.png") > > > proc.time() user system elapsed 0.379 0.164 0.464