R version 2.7.0 (2008-04-22) 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(143.6,104.5,123.3,156.6,136.2,147.5,143.8,135.8,121.6,128.0,129.7,136.2,130.5,99.2,110.4,151.6,129.6,123.6,142.7,119.0,118.1,120.0,124.3,123.3,122.4,90.5,91.0,137.0,127.7,105.1,135.6,112.4,102.5,112.6,110.8,103.4,117.6,87.5,87.0,130.0,102.9,111.1,128.9,106.3,99.0,109.9,104.0,112.9,113.6,83.4,79.8,123.9,100.0,112.0,125.9,96.9,90.1,106.6,98.0,100.5) > x <- c(130.5,104.7,115.2,124.5,112.3,127.5,120.6,117.5,117.7,120.4,125.0,131.6,121.1,114.2,112.1,127.0,116.8,112.0,129.7,113.6,115.7,119.5,125.8,129.6,128.0,112.8,101.6,123.9,118.8,109.1,130.6,112.4,111.0,116.2,119.8,117.2,127.3,107.7,97.5,120.1,110.6,111.3,119.8,105.5,108.7,128.7,119.5,121.1,128.4,108.8,107.5,125.6,102.9,107.5,120.4,104.3,100.6,121.9,112.7,124.9) > 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] 129.5 103.7 114.2 123.5 111.3 126.5 119.6 116.5 116.7 119.4 124.0 130.6 [13] 120.1 113.2 111.1 126.0 115.8 111.0 128.7 112.6 114.7 118.5 124.8 128.6 [25] 127.0 111.8 100.6 122.9 117.8 108.1 129.6 111.4 110.0 115.2 118.8 116.2 [37] 126.3 106.7 96.5 119.1 109.6 110.3 118.8 104.5 107.7 127.7 118.5 120.1 [49] 127.4 107.8 106.5 124.6 101.9 106.5 119.4 103.3 99.6 120.9 111.7 123.9 > y [1] 142.6 103.5 122.3 155.6 135.2 146.5 142.8 134.8 120.6 127.0 128.7 135.2 [13] 129.5 98.2 109.4 150.6 128.6 122.6 141.7 118.0 117.1 119.0 123.3 122.3 [25] 121.4 89.5 90.0 136.0 126.7 104.1 134.6 111.4 101.5 111.6 109.8 102.4 [37] 116.6 86.5 86.0 129.0 101.9 110.1 127.9 105.3 98.0 108.9 103.0 111.9 [49] 112.6 82.4 78.8 122.9 99.0 111.0 124.9 95.9 89.1 105.6 97.0 99.5 > postscript(file="/var/www/html/rcomp/tmp/1femj1228826916.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.223 -0.073 0.430 -0.008 -0.125 0.235 -0.036 0.092 0.441 0.091 -0.016 -3 -2 -1 0 1 2 3 4 5 6 7 0.269 -0.170 -0.043 0.705 0.031 -0.036 0.414 0.047 0.150 0.543 0.140 8 9 10 11 12 13 14 0.059 0.186 -0.205 -0.058 0.459 0.028 -0.118 > 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/2bopw1228826916.tab") > > system("convert tmp/1femj1228826916.ps tmp/1femj1228826916.png") > > > proc.time() user system elapsed 1.178 0.280 1.235