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 = '1' > 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#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] 235.27 -126.53 -99.19 -34.89 16.73 -45.78 -152.74 -178.19 24.38 [10] -46.58 76.00 107.86 17.18 152.19 60.22 41.86 -294.58 -320.07 [19] -67.63 139.07 -162.55 83.35 -25.35 -130.28 -206.54 -120.47 122.17 [28] 89.28 293.39 260.23 181.84 181.21 152.72 -47.83 68.79 202.28 [37] 270.72 99.04 -134.00 -142.22 -2.22 -16.50 -42.02 115.73 83.72 [46] 38.83 50.01 -93.31 8.92 57.25 -51.08 7.16 -10.97 70.95 [55] 45.68 -127.95 -92.81 -23.84 58.01 112.45 47.30 79.26 -35.54 [64] -36.40 -266.99 67.11 65.19 87.98 150.11 -7.44 -39.04 -19.84 [73] -87.30 -250.56 256.74 200.14 155.38 -190.05 -520.98 -13.86 -29.68 [82] -391.28 -79.64 -425.21 -182.24 99.08 -51.07 -162.25 -221.13 -413.21 [91] 374.75 -178.66 -903.26 146.68 -163.12 314.77 > 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/1ydnb1291887821.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 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 0.032 -0.034 -0.060 0.003 -0.012 -0.097 -0.091 -0.157 -0.113 -0.023 -0.008 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.057 -0.151 0.053 -0.003 -0.114 -0.008 -0.007 0.156 -0.102 0.137 0.068 6 7 8 9 10 11 12 13 14 15 16 -0.037 -0.128 -0.046 0.172 0.008 -0.050 -0.046 0.142 -0.035 0.010 -0.070 > 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/2x51q1291887821.tab") > > try(system("convert tmp/1ydnb1291887821.ps tmp/1ydnb1291887821.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.430 0.160 0.572