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(105.15,105.24,105.57,105.62,106.17,106.27,106.41,106.94,107.16,107.32,107.32,107.35,107.55,107.87,108.37,108.38,107.92,108.03,108.14,108.3,108.64,108.66,109.04,109.03,109.03,109.54,109.75,109.83,109.65,109.82,109.95,110.12,110.15,110.21,109.99,110.14,110.14,110.81,110.97,110.99,109.73,109.81,110.02,110.18,110.21,110.25,110.36,110.51,110.6,110.95,111.18,111.19,111.69,111.7,111.83,111.77,111.73,112.01,111.86,112.04) > x <- c(118.63,121.83,119.97,124.98,129.99,126.6,121.71,119.28,122.63,116.74,114.23,113.23,112.75,113.54,115.3,121.05,119.51,116.78,117.17,117.5,119.65,120.97,117.18,116.87,119.46,122.52,124.1,118.39,113.1,113.94,114.58,118.79,120.44,118.37,118.44,117.93,117.76,118.29,121.11,124.86,131.17,130.16,131.76,134.7,135.32,140.23,136.31,131.62,128.9,133.89,138.21,146.12,144.69,149.18,156.6,158.87,164.85,162.89,153.31,150.91) > 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] 117.63 120.83 118.97 123.98 128.99 125.60 120.71 118.28 121.63 115.74 [11] 113.23 112.23 111.75 112.54 114.30 120.05 118.51 115.78 116.17 116.50 [21] 118.65 119.97 116.18 115.87 118.46 121.52 123.10 117.39 112.10 112.94 [31] 113.58 117.79 119.44 117.37 117.44 116.93 116.76 117.29 120.11 123.86 [41] 130.17 129.16 130.76 133.70 134.32 139.23 135.31 130.62 127.90 132.89 [51] 137.21 145.12 143.69 148.18 155.60 157.87 163.85 161.89 152.31 149.91 > y [1] 104.15 104.24 104.57 104.62 105.17 105.27 105.41 105.94 106.16 106.32 [11] 106.32 106.35 106.55 106.87 107.37 107.38 106.92 107.03 107.14 107.30 [21] 107.64 107.66 108.04 108.03 108.03 108.54 108.75 108.83 108.65 108.82 [31] 108.95 109.12 109.15 109.21 108.99 109.14 109.14 109.81 109.97 109.99 [41] 108.73 108.81 109.02 109.18 109.21 109.25 109.36 109.51 109.60 109.95 [51] 110.18 110.19 110.69 110.70 110.83 110.77 110.73 111.01 110.86 111.04 > postscript(file="/var/www/html/freestat/rcomp/tmp/1xqif1228163672.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.073 -0.032 0.001 0.020 0.045 0.074 0.122 0.172 0.226 0.287 0.350 -3 -2 -1 0 1 2 3 4 5 6 7 0.425 0.496 0.556 0.612 0.600 0.592 0.574 0.576 0.589 0.598 0.588 8 9 10 11 12 13 14 0.563 0.552 0.532 0.515 0.503 0.480 0.460 > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/27axu1228163672.tab") > > system("convert tmp/1xqif1228163672.ps tmp/1xqif1228163672.png") > > > proc.time() user system elapsed 0.558 0.231 0.618