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 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '0' > 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#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] 3029.29 2802.47 2766.63 2881.60 2862.36 2896.06 3011.61 3141.95 3031.93 [10] 3044.78 3109.52 3012.24 2986.10 2994.55 2832.18 2847.96 2793.83 2844.26 [19] 2914.03 2891.63 2603.42 2640.65 2658.81 2637.53 2719.25 2744.88 2734.70 [28] 2810.70 2798.43 2554.28 2303.98 2213.95 2064.81 1939.49 2041.00 1994.37 [37] 1945.81 1764.90 1634.25 1832.42 1909.43 1958.67 1968.60 2060.41 2092.48 [46] 2119.88 2173.56 2195.72 2349.44 2439.25 2407.64 2471.81 2406.60 2453.62 [55] 2447.05 2496.84 2644.64 2755.76 2848.27 2920.44 2980.85 3079.58 3105.22 [64] 3118.31 3060.26 3096.31 3160.69 3256.16 3276.01 3294.32 3362.99 3493.17 [73] 3666.03 3812.06 3916.96 3894.51 3800.06 3569.12 3700.61 3861.27 3969.10 [82] 4137.52 4198.75 4289.89 4442.91 4501.64 4355.98 4590.27 4695.96 4620.40 [91] 4561.84 4201.52 4295.49 4434.23 4104.18 4115.68 3843.49 3719.98 3673.40 [100] 3856.62 3800.06 3503.37 3031.60 3046.03 2961.34 2196.82 2013.45 1861.83 [109] 1904.41 > y [1] 24.64 26.97 26.62 22.31 28.07 28.58 27.63 28.92 31.68 30.54 [11] 31.43 25.54 24.85 26.60 24.71 24.38 27.57 26.64 24.36 24.90 [21] 25.29 20.74 18.20 18.32 18.82 19.36 23.31 24.97 24.61 23.67 [31] 24.59 25.09 27.37 26.34 23.46 26.46 29.23 31.33 28.87 23.87 [41] 24.48 26.28 27.24 28.58 25.95 28.08 27.76 28.59 29.70 29.52 [51] 31.67 32.19 36.13 34.54 36.75 40.84 41.94 48.14 43.61 39.22 [61] 43.23 44.85 52.38 52.26 50.80 54.30 56.81 62.96 62.77 58.15 [71] 55.12 56.42 62.52 60.71 62.01 67.18 71.03 68.75 73.41 73.33 [81] 63.24 59.03 58.44 61.50 54.04 57.34 60.92 66.65 66.68 69.30 [91] 74.26 70.44 75.36 80.71 91.60 89.60 91.23 93.09 101.79 108.65 [101] 123.05 131.69 134.81 115.07 100.42 74.73 54.48 42.80 44.29 > postscript(file="/var/www/rcomp/tmp/1vq2j1291886745.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 -6 -5 0.511 0.553 0.591 0.625 0.653 0.675 0.694 0.708 0.720 0.722 0.723 0.722 0.719 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 0.711 0.700 0.683 0.657 0.616 0.565 0.507 0.451 0.409 0.388 0.380 0.385 0.396 9 10 11 12 13 14 15 16 17 0.404 0.406 0.405 0.401 0.397 0.395 0.391 0.385 0.376 > 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/2l9ze1291886745.tab") > > try(system("convert tmp/1vq2j1291886745.ps tmp/1vq2j1291886745.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.420 0.180 0.575