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.00,1.04,1.02,1.07,1.12,1.08,1.02,1.01,1.04,0.98,0.95,0.94,0.94,0.96,0.97,1.03,1.01,0.99,1.00,1.00,1.02,1.01,0.99,0.98,1.01,1.03,1.03,1.00,0.96,0.97,0.98,1.02,1.04,1.01,1.01,1.00,1.01,1.02,1.03,1.06,1.12,1.12,1.13,1.13,1.13,1.17,1.14,1.08,1.07,1.12,1.14,1.21,1.20,1.23,1.29,1.31,1.37,1.35,1.26,1.26) > x <- c(0.33,0.33,0.32,0.33,0.34,0.36,0.34,0.33,0.35,0.31,0.28,0.26,0.26,0.26,0.29,0.30,0.30,0.28,0.29,0.29,0.32,0.33,0.29,0.31,0.33,0.36,0.39,0.30,0.27,0.28,0.29,0.30,0.30,0.30,0.31,0.30,0.31,0.29,0.32,0.33,0.35,0.35,0.36,0.40,0.40,0.47,0.43,0.38,0.38,0.40,0.45,0.47,0.45,0.50,0.54,0.55,0.59,0.51,0.50,0.50) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > 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.67 -0.67 -0.68 -0.67 -0.66 -0.64 -0.66 -0.67 -0.65 -0.69 -0.72 -0.74 [13] -0.74 -0.74 -0.71 -0.70 -0.70 -0.72 -0.71 -0.71 -0.68 -0.67 -0.71 -0.69 [25] -0.67 -0.64 -0.61 -0.70 -0.73 -0.72 -0.71 -0.70 -0.70 -0.70 -0.69 -0.70 [37] -0.69 -0.71 -0.68 -0.67 -0.65 -0.65 -0.64 -0.60 -0.60 -0.53 -0.57 -0.62 [49] -0.62 -0.60 -0.55 -0.53 -0.55 -0.50 -0.46 -0.45 -0.41 -0.49 -0.50 -0.50 > y [1] 0.00 0.04 0.02 0.07 0.12 0.08 0.02 0.01 0.04 -0.02 -0.05 -0.06 [13] -0.06 -0.04 -0.03 0.03 0.01 -0.01 0.00 0.00 0.02 0.01 -0.01 -0.02 [25] 0.01 0.03 0.03 0.00 -0.04 -0.03 -0.02 0.02 0.04 0.01 0.01 0.00 [37] 0.01 0.02 0.03 0.06 0.12 0.12 0.13 0.13 0.13 0.17 0.14 0.08 [49] 0.07 0.12 0.14 0.21 0.20 0.23 0.29 0.31 0.37 0.35 0.26 0.26 > postscript(file="/var/www/html/rcomp/tmp/1dmoo1227880093.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 -3 -2 0.129 0.183 0.233 0.281 0.298 0.323 0.362 0.410 0.485 0.541 0.603 0.704 0.791 -1 0 1 2 3 4 5 6 7 8 9 10 11 0.893 0.959 0.895 0.820 0.720 0.630 0.554 0.455 0.383 0.341 0.316 0.313 0.295 12 13 14 0.260 0.235 0.184 > 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/28yta1227880093.tab") > > system("convert tmp/1dmoo1227880093.ps tmp/1dmoo1227880093.png") > > > proc.time() user system elapsed 0.393 0.171 0.627