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 = '1' > par4 = '12' > par3 = '0' > 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] -226.82 -35.84 114.97 -19.24 33.70 115.55 130.34 -110.02 12.85 [10] 64.74 -97.28 -26.14 8.45 -162.37 15.78 -54.13 50.43 69.77 [19] -22.40 -288.21 37.23 18.16 -21.28 81.72 25.63 -10.18 76.00 [28] -12.27 -244.15 -250.30 -90.03 -149.14 -125.32 101.51 -46.63 -48.56 [37] -180.91 -130.65 198.17 77.01 49.24 9.93 91.81 32.07 27.40 [46] 53.68 22.16 153.72 89.81 -31.61 64.17 -65.21 47.02 -6.57 [55] 49.79 147.80 111.12 92.51 72.17 60.41 98.73 25.64 13.09 [64] -58.05 36.05 64.38 95.47 19.85 18.31 68.67 130.18 172.86 [73] 146.03 104.90 -22.45 -94.45 -230.94 131.49 160.66 107.83 168.42 [82] 61.23 91.14 153.02 58.73 -145.66 234.29 105.69 -75.56 -58.56 [91] -360.32 93.97 138.74 -330.05 11.50 -272.19 -123.51 -46.58 183.22 [100] -56.56 -296.69 -471.77 14.43 -84.69 -764.52 -183.37 -151.62 42.58 > y [1] 2.33 -0.35 -4.31 5.76 0.51 -0.95 1.29 2.76 -1.14 0.89 [11] -5.89 -0.69 1.75 -1.89 -0.33 3.19 -0.93 -2.28 0.54 0.39 [21] -4.55 -2.54 0.12 0.50 0.54 3.95 1.66 -0.36 -0.94 0.92 [31] 0.50 2.28 -1.03 -2.88 3.00 2.77 2.10 -2.46 -5.00 0.61 [41] 1.80 0.96 1.34 -2.63 2.13 -0.32 0.83 1.11 -0.18 2.15 [51] 0.52 3.94 -1.59 2.21 4.09 1.10 6.20 -4.53 -4.39 4.01 [61] 1.62 7.53 -0.12 -1.46 3.50 2.51 6.15 -0.19 -4.62 -3.03 [71] 1.30 6.10 -1.81 1.30 5.17 3.85 -2.28 4.66 -0.08 -10.09 [81] -4.21 -0.59 3.06 -7.46 3.30 3.58 5.73 0.03 2.62 4.96 [91] -3.82 4.92 5.35 10.89 -2.00 1.63 1.86 8.70 6.86 14.40 [101] 8.64 3.12 -19.74 -14.65 -25.69 -20.25 -11.68 1.49 > postscript(file="/var/www/rcomp/tmp/1wg331291837820.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.026 0.091 0.107 0.169 0.133 0.091 0.107 0.077 0.216 0.044 0.075 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.036 0.131 0.124 0.128 0.256 0.363 0.212 0.102 0.094 -0.066 -0.207 5 6 7 8 9 10 11 12 13 14 15 -0.114 -0.047 -0.112 -0.083 -0.005 0.018 -0.037 -0.047 -0.055 0.056 -0.091 16 17 0.008 0.078 > 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/2lh0f1291837820.tab") > > try(system("convert tmp/1wg331291837820.ps tmp/1wg331291837820.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.430 0.230 0.653