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(147.4,148,158.1,165,187,190.3,182.4,168.8,151.2,120.1,112.5,106.2,107.1,108.5,106.5,108.3,125.6,124,127.2,136.9,135.8,124.3,115.4,113.6,114.4,118.4,117,116.5,115.4,113.6,117.4,116.9,116.4,111.1,110.2,118.9,131.8,130.6,138.3,148.4,148.7,144.3,152.5,162.9,167.2,166.5,185.6,193.2,207.8,223.4,246.4,266.3,264.3,255.8,259.5,289.1,288.5,243.8,224.8,177,171.6) > x <- c(117.6,121.7,127.3,129.8,137.1,141.4,137.4,130.7,117.2,110.8,111.4,108.2,108.8,110.2,109.5,109.5,116,111.2,112.1,114,119.1,114.1,115.1,115.4,110.8,116,119.2,126.5,127.8,131.3,140.3,137.3,143,134.5,139.9,159.3,170.4,175,175.8,180.9,180.3,169.6,172.3,184.8,177.7,184.6,211.4,215.3,215.9,244.7,259.3,289,310.9,321,315.1,333.2,314.1,284.7,273.9,216,196.4) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > par3 = '1' > par2 = '1' > 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] 1.5 -3.1 4.8 -3.0 -8.3 -2.7 -6.8 7.1 7.0 -3.8 3.8 0.8 [13] -2.1 0.7 6.5 -11.3 5.7 1.0 3.2 -10.1 6.0 -0.7 -4.9 9.8 [25] -2.0 4.1 -6.0 2.2 5.5 -12.0 8.7 -14.2 13.9 14.0 -8.3 -6.5 [37] -3.8 4.3 -5.7 -10.1 13.4 9.8 -19.6 14.0 19.9 -22.9 -3.3 28.2 [49] -14.2 15.1 -7.8 -11.8 -16.0 24.0 -37.2 -10.3 18.6 -47.1 38.3 > y [1] 146.4 147.0 157.1 164.0 186.0 189.3 181.4 167.8 150.2 119.1 111.5 105.2 [13] 106.1 107.5 105.5 107.3 124.6 123.0 126.2 135.9 134.8 123.3 114.4 112.6 [25] 113.4 117.4 116.0 115.5 114.4 112.6 116.4 115.9 115.4 110.1 109.2 117.9 [37] 130.8 129.6 137.3 147.4 147.7 143.3 151.5 161.9 166.2 165.5 184.6 192.2 [49] 206.8 222.4 245.4 265.3 263.3 254.8 258.5 288.1 287.5 242.8 223.8 176.0 [61] 170.6 > postscript(file="/var/www/html/freestat/rcomp/tmp/1o1sb1228251523.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.024 0.000 0.025 0.051 0.018 0.076 0.066 0.039 -0.002 -0.004 -0.070 -3 -2 -1 0 1 2 3 4 5 6 7 -0.068 -0.095 -0.218 -0.115 -0.117 -0.097 -0.055 -0.055 -0.054 -0.058 -0.023 8 9 10 11 12 13 14 -0.019 -0.020 -0.017 -0.026 -0.005 -0.012 -0.013 > 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/2rqkd1228251523.tab") > > system("convert tmp/1o1sb1228251523.ps tmp/1o1sb1228251523.png") > > > proc.time() user system elapsed 0.561 0.221 0.599