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.5' > 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] 1.680914e-02 -2.388519e-03 -3.369087e-02 4.330325e-02 3.211690e-03 [6] -6.051242e-03 8.146595e-03 1.578050e-02 -6.266571e-03 4.920656e-03 [11] -3.701983e-02 -5.147171e-03 1.267514e-02 -1.374470e-02 -2.556033e-03 [16] 2.281913e-02 -6.242835e-03 -1.673281e-02 4.161989e-03 2.925794e-03 [21] -3.888068e-02 -2.749183e-02 1.419709e-03 5.776012e-03 5.997536e-03 [26] 3.760525e-02 1.317820e-02 -2.748772e-03 -7.458901e-03 7.304493e-03 [31] 3.806770e-03 1.606348e-02 -7.007696e-03 -2.189188e-02 2.272856e-02 [36] 1.790608e-02 1.201227e-02 -1.419775e-02 -3.510197e-02 4.829648e-03 [41] 1.329464e-02 6.564826e-03 8.623399e-03 -1.752550e-02 1.437759e-02 [46] -2.057600e-03 5.267648e-03 6.707985e-03 -1.062869e-03 1.211505e-02 [51] 2.751900e-03 1.893548e-02 -7.261717e-03 9.968208e-03 1.631918e-02 [56] 3.986055e-03 1.990316e-02 -1.413581e-02 -1.591890e-02 1.463533e-02 [61] 5.360499e-03 2.162434e-02 -3.082098e-04 -3.835254e-03 8.937558e-03 [66] 5.903382e-03 1.296591e-02 -3.722715e-04 -9.597030e-03 -6.927887e-03 [71] 3.039489e-03 1.299305e-02 -3.653572e-03 2.640059e-03 9.741062e-03 [76] 6.562087e-03 -3.820565e-03 7.619869e-03 -1.247365e-04 -1.755396e-02 [81] -8.601800e-03 -1.277954e-03 6.430106e-03 -1.659972e-02 7.735427e-03 [86] 7.682222e-03 1.100207e-02 5.389831e-05 4.573197e-03 7.994272e-03 [91] -6.083413e-03 7.749959e-03 7.619662e-03 1.341686e-02 -2.281493e-03 [96] 1.865018e-03 2.068692e-03 8.918511e-03 6.270438e-03 1.142752e-02 [101] 5.944646e-03 2.005949e-03 -1.402083e-02 -1.295561e-02 -3.122939e-02 [106] -3.868647e-02 -3.368814e-02 5.012608e-03 > postscript(file="/var/www/rcomp/tmp/11ged1292249691.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.004 0.059 -0.025 0.075 0.093 -0.041 0.070 0.102 0.190 0.021 0.043 -6 -5 -4 -3 -2 -1 0 1 2 3 4 0.035 0.095 0.107 0.036 0.256 0.323 0.075 0.039 0.056 -0.037 -0.155 5 6 7 8 9 10 11 12 13 14 15 -0.011 -0.007 -0.058 0.089 0.076 -0.007 0.062 -0.014 0.001 0.070 -0.027 16 17 0.033 0.111 > 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/28zbp1292249691.tab") > > try(system("convert tmp/11ged1292249691.ps tmp/11ged1292249691.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.440 0.250 0.661