R version 2.7.0 (2008-04-22) 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(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) > x <- c(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) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > 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/ > #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] 2658.81 2637.53 2719.25 2744.88 2734.70 2810.70 2798.43 2554.28 2303.98 [10] 2213.95 2064.81 1939.49 2041.00 1994.37 1945.81 1764.90 1634.25 1832.42 [19] 1909.43 1958.67 1968.60 2060.41 2092.48 2119.88 2173.56 2195.72 2349.44 [28] 2439.25 2407.64 2471.81 2406.60 2453.62 2447.05 2496.84 2644.64 2755.76 [37] 2848.27 2920.44 2980.85 3079.58 3105.22 3118.31 3060.26 3096.31 3160.69 [46] 3256.16 3276.01 3294.32 3362.99 3493.17 3666.03 3812.06 3916.96 3894.51 [55] 3800.06 3569.12 3700.61 3861.27 3969.10 4137.52 4198.75 4289.89 4442.91 [64] 4501.64 4355.98 4590.27 4695.96 4620.40 4561.84 4201.52 4295.49 4434.23 [73] 4104.18 4115.68 3843.49 3719.98 3673.40 3856.62 3800.06 3503.37 3031.60 [82] 3046.03 > y [1] 18.20 18.32 18.82 19.36 23.31 24.97 24.61 23.67 24.59 25.09 [11] 27.37 26.34 23.46 26.46 29.23 31.33 28.87 23.87 24.48 26.28 [21] 27.24 28.58 25.95 28.08 27.76 28.59 29.70 29.52 31.67 32.19 [31] 36.13 34.54 36.75 40.84 41.94 48.14 43.61 39.22 43.23 44.85 [41] 52.38 52.26 50.80 54.30 56.81 62.96 62.77 58.15 55.12 56.42 [51] 62.52 60.71 62.01 67.18 71.03 68.75 73.41 73.33 63.24 59.03 [61] 58.44 61.50 54.04 57.34 60.92 66.65 66.68 69.30 74.26 70.44 [71] 75.36 80.71 91.60 89.60 91.23 93.09 101.79 108.65 123.05 131.69 [81] 134.81 115.07 > postscript(file="/var/www/html/rcomp/tmp/1bh3f1228239855.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 -5 -4 0.549 0.595 0.637 0.673 0.694 0.713 0.736 0.751 0.763 0.767 0.762 0.754 0.751 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 0.750 0.741 0.715 0.684 0.650 0.622 0.604 0.589 0.580 0.571 0.559 0.542 0.525 10 11 12 13 14 15 16 0.507 0.486 0.461 0.437 0.412 0.384 0.356 > 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/2ify81228239855.tab") > > system("convert tmp/1bh3f1228239855.ps tmp/1bh3f1228239855.png") > > > proc.time() user system elapsed 1.180 0.284 1.236