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 = '4' > 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] -1790 1531 -2569 -1226 3146 783 -1523 557 -1641 -2771 4994 -70 [13] -1390 3290 -4858 280 4356 -1417 -681 1728 -4556 -521 4915 -2402 [25] 1508 1329 -4670 544 2990 -568 84 785 -4869 169 4690 -2833 [37] 3672 66 -4584 1691 1978 -2853 2794 119 -5541 2493 1030 112 [49] 2249 -1208 -1719 -817 2748 -138 -353 1371 -3981 851 851 1404 [61] -353 -958 1974 -2180 1306 > 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/freestat/rcomp/tmp/1scos1228502741.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.042 0.067 -0.212 0.192 0.246 -0.209 0.018 0.030 -0.209 0.177 0.285 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.257 0.015 0.065 -0.285 0.289 0.188 -0.197 0.034 -0.038 -0.196 0.250 7 8 9 10 11 12 13 14 15 0.179 -0.224 0.071 -0.093 -0.174 0.248 0.086 -0.105 0.050 > 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/2m71r1228502741.tab") > > system("convert tmp/1scos1228502741.ps tmp/1scos1228502741.png") > > > proc.time() user system elapsed 0.551 0.225 0.610