R version 2.8.0 (2008-10-20) 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(0.8721,0.8552,0.8564,0.8973,0.9383,0.9217,0.9095,0.892,0.8742,0.8532,0.8607,0.9005,0.9111,0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.575,1.5557,1.5553,1.577,1.4975,1.4369) > x <- c(1593,1477.9,1733.7,1569.7,1843.7,1950.3,1657.5,1772.1,1568.3,1809.8,1646.7,1808.5,1763.9,1625.5,1538.8,1342.4,1645.1,1619.9,1338.1,1505.5,1529.1,1511.9,1656.7,1694.4,1662.3,1588.7,1483.3,1585.6,1658.9,1584.4,1470.6,1618.7,1407.6,1473.9,1515.3,1485.4,1496.1,1493.5,1298.4,1375.3,1507.9,1455.3,1363.3,1392.8,1348.8,1880.3,1669.2,1543.6,1701.2,1516.5,1466.8,1484.1,1577.2,1684.5,1414.7,1674.5,1598.7,1739.1,1674.6,1671.8,1802,1526.8,1580.9,1634.8,1610.3,1712,1678.8,1708.1,1680.6,2056,1624,2021.4,1861.1,1750.8,1767.5,1710.3,2151.5,2047.9,1915.4,1984.7,1896.5,2170.8,2139.9,2330.5,2121.8,2226.8,1857.9,2155.9,2341.7,2290.2,2006.5,2111.9,1731.3,1762.2,1863.2,1943.5,1975.2) > par7 = '0' > par6 = '1' > par5 = '0.3' > par4 = '12' > par3 = '1' > par2 = '1' > par1 = '-0.9' > #'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] 2.956380e-07 -2.811508e-04 -7.027943e-05 8.527319e-05 -8.287401e-05 [6] -7.794562e-05 8.953751e-05 1.752939e-04 -1.943097e-04 2.360729e-04 [11] -8.625952e-05 5.613982e-06 4.314151e-05 -2.074503e-05 2.872579e-04 [16] -2.260902e-04 -3.953834e-05 1.678932e-04 -4.206371e-05 -2.139262e-04 [21] 8.161105e-05 -8.225504e-05 -5.581810e-05 3.394590e-05 5.595539e-05 [26] -1.143241e-04 -2.124805e-06 7.395126e-05 9.611833e-06 5.912840e-06 [31] -9.761860e-05 1.443721e-04 3.715506e-04 -1.805842e-04 -7.436894e-05 [36] 1.156621e-04 -1.473457e-04 1.610727e-04 -7.196476e-05 -4.950242e-05 [41] 1.343565e-04 -1.401195e-04 1.964038e-04 -1.111752e-05 -3.316452e-04 [46] 9.546698e-05 9.987026e-05 -3.454328e-05 -6.012839e-05 9.313292e-05 [51] 2.714939e-05 -1.022946e-04 -7.182963e-06 2.115650e-04 -2.069226e-04 [56] 3.919714e-05 1.245274e-04 -2.274560e-04 2.583350e-04 -1.819533e-04 [61] 1.382426e-04 -3.534154e-05 -8.353579e-05 2.747200e-04 -1.279563e-04 [66] -4.786499e-05 1.739444e-05 -2.980800e-05 -8.789847e-05 2.597399e-04 [71] -1.736022e-04 -3.745639e-07 1.195682e-04 -2.023468e-04 1.989831e-04 [76] -1.756103e-04 2.968598e-05 -6.076130e-05 1.445855e-05 -1.715767e-04 [81] -1.212982e-04 7.946622e-05 -3.544644e-05 1.088335e-04 > y [1] -0.0187265816 0.0013381990 0.0448458701 0.0435414814 -0.0174653336 [6] -0.0129768596 -0.0188288236 -0.0194187751 -0.0232690141 0.0083559162 [11] 0.0435092895 0.0113602056 -0.0055613035 -0.0189903232 0.0044472524 [16] -0.0098902196 -0.0145840529 0.0063790176 0.0109292072 0.0335535216 [21] 0.0402169761 0.0374929607 -0.0145533084 0.0030442508 0.0003040664 [26] 0.0204256944 0.0167846746 0.0427077283 0.0144040172 0.0032237705 [31] 0.0038780592 0.0677530490 0.0072908200 -0.0263606419 -0.0214491356 [36] 0.0076763792 0.0427350743 0.0008960822 0.0514267502 0.0280515119 [41] 0.0028024881 -0.0329333186 -0.0242075813 0.0019368556 0.0114819534 [46] 0.0111355231 -0.0078211201 0.0036548742 0.0234592447 0.0422902740 [51] 0.0343373925 -0.0237163236 -0.0087072136 0.0154732693 -0.0218063605 [56] -0.0205102466 -0.0454335972 -0.0112005022 0.0222322624 -0.0031189787 [61] -0.0210467559 -0.0202743906 0.0062264548 0.0217670224 -0.0145058182 [66] 0.0072263745 0.0219074657 0.0426382709 -0.0101456828 0.0028814257 [71] 0.0107153989 -0.0070789753 -0.0098296976 0.0227830408 0.0275609742 [76] -0.0177088517 0.0062294438 0.0138637231 0.0223492543 -0.0004049790 [81] -0.0074704090 0.0239892620 -0.0075528899 0.0219153441 0.0260746070 [86] 0.0353113679 -0.0087356953 0.0113318838 0.0022872704 0.0582849719 [91] 0.0163069476 -0.0141036838 -0.0002935966 0.0158518706 -0.0588441895 [96] -0.0463411539 > postscript(file="/var/www/html/rcomp/tmp/1iaop1228203478.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 -0.041 -0.022 0.064 0.025 0.058 0.051 -0.077 -0.094 -0.037 0.264 -0.141 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.009 0.109 0.063 -0.154 -0.167 0.127 -0.007 -0.073 0.043 0.119 -0.044 6 7 8 9 10 11 12 13 14 15 16 -0.030 0.025 -0.059 -0.070 0.043 0.233 -0.070 -0.100 0.108 0.052 -0.083 > 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/2kimm1228203478.tab") > > system("convert tmp/1iaop1228203478.ps tmp/1iaop1228203478.png") > > > proc.time() user system elapsed 0.388 0.165 0.444