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(13698.3,12477.6,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,22058.6,21230.8,19504.4,23913.1,23165.7,23574.3,25002,22603.9,23408.6) > x <- c(14211,13646.8,12224.6,15916.4,16535.9,15796,14418.6,15044.5,14944.2,16754.8,14254,15454.9,15644.8,14568.3,12520.2,14803,15873.2,14755.3,12875.1,14291.1,14205.3,15859.4,15258.9,15498.6,15106.5,15023.6,12083,15761.3,16943,15070.3,13659.6,14768.9,14725.1,15998.1,15370.6,14956.9,15469.7,15101.8,11703.7,16283.6,16726.5,14968.9,14861,14583.3,15305.8,17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22238.5,20682.2,17818.6,21872.1,22117,21865.9,23451.3,20953.7,22497.3) > 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] 14210.0 13645.8 12223.6 15915.4 16534.9 15795.0 14417.6 15043.5 14943.2 [10] 16753.8 14253.0 15453.9 15643.8 14567.3 12519.2 14802.0 15872.2 14754.3 [19] 12874.1 14290.1 14204.3 15858.4 15257.9 15497.6 15105.5 15022.6 12082.0 [28] 15760.3 16942.0 15069.3 13658.6 14767.9 14724.1 15997.1 15369.6 14955.9 [37] 15468.7 15100.8 11702.7 16282.6 16725.5 14967.9 14860.0 14582.3 15304.8 [46] 17902.9 16378.4 15419.3 17869.5 15911.8 13865.5 17822.2 17871.0 17419.4 [55] 16703.4 15990.2 16582.6 19122.5 17837.7 17208.4 18585.5 16257.1 15140.6 [64] 19201.1 17745.5 19089.1 18039.3 17514.5 17750.8 21071.4 17169.0 19438.5 [73] 19794.4 17573.9 16164.4 19463.6 19931.1 19960.2 17342.4 18923.2 18573.1 [82] 21349.6 18593.6 19822.1 20843.4 19639.2 17734.4 19812.6 22237.5 20681.2 [91] 17817.6 21871.1 22116.0 21864.9 23450.3 20952.7 22496.3 > y [1] 13697.3 12476.6 13138.7 14531.2 15166.0 16070.1 14826.5 15081.0 14771.7 [10] 16082.0 14271.5 15222.3 14896.3 13061.6 12602.8 13628.8 14420.1 13977.3 [19] 12926.9 13428.9 13469.1 14784.8 14291.0 14307.8 14012.0 13239.9 12152.4 [28] 14288.7 15668.2 14168.5 14568.8 14468.1 14263.9 15319.9 14432.5 13690.5 [37] 14193.1 13518.2 11856.9 14615.0 15642.4 14076.2 14886.5 14158.9 14642.0 [46] 17191.5 15385.1 14286.1 17525.6 14496.0 14397.3 16628.6 16669.7 16613.8 [55] 16868.2 15662.9 16358.9 18446.7 16888.0 16504.0 18319.9 15051.1 15698.8 [64] 18134.3 16767.7 18882.0 19020.0 18100.9 17775.1 21488.9 17064.3 18689.0 [73] 18952.1 16397.9 16894.7 18552.0 19269.0 19421.1 17578.4 18636.3 18075.7 [82] 20437.6 18074.2 19562.0 19898.2 19226.5 17788.6 19219.8 22057.6 21229.8 [91] 19503.4 23912.1 23164.7 23573.3 25001.0 22602.9 23407.6 > postscript(file="/var/www/html/freestat/rcomp/tmp/1o7bs1228153937.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 -5 -4 0.389 0.423 0.425 0.475 0.619 0.541 0.464 0.540 0.597 0.575 0.635 0.621 0.641 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 0.687 0.696 0.750 0.962 0.767 0.667 0.686 0.644 0.588 0.591 0.520 0.489 0.456 10 11 12 13 14 15 16 0.411 0.445 0.537 0.417 0.343 0.374 0.349 > 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/2qfpp1228153937.tab") > > system("convert tmp/1o7bs1228153937.ps tmp/1o7bs1228153937.png") > > > proc.time() user system elapsed 0.535 0.214 0.638