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(12055,12113,9617,12646,13581,12162,10970,11880,11888,12927,12300,12093,12381,12197,9455,13168,13428,11981,11885,11692,12234,14341,13131,12421,14286,12865,11160,14316,14389,14014,13419,12770,13316,15333,14243,13824,14963,13203,12199,15509,14200,15170,14058,13786,14148,16542,13588,15582,15803,14131,12923,15612,16034,16037,14038,15331,15038,17402,14993,16044,16930,15921,14417,15961,17852,16484,14216,17430,17840,17629) > x <- c(15107,15024,12083,15761,16943,15070,13660,14769,14725,15998,15371,14957,15470,15102,11704,16284,16727,14969,14861,14583,15306,17904,16379,15420,17871,15913,13867,17823,17872,17422,16705,15991,16584,19124,17839,17209,18587,16258,15142,19202,17747,19090,18040,17516,17752,21073,17170,19440,19795,17575,16165,19465,19932,19961,17343,18924,18574,21351,18595,19823,20844,19640,17735,19814,22239,20682,17819,21872,22117,21866) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '2' > 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] -2858 6619 -2496 -3055 463 2519 -1153 1317 -1900 213 927 -881 [13] -3030 7978 -4137 -2201 1650 -170 1001 1875 -4123 566 3410 -4409 [25] -88 6002 -3907 -499 -267 3 1307 1947 -3825 655 2008 -3707 [37] 1213 5176 -5515 2798 -2393 526 760 3085 -7224 6173 -1915 -2575 [49] 810 4710 -2833 -438 -2647 4199 -1931 3127 -5533 3984 -207 -2225 [61] -701 3984 346 -3982 -1306 6916 -3808 -496 > y [1] 12054 12112 9616 12645 13580 12161 10969 11879 11887 12926 12299 12092 [13] 12380 12196 9454 13167 13427 11980 11884 11691 12233 14340 13130 12420 [25] 14285 12864 11159 14315 14388 14013 13418 12769 13315 15332 14242 13823 [37] 14962 13202 12198 15508 14199 15169 14057 13785 14147 16541 13587 15581 [49] 15802 14130 12922 15611 16033 16036 14037 15330 15037 17401 14992 16043 [61] 16929 15920 14416 15960 17851 16483 14215 17429 17839 17628 > postscript(file="/var/www/html/rcomp/tmp/12c491228504060.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 0.055 0.171 -0.374 0.112 0.129 -0.013 -0.093 0.116 -0.154 0.121 -0.063 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.073 0.143 0.230 -0.539 0.184 0.159 -0.041 -0.086 0.099 -0.146 0.132 7 8 9 10 11 12 13 14 15 -0.109 -0.021 0.156 0.081 -0.369 0.150 0.062 0.016 -0.040 > 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/2zjis1228504060.tab") > > system("convert tmp/12c491228504060.ps tmp/12c491228504060.png") > > > proc.time() user system elapsed 0.384 0.162 0.452