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(101,88,108,116,104,110,105,107,124,109,102,125,102,101,116,114,115,119,108,110,120,113,111,121,99,104,117,108,122,122,111,111,131,108,118,119,104,105,118,124,123,114,119,116,129,112,123,124,117,110,118,135,127,117,137,130,132,142,122,126) > x <- c(106,82,114,118,105,105,103,107,123,112,104,122,108,94,120,118,117,113,106,108,122,115,110,120,104,96,121,111,120,114,107,108,127,105,119,121,106,97,119,122,121,106,114,112,127,109,118,123,115,105,116,131,121,104,127,126,124,132,117,123) > par7 = '0' > par6 = '0' > par5 = '0.0' > par4 = '12' > par3 = '0' > par2 = '0' > par1 = '0.0' > #'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] 4.663439 4.406719 4.736198 4.770685 4.653960 4.653960 4.634729 4.672829 [9] 4.812184 4.718499 4.644391 4.804021 4.682131 4.543295 4.787492 4.770685 [17] 4.762174 4.727388 4.663439 4.682131 4.804021 4.744932 4.700480 4.787492 [25] 4.644391 4.564348 4.795791 4.709530 4.787492 4.736198 4.672829 4.682131 [33] 4.844187 4.653960 4.779123 4.795791 4.663439 4.574711 4.779123 4.804021 [41] 4.795791 4.663439 4.736198 4.718499 4.844187 4.691348 4.770685 4.812184 [49] 4.744932 4.653960 4.753590 4.875197 4.795791 4.644391 4.844187 4.836282 [57] 4.820282 4.882802 4.762174 4.812184 > y [1] 4.615121 4.477337 4.682131 4.753590 4.644391 4.700480 4.653960 4.672829 [9] 4.820282 4.691348 4.624973 4.828314 4.624973 4.615121 4.753590 4.736198 [17] 4.744932 4.779123 4.682131 4.700480 4.787492 4.727388 4.709530 4.795791 [25] 4.595120 4.644391 4.762174 4.682131 4.804021 4.804021 4.709530 4.709530 [33] 4.875197 4.682131 4.770685 4.779123 4.644391 4.653960 4.770685 4.820282 [41] 4.812184 4.736198 4.779123 4.753590 4.859812 4.718499 4.812184 4.820282 [49] 4.762174 4.700480 4.770685 4.905275 4.844187 4.762174 4.919981 4.867534 [57] 4.882802 4.955827 4.804021 4.836282 > postscript(file="/var/www/html/rcomp/tmp/1b5761227878005.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.012 0.019 0.424 0.156 -0.158 0.163 0.162 -0.018 0.297 0.163 0.067 -3 -2 -1 0 1 2 3 4 5 6 7 0.256 0.070 0.160 0.906 0.266 -0.066 0.310 0.209 0.128 0.293 0.024 8 9 10 11 12 13 14 0.020 0.127 -0.068 0.050 0.432 0.064 -0.145 > 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/2aki21227878005.tab") > > system("convert tmp/1b5761227878005.ps tmp/1b5761227878005.png") > > > proc.time() user system elapsed 0.379 0.175 0.472