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. Natural language support but running in an English locale 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(206010 + ,198112 + ,194519 + ,185705 + ,180173 + ,176142 + ,203401 + ,221902 + ,197378 + ,185001 + ,176356 + ,180449 + ,180144 + ,173666 + ,165688 + ,161570 + ,156145 + ,153730 + ,182698 + ,200765 + ,176512 + ,166618 + ,158644 + ,159585 + ,163095 + ,159044 + ,155511 + ,153745 + ,150569 + ,150605 + ,179612 + ,194690 + ,189917 + ,184128 + ,175335 + ,179566 + ,181140 + ,177876 + ,175041 + ,169292 + ,166070 + ,166972 + ,206348 + ,215706 + ,202108 + ,195411 + ,193111 + ,195198 + ,198770 + ,194163 + ,190420 + ,189733 + ,186029 + ,191531 + ,232571 + ,243477 + ,227247 + ,217859 + ,208679 + ,213188 + ,216234 + ,213586 + ,209465 + ,204045 + ,200237 + ,203666 + ,241476 + ,260307 + ,243324 + ,244460 + ,233575 + ,237217 + ,235243 + ,230354 + ,227184 + ,221678 + ,217142 + ,219452 + ,256446 + ,265845 + ,248624 + ,241114 + ,229245 + ,231805 + ,219277 + ,219313 + ,212610 + ,214771 + ,211142 + ,211457 + ,240048 + ,240636 + ,230580 + ,208795 + ,197922 + ,194596 + ,194581 + ,185686 + ,178106 + ,172608 + ,167302 + ,168053 + ,202300 + ,202388 + ,182516 + ,173476 + ,166444 + ,171297 + ,169701 + ,164182 + ,161914 + ,159612 + ,151001 + ,158114 + ,186530 + ,187069 + ,174330 + ,169362 + ,166827 + ,178037 + ,186413 + ,189226 + ,191563 + ,188906 + ,186005 + ,195309 + ,223532 + ,226899 + ,214126 + ,206903 + ,204442 + ,220375 + ,214320 + ,212588 + ,205816 + ,202196 + ,195722 + ,198563 + ,229139 + ,229527 + ,211868 + ,203555 + ,195770) > x <- c(20503,22885,26217,26583,27751,28158,27373,28367,26851,26733,26849,26733,27951,29781,32914,33488,35652,36488,35387,35676,34844,32447,31068,29010,29812,30951,32974,32936,34012,32946,31948,30599,27691,25073,23406,22248,22896,25317,26558,26471,27543,26198,24725,25005,23462,20780,19815,19761,21454,23899,24939,23580,24562,24696,23785,23812,21917,19713,19282,18788,21453,24482,27474,27264,27349,30632,29429,30084,26290,24379,23335,21346,21106,24514,28353,30805,31348,34556,33855,34787,32529,29998,29257,28155,30466,35704,39327,39351,42234,43630,43722,43121,37985,37135,34646,33026,35087,38846,42013,43908,42868,44423,44167,43636,44382,42142,43452,36912,42413,45344,44873,47510,49554,47369,45998,48140,48441,44928,40454,38661,37246,36843,36424,37594,38144,38737,34560,36080,33508,35462,33374,32110,35533,35532,37903,36763,40399,44164,44496,43110,43880,43930,44327) > par7 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > 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] -552 -199 208 996 429 -316 -705 684 -2279 -1495 -1942 -416 [13] -691 -1110 -612 -1088 -1902 103 -1638 -2076 -221 -288 900 -154 [25] 1282 -782 -49 -4 -279 -475 1629 1365 -64 702 1104 1045 [37] 24 -201 -1272 -90 1479 562 -253 -352 478 534 -440 972 [49] 584 1952 1149 -897 3149 -292 628 -1899 293 -613 -1495 -2905 [61] 379 847 2662 458 -75 502 277 1536 -620 303 887 2551 [73] 1830 -216 -2428 2340 -1812 793 -1533 -2878 1681 -1748 -518 -250 [85] -1479 -456 1871 -3923 159 -348 70 5882 -1390 3799 -4920 3440 [97] -828 -3638 742 3084 -3740 -1115 2673 -445 -1273 -5784 4747 -6916 [109] -3334 52 -1467 -1494 2778 -2806 -622 -2873 5467 2386 529 4838 [121] 402 2790 -2310 3086 3172 4509 -2906 3342 -1904 2485 > y [1] 1420 -4385 4696 107 1616 1709 -434 271 2483 671 [11] -3152 3815 2427 4445 2352 2249 2451 39 -2989 19480 [21] 4105 -819 3290 -1936 787 698 -3983 -46 866 10369 [31] -5720 -8825 -908 6493 -2144 1998 -1343 -908 5062 -482 [41] 4600 1664 1548 -2632 -2691 -6880 2422 -526 1959 -378 [51] -4733 -104 -2073 -3230 7925 -753 10524 -1705 -867 -5020 [61] -2241 951 -86 -728 -1119 -816 -9432 -238 -8646 -984 [71] -1082 -10554 4925 -3533 7667 907 -1995 -8403 -8811 7165 [81] -14275 996 -5886 12513 -8931 -877 -7659 -1677 436 5656 [91] -500 -9816 12745 3841 8179 -1581 3376 5312 3196 -3305 [101] 6362 -5831 451 7133 4072 4497 6357 9972 8332 4605 [111] -355 5710 2191 -193 2828 -34 -2255 74 4723 -14431 [121] -4545 -9109 -963 -3573 -6463 2353 -2979 -4886 -1090 -5324 > postscript(file="/var/www/html/freestat/rcomp/tmp/1tq2x1293651772.ps",horizontal=F,onefile=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 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -0.018 0.009 0.102 -0.056 0.065 -0.075 0.228 -0.094 -0.123 -0.043 -0.014 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 -0.053 -0.045 -0.098 -0.093 -0.165 -0.079 -0.012 -0.363 -0.007 -0.170 -0.011 4 5 6 7 8 9 10 11 12 13 14 -0.255 -0.114 0.027 -0.026 0.008 -0.006 0.150 -0.119 0.210 -0.090 0.187 15 16 17 18 -0.139 0.230 0.075 -0.065 > 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/2b0yu1293651772.tab") > > try(system("convert tmp/1tq2x1293651772.ps tmp/1tq2x1293651772.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.624 0.215 0.726