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(90.8,96.4,90,92.1,97.2,95.1,88.5,91,90.5,75,66.3,66,68.4,70.6,83.9,90.1,90.6,87.1,90.8,94.1,99.8,96.8,87,96.3,107.1,115.2,106.1,89.5,91.3,97.6,100.7,104.6,94.7,101.8,102.5,105.3,110.3,109.8,117.3,118.8,131.3,125.9,133.1,147,145.8,164.4,149.8,137.7,151.7,156.8,180,180.4,170.4,191.6,199.5,218.2,217.5,205,194,199.3,219.3,211.1,215.2,240.2,242.2,240.7,255.4,253,218.2,203.7,205.6,215.6) > x <- c(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) > par7 = '0' > par6 = '1' > par5 = '0.2' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '1.6' > #'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.0158926556 -0.0115713100 -0.0164361075 -0.0165205373 -0.0192324441 [6] 0.0068365063 0.0368757964 0.0099890609 -0.0049090580 -0.0164898046 [11] 0.0038240206 -0.0084731461 -0.0122898444 0.0053457236 0.0092667154 [16] 0.0293156767 0.0369100896 0.0362179178 -0.0142699780 0.0029625840 [21] 0.0002965578 0.0201931530 0.0169996355 0.0449510064 0.0157233637 [26] 0.0035587030 0.0043003194 0.0786243413 0.0088647102 -0.0316741631 [31] -0.0250134119 0.0088747185 0.0509956459 0.0010986129 0.0651299847 [36] 0.0372937368 0.0037961696 -0.0438038630 -0.0310924047 0.0024538304 [41] 0.0146672641 0.0144234152 -0.0101509414 0.0047315241 0.0308781560 [46] 0.0579352510 0.0492568016 -0.0342366029 -0.0123277717 0.0219964524 [51] -0.0308822812 -0.0283165117 -0.0602726102 -0.0143516634 0.0286810357 [56] -0.0040709347 -0.0270676115 -0.0254198509 0.0077390993 0.0275269645 [61] -0.0184262367 0.0091383121 0.0282046754 0.0571040157 -0.0138569672 [66] 0.0039181689 0.0146912349 -0.0097268727 -0.0133691263 0.0312310197 [71] 0.0389440997 > y [1] 0.148340813 -0.170125799 0.056860307 0.133890375 -0.054434256 [6] -0.177584294 0.068475098 -0.013573551 -0.453978058 -0.288818679 [11] -0.010488126 0.082860789 0.073936851 0.411441049 0.174144071 [16] 0.013621605 -0.096645701 0.102077507 0.088271725 0.146800221 [21] -0.076401646 -0.263554437 0.250637222 0.267831218 0.187023382 [26] -0.210890310 -0.425196768 0.049017154 0.165689492 0.078406667 [31] 0.095943391 -0.249523126 0.180937445 0.017286560 0.068215728 [36] 0.118285379 -0.011633182 0.170225761 0.032994585 0.262726387 [41] -0.110929470 0.147094778 0.266836512 -0.022220311 0.329153751 [46] -0.255644918 -0.227448904 0.261816715 0.090577124 0.384511961 [51] 0.006272726 -0.160273254 0.331551491 0.116054870 0.260725255 [56] -0.009431315 -0.172648936 -0.159044117 0.077506770 0.278389449 [61] -0.111577822 0.056214096 0.325359948 0.024838762 -0.018613605 [66] 0.178557254 -0.028580718 -0.440969766 -0.200515317 0.026912029 [71] 0.138449717 > postscript(file="/var/www/html/rcomp/tmp/1upju1228750491.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.095 0.009 0.013 -0.057 -0.190 -0.102 0.001 0.220 0.220 -0.012 -0.022 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.055 0.087 -0.191 -0.013 0.076 -0.060 -0.019 -0.078 0.219 0.031 -0.162 7 8 9 10 11 12 13 14 15 -0.013 -0.163 -0.086 0.122 0.109 0.080 -0.109 -0.093 -0.173 > 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/2at0d1228750491.tab") > > system("convert tmp/1upju1228750491.ps tmp/1upju1228750491.png") > > > proc.time() user system elapsed 0.397 0.173 0.491