R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(25.64,27.97,27.62,23.31,29.07,29.58,28.63,29.92,32.68,31.54,32.43,26.54,25.85,27.6,25.71,25.38,28.57,27.64,25.36,25.9,26.29,21.74,19.2,19.32,19.82,20.36,24.31,25.97,25.61,24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42,75.73,55.48,43.8,45.29) > x <- c(3030.29,2803.47,2767.63,2882.6,2863.36,2897.06,3012.61,3142.95,3032.93,3045.78,3110.52,3013.24,2987.1,2995.55,2833.18,2848.96,2794.83,2845.26,2915.03,2892.63,2604.42,2641.65,2659.81,2638.53,2720.25,2745.88,2735.7,2811.7,2799.43,2555.28,2304.98,2214.95,2065.81,1940.49,2042,1995.37,1946.81,1765.9,1635.25,1833.42,1910.43,1959.67,1969.6,2061.41,2093.48,2120.88,2174.56,2196.72,2350.44,2440.25,2408.64,2472.81,2407.6,2454.62,2448.05,2497.84,2645.64,2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41) > par7 = '0' > par6 = '1' > par5 = '0.0' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '0.0' > #'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#output/ > #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.077800389 -0.012866577 0.040701306 -0.006696904 0.011700669 [6] 0.039110383 0.042355037 -0.035632700 0.004227877 0.021032889 [11] -0.031774003 -0.008712895 0.002824837 -0.055728098 0.005554260 [16] -0.019182734 0.017883170 0.024225660 -0.007713988 -0.104956121 [21] 0.014193720 0.006850970 -0.008032748 0.030501844 0.009377819 [26] -0.003714262 0.027401938 -0.004373458 -0.091254018 -0.103089807 [31] -0.039842170 -0.069707429 -0.062581883 0.050989201 -0.023100223 [36] -0.024637361 -0.097531660 -0.076864778 0.114387377 0.041145272 [41] 0.025447744 0.005054385 0.045559738 0.015437538 0.013003344 [46] 0.024995248 0.010138994 0.067637206 0.037497948 -0.013038220 [51] 0.026292883 -0.026724755 0.019341562 -0.002680174 0.020134569 [56] 0.057486644 0.041143075 0.033006744 0.025013824 0.020467268 [61] 0.032573978 0.008288662 0.004205271 -0.018785228 0.011707397 [66] 0.020572702 0.029748955 0.006075771 0.005571859 0.020624489 [71] 0.037968096 0.048286205 0.039049946 0.027139094 -0.005746502 [76] -0.024544633 -0.062680767 0.036168651 0.042487233 0.027536190 [81] 0.041546953 0.014686764 0.021469171 0.035040449 0.013129272 [86] -0.032884735 0.052377517 0.022758817 -0.016217801 -0.012752453 [91] -0.082260891 0.022114065 0.031781064 -0.077329884 0.002797422 [96] -0.068406059 -0.032653880 -0.012597220 0.048660559 -0.014770438 [101] -0.081269214 -0.144590424 0.004747008 -0.028187849 -0.298513537 [106] -0.087119755 -0.078249369 0.022600372 > y [1] 0.0869788752 -0.0125923592 -0.1696576949 0.2208242615 0.0173917427 [6] -0.0326433382 0.0440720340 0.0882361169 -0.0355066885 0.0278273388 [11] -0.2004308914 -0.0263424279 0.0655051718 -0.0709357514 -0.0129185590 [16] 0.1183957540 -0.0330932173 -0.0860908693 0.0210698391 0.0149456700 [21] -0.1900347570 -0.1242436027 0.0062305498 0.0255507001 0.0268806628 [26] 0.1773155966 0.0660542373 -0.0139591255 -0.0373949697 0.0366137196 [31] 0.0193504490 0.0837801497 -0.0369814175 -0.1113117010 0.1156912701 [36] 0.0961044085 0.0671607829 -0.0791409595 -0.1831923744 0.0242315729 [41] 0.0682600023 0.0345855796 0.0463590447 -0.0931151599 0.0760673553 [46] -0.0110651198 0.0284509336 0.0368261882 -0.0058804482 0.0680750192 [51] 0.0157914001 0.1121766425 -0.0437664455 0.0603266530 0.1028673441 [56] 0.0259509727 0.1348695746 -0.0967153180 -0.1035936648 0.0950389075 [61] 0.0359719068 0.1520609453 -0.0022505636 -0.0277954311 0.0653827593 [66] 0.0443888626 0.1010961169 -0.0029750276 -0.0752062699 -0.0525843352 [71] 0.0229004195 0.1009621422 -0.0289088246 0.0208474516 0.0788578228 [76] 0.0549314322 -0.0321652782 0.0646729207 -0.0010757027 -0.1458885691 [81] -0.0677816324 -0.0098770369 0.0501991563 -0.1271063631 0.0582277708 [86] 0.0595552648 0.0885041253 0.0004433607 0.0379810835 0.0681769863 [91] -0.0520908486 0.0666010623 0.0677173945 0.1251127483 -0.0218349286 [96] 0.0178312442 0.0199663138 0.0884363010 0.0646054028 0.1233912353 [101] 0.0673308704 0.0232412696 -0.1570633927 -0.1349231470 -0.2920959272 [106] -0.3111517877 -0.2363887781 0.0334524402 > postscript(file="/var/www/rcomp/tmp/1068e1291886543.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 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 0.003 0.068 -0.008 0.085 0.085 -0.019 0.079 0.072 0.197 0.033 0.059 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.056 0.082 0.121 0.060 0.296 0.411 0.169 0.093 0.101 -0.011 -0.129 5 6 7 8 9 10 11 12 13 14 15 -0.068 -0.049 -0.087 0.057 0.053 -0.010 0.020 -0.042 -0.021 0.074 -0.030 16 17 0.036 0.083 > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/2p7nq1291886543.tab") > > try(system("convert tmp/1068e1291886543.ps tmp/1068e1291886543.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.390 0.210 0.577