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(6,6,6,6,5,6,5,6,5,7,4,5,6,6,5,3,2,3,3,2,0,4,4,5,6,6,5,5,3,5,5,5,3,6,6,4,6,5,4,5,5,4,3,2,3,2,-1,0,-2,1,-2,-2,-2,-6,-4,-2,0,-5,-4,-5,-1,-2,-4,-1,1,1,-2,1,1,3,3,1,1) > x <- c(10570,10297,10635,10872,10296,10383,10431,10574,10653,10805,10872,10625,10407,10463,10556,10646,10702,11353,11346,11451,11964,12574,13031,13812,14544,14931,14886,16005,17064,15168,16050,15839,15137,14954,15648,15305,15579,16348,15928,16171,15937,15713,15594,15683,16438,17032,17696,17745,19394,20148,20108,18584,18441,18391,19178,18079,18483,19644,19195,19650,20830,23595,22937,21814,21928,21777,21383,21467,22052,22680,24320,24977,25204) > par7 = '1' > par6 = '2' > par5 = '1' > par4 = '12' > par3 = '2' > par2 = '1' > par1 = '-0.6' > #'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] -6.036394e-05 4.728011e-05 2.411374e-04 -6.097684e-05 -7.632730e-04 [6] 1.947886e-04 -5.499189e-05 -4.277463e-04 -3.341357e-04 -8.171949e-05 [11] -5.440696e-04 -3.591970e-04 3.802585e-08 -2.465012e-05 -3.667898e-04 [16] -4.010032e-04 8.841519e-04 -3.700244e-04 1.308715e-04 5.773183e-04 [21] 3.547217e-04 -4.798077e-05 3.378833e-04 3.021050e-04 -1.060830e-04 [26] 1.408585e-04 -7.966391e-05 2.548146e-04 -2.745091e-04 3.328642e-04 [31] -2.362709e-04 -3.593614e-04 -8.070603e-05 -1.405799e-04 -2.088965e-05 [36] -2.818310e-04 2.509631e-04 -1.352049e-04 3.446976e-04 1.179735e-05 [41] -4.501096e-05 -2.975383e-04 3.508039e-04 8.550299e-05 -1.567263e-04 [46] 3.995220e-04 -5.567847e-05 -3.931628e-05 > y [1] -1 -1 2 0 1 -3 1 3 1 -3 0 0 0 2 -3 2 -1 1 -1 [20] -1 1 -3 4 -2 1 1 1 -5 2 0 4 -7 1 6 -7 8 -6 1 [39] 1 -3 6 0 -2 -5 8 -6 8 -10 5 2 -1 2 -9 6 -3 9 -8 [58] 0 -3 > postscript(file="/var/www/html/rcomp/tmp/1n0zo1292941770.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 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 0.031 0.042 -0.177 0.263 -0.283 0.181 -0.235 0.338 -0.246 0.069 -0.012 -2 -1 0 1 2 3 4 5 6 7 8 -0.099 0.207 -0.223 0.193 -0.231 0.128 -0.067 0.112 -0.087 0.007 -0.024 9 10 11 12 13 -0.044 0.194 -0.258 0.184 -0.039 > 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/2msvl1292941770.tab") > try(system("convert tmp/1n0zo1292941770.ps tmp/1n0zo1292941770.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.388 0.163 0.760