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(7.3,7.1,7.1,6.8,6.5,6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8,8.1,8.2,8.3,8.2,8,7.9,7.6,7.6,8.2,8.3,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.6,6.2,6.2,6.8,6.9) > x <- c(13139.7,14532.2,15167,16071.1,14827.5,15082,14772.7,16083,14272.5,15223.3,14897.3,13062.6,12603.8,13629.8,14421.1,13978.3,12927.9,13429.9,13470.1,14785.8,14292,14308.8,14013,13240.9,12153.4,14289.7,15669.2,14169.5,14569.8,14469.1,14264.9,15320.9,14433.5,13691.5,14194.1,13519.2,11857.9,14616,15643.4,14077.2,14887.5,14159.9,14643,17192.5,15386.1,14287.1,17526.6,14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.7,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6,22404.1,21099,22486.5,23707.5,21897.5,23326.4,23765.4,20444) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '0' > par1 = '1' > ylab = '' > xlab = '' > main = '' > #'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] 13138.7 14531.2 15166.0 16070.1 14826.5 15081.0 14771.7 16082.0 14271.5 [10] 15222.3 14896.3 13061.6 12602.8 13628.8 14420.1 13977.3 12926.9 13428.9 [19] 13469.1 14784.8 14291.0 14307.8 14012.0 13239.9 12152.4 14288.7 15668.2 [28] 14168.5 14568.8 14468.1 14263.9 15319.9 14432.5 13690.5 14193.1 13518.2 [37] 11856.9 14615.0 15642.4 14076.2 14886.5 14158.9 14642.0 17191.5 15385.1 [46] 14286.1 17525.6 14496.0 14397.3 16628.6 16669.7 16613.8 16868.2 15662.9 [55] 16358.9 18446.7 16888.0 16504.0 18319.9 15051.1 15698.8 18134.3 16767.7 [64] 18882.0 19020.0 18100.9 17775.1 21488.9 17064.3 18689.0 18952.1 16397.9 [73] 16894.7 18552.0 19269.0 19421.1 17578.4 18636.3 18075.7 20437.6 18074.2 [82] 19562.0 19898.2 19226.5 17788.6 19219.8 21967.9 21130.5 19483.6 22403.1 [91] 21098.0 22485.5 23706.5 21896.5 23325.4 23764.4 20443.0 > y [1] 6.3 6.1 6.1 5.8 5.5 5.3 5.1 5.1 5.3 5.3 5.0 5.2 5.4 5.8 6.5 6.5 6.6 6.6 6.4 [20] 6.3 6.1 5.9 5.8 6.5 6.6 6.8 7.0 7.1 7.2 7.3 7.2 7.0 6.9 6.6 6.6 7.2 7.3 7.4 [39] 7.4 7.4 7.6 7.9 7.8 7.3 6.5 6.2 6.5 7.8 8.3 8.3 7.7 7.2 7.3 7.5 7.6 7.6 7.2 [58] 7.1 7.0 7.6 7.7 7.8 7.5 7.4 7.5 7.7 7.7 7.6 7.5 7.3 7.1 7.2 7.1 7.1 6.9 6.9 [77] 6.9 7.0 7.0 6.9 7.0 6.7 6.2 6.5 6.3 6.0 6.0 6.0 6.2 6.3 6.1 5.8 5.6 5.2 5.2 [96] 5.8 5.9 > postscript(file="/var/www/html/rcomp/tmp/12s731229870227.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 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -0.299 -0.313 -0.310 -0.291 -0.260 -0.195 -0.147 -0.154 -0.179 -0.182 -0.155 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.139 -0.121 -0.131 -0.139 -0.124 -0.096 -0.033 0.045 0.088 0.105 0.144 6 7 8 9 10 11 12 13 14 15 16 0.189 0.214 0.262 0.269 0.291 0.342 0.381 0.430 0.494 0.501 0.484 > 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/222lc1229870227.tab") > > system("convert tmp/12s731229870227.ps tmp/12s731229870227.png") > > > proc.time() user system elapsed 0.395 0.166 0.475