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(10772.8,9987.7,8638.7,11063.7,11855.7,10684.5,11337.4,10478,11123.9,12909.3,11339.9,10462.2,12733.5,10519.2,10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16213.3,15544.5,14750.6,17292.7,17568.5,17930.8,18644.7,16694.8,17242.8) > x <- c(12192.5,11268.8,9097.4,12639.8,13040.1,11687.3,11191.7,11391.9,11793.1,13933.2,12778.1,11810.3,13698.4,11956.6,10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17157.3,16159.1,13405.7,17224.7,17338.4,17370.6,18817.8,16593.2,17979.5) > par7 = '1' > par6 = '0' > par5 = '-0.3' > par4 = '1' > par3 = '1' > par2 = '0' > par1 = '-0.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] -0.0308699565 -0.0851103006 0.1300170377 0.0121061641 -0.0426944476 [6] -0.0170200967 0.0069732899 0.0135773866 0.0647608632 -0.0334734894 [11] -0.0307166980 0.0576393544 -0.0528219416 -0.0427862762 0.1023165655 [16] 0.0011281633 -0.0047802150 -0.0240760814 -0.0141550463 0.0129631481 [21] 0.0547254490 -0.0304443461 -0.0219340988 0.0296263725 -0.0671955626 [26] -0.0074765544 0.0858916790 -0.0233123467 0.0303410085 -0.0229132190 [31] -0.0099428959 0.0016095826 0.0667051625 -0.0760195574 0.0407688063 [36] 0.0188235196 -0.0627027069 -0.0160636655 0.0673881913 0.0105380788 [41] -0.0006023816 -0.0626941873 0.0446605144 -0.0142583241 0.0509117635 [46] -0.0452001954 0.0194052715 0.0200794078 -0.0405826184 -0.0313598609 [51] 0.0534109938 0.0459129379 -0.0226765426 -0.0715493488 0.0957044185 [56] 0.0024798266 0.0006990411 0.0300263692 -0.0473144685 0.0302449327 > y [1] -0.0047224192 -0.0093609793 0.0157209056 0.0041885001 -0.0063344660 [6] 0.0036363422 -0.0048470591 0.0036885724 0.0088964531 -0.0077245693 [11] -0.0049543682 0.0118759423 -0.0115380093 -0.0006201805 0.0109594197 [16] -0.0004384193 -0.0005668472 0.0030549941 -0.0069367010 0.0032744073 [21] 0.0079677540 -0.0055112869 -0.0029885296 0.0054421852 -0.0115442335 [26] 0.0023160546 0.0111401611 -0.0050197005 0.0064178894 0.0011861385 [31] -0.0034732623 0.0005582544 0.0100060748 -0.0126092055 0.0047333883 [36] 0.0006227844 -0.0088957556 0.0017542940 0.0067224288 0.0003224431 [41] 0.0006649897 -0.0051536999 0.0024602089 -0.0003900512 0.0068545533 [46] -0.0082073614 0.0044862993 0.0019923883 -0.0034544806 -0.0045971024 [51] 0.0058744518 0.0068093288 -0.0023137995 -0.0029205817 0.0087184504 [56] 0.0008450877 0.0010842867 0.0020554716 -0.0058785825 0.0017389637 > postscript(file="/var/www/html/rcomp/tmp/1qjzs1228648556.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.058 -0.268 0.516 -0.022 -0.399 0.266 0.037 -0.318 0.290 0.018 -0.180 -3 -2 -1 0 1 2 3 4 5 6 7 0.213 -0.237 -0.367 0.908 -0.221 -0.437 0.290 -0.016 -0.168 0.300 -0.161 8 9 10 11 12 13 14 -0.063 0.187 -0.245 -0.151 0.527 -0.139 -0.222 > 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/23deo1228648556.tab") > > system("convert tmp/1qjzs1228648556.ps tmp/1qjzs1228648556.png") > > > proc.time() user system elapsed 0.397 0.164 0.816