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(1.5421,1.5642,1.5827,1.5878,1.5703,1.5968,1.5978,1.5575,1.5749,1.6176,1.6387,1.6422,1.6891,1.7236,1.8072,1.7847,1.6813,1.6469,1.689,1.7169,1.8036,1.7955,1.7172,1.7348,1.7094,1.6963,1.6695,1.6537,1.6662,1.6793,1.7922,1.8045,1.7927,1.7831,1.7847,1.8076,1.8218,1.8112,1.795,1.7813,1.7866,1.7552,1.7184,1.7114,1.6967,1.6867,1.6337,1.6626,1.6374,1.626,1.637,1.6142,1.7033,1.7483,1.7135,1.7147,1.7396,1.7049,1.6867,1.7462,1.7147,1.667,1.6806,1.6738,1.6571,1.5875,1.6002,1.6144,1.6009,1.5937,1.603,1.5979,1.6152,1.6102,1.654,1.6662,1.6715,1.7104,1.6869,1.6788,1.6839,1.6733,1.6684,1.6814,1.6602,1.6708,1.6704,1.6336,1.6378,1.593,1.5809,1.6442,1.6445,1.5837,1.6373,1.6703,1.6694) > x <- c(1.0137,0.9834,0.9643,0.947,0.906,0.9492,0.9397,0.9041,0.8721,0.8552,0.8564,0.8973,0.9383,0.9217,0.9095,0.892,0.8742,0.8532,0.8607,0.9005,0.9111,0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718) > par7 = '0' > par6 = '1' > par5 = '-0.3' > par4 = '1' > par3 = '0' > par2 = '2' > par1 = '0.4' > #'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.0109211163 0.0016288191 -0.0251474587 0.0881215512 -0.0550279784 [6] -0.0275508063 0.0030189220 0.0159093361 0.0197715295 0.0429419192 [11] -0.0010906690 -0.0605077647 0.0044760760 -0.0057700519 -0.0005458185 [16] -0.0037516229 0.0311583153 0.0347308167 -0.0317103715 -0.0167565414 [21] -0.0132769670 0.0231810571 -0.0141691597 -0.0046200240 0.0206861730 [26] 0.0044984630 0.0224152837 0.0067454332 -0.0025590293 -0.0519243394 [31] 0.0175691894 -0.0027344073 0.0201041870 -0.0036065795 0.0260747689 [36] -0.0283744218 -0.0112530612 0.0006606382 0.0646225964 -0.0611303421 [41] -0.0341368195 0.0050313161 0.0294667479 0.0355570986 -0.0424093724 [46] 0.0514589221 -0.0236964607 -0.0258040184 -0.0365324264 0.0089856272 [51] 0.0266505442 0.0097278199 -0.0003409021 -0.0193389129 0.0117077554 [56] 0.0202321415 0.0193660819 -0.0080228175 -0.0596991762 0.0154523438 [61] 0.0248409001 -0.0382955657 0.0013724878 -0.0254063216 0.0350156023 [66] 0.0340882109 -0.0258556192 -0.0182744575 0.0008278332 0.0269616620 [71] 0.0158321490 -0.0369388531 0.0221332543 0.0149793199 0.0212695295 [76] -0.0539988046 0.0133422705 0.0080283293 -0.0182328273 -0.0028108666 [81] 0.0334074977 0.0049611904 -0.0464980220 0.0245911763 0.0078526165 [86] 0.0087598606 -0.0234266718 -0.0072786373 0.0324283169 -0.0325249973 [91] 0.0304185484 0.0043526794 0.0096579245 -0.0457107680 0.0208467638 > y [1] 0.0124688330 0.0102629066 0.0028018420 -0.0096634020 0.0145794020 [6] 0.0005439983 -0.0222805801 0.0097107895 0.0232506668 0.0111966681 [11] 0.0018391468 0.0241633347 0.0172247395 0.0399421631 -0.0105101399 [16] -0.0506145174 -0.0177438688 0.0216510335 0.0139654926 0.0415818431 [21] -0.0037737491 -0.0376595335 0.0086569571 -0.0125305349 -0.0065576040 [26] -0.0136229986 -0.0081654016 0.0064682913 0.0067114176 0.0551556026 [31] 0.0057354983 -0.0055013512 -0.0045105199 0.0007539427 0.0106954459 [36] 0.0065440313 -0.0048786727 -0.0075282429 -0.0064357418 0.0024973469 [41] -0.0149380672 -0.0179554940 -0.0034720702 -0.0073518109 -0.0050487229 [46] -0.0274234749 0.0150944997 -0.0131426830 -0.0060321910 0.0058214603 [51] -0.0121234910 0.0461656178 0.0221391886 -0.0170548359 0.0005955720 [56] 0.0122371848 -0.0171169502 -0.0091598972 0.0294823085 -0.0154426458 [61] -0.0241004325 0.0069619011 -0.0034717584 -0.0086046029 -0.0371140483 [66] 0.0069282807 0.0076624303 -0.0072826364 -0.0039167978 0.0050548856 [71] -0.0027672983 0.0093409244 -0.0026862774 0.0231708671 0.0063123087 [76] 0.0027235410 0.0196520672 -0.0118016612 -0.0041174397 0.0025954646 [81] -0.0054060074 -0.0025140728 0.0066490724 -0.0108778425 0.0054613502 [86] -0.0002052701 -0.0191629167 0.0022153120 -0.0240190336 -0.0066382912 [91] 0.0340188753 0.0001571552 -0.0326340363 0.0288519905 0.0171596174 [96] -0.0004621275 > postscript(file="/var/www/html/freestat/rcomp/tmp/1etl11228294579.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 0.087 -0.187 0.023 0.098 -0.146 -0.028 0.240 0.012 -0.062 -0.184 0.091 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.012 0.017 0.048 0.108 0.159 -0.262 0.013 -0.106 0.057 0.121 0.023 6 7 8 9 10 11 12 13 14 15 16 -0.129 0.024 0.161 -0.019 -0.195 -0.074 -0.030 0.085 0.159 0.031 0.036 > 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/27jdw1228294580.tab") > > system("convert tmp/1etl11228294579.ps tmp/1etl11228294579.png") > > > proc.time() user system elapsed 0.553 0.225 0.636