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(16973.38,16329.89,16153.34,15311.7,14760.87,14452.93,13720.95,13266.27,12708.47,13411.84,13975.55,12974.89,12151.11,11576.21,9996.83,10438.9,10511.22,10496.2,10300.79,9981.65,11448.79,11384.49,11717.46,10965.88,10352.27,9751.2,9354.01,8792.5,8721.14,8692.94,8570.73,8538.47,8169.75,7905.84,8145.82,8895.71,9676.31,9884.59,10637.44,10717.13,10205.29,10295.98,10892.76,10631.92,11441.08,11950.95,11037.54,11527.72,11383.89,10989.34,11079.42,11028.93,10973,11068.05,11394.84,11545.71,11809.38,11395.64,11082.38,11402.75,11716.87,12204.98,12986.62,13392.79,14368.05,15650.83,16102.64,16187.64,16311.54,17232.97,16397.83,14990.31,15147.55,15786.78,15934.09,16519.44,16101.07,16775.08,17286.32,17741.23,17128.37,17460.53,17611.14,18001.37,17974.77,16460.95,16235.39,16903.36,15543.76,15532.18,13731.31,13547.84,12602.93,13357.7,13995.33,14084.6,13168.91,12989.35,12123.53) > x <- c(6436.06,6480,6448.44,6293.6,6360.63,6243.13,6193.51,6118.41,5713.4,5768.9,5879.1,5753.06,5462.59,5444.36,4887.18,5060.03,5242.32,5180.17,5193.08,5126.8,5252.4,5206.33,5167.79,4732.34,4241.22,4255.8,3956.7,3967.57,4102.09,3949.02,3786.6,3644.38,3637.9,3862.94,3988.4,4119.55,4078.98,4181.67,4234.96,4290.43,4349.43,4390.59,4470.42,4442.96,4446.78,4515.61,4453.08,4477.2,4364.21,4382.97,4561.51,4644.89,4744.16,4746,4826.49,4999.01,4961.84,4887.81,4925.69,5050.3,5228.04,5307.39,5392.56,5292.92,5458.19,5547.21,5711.15,5806.73,5938.81,6054.41,5843.5,5668.05,5833.67,5877.73,5896.1,6101.38,6167.75,6171.56,6237.79,6362.69,6205.71,6434.35,6569.76,6597.96,6561.87,6177.22,6345.11,6599.27,6325.12,6431.14,6031.19,5910.13,5676.27,5993.57,6192.45,5778.27,5375.22,5465.67,5231.7) > 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] 6435.06 6479.00 6447.44 6292.60 6359.63 6242.13 6192.51 6117.41 5712.40 [10] 5767.90 5878.10 5752.06 5461.59 5443.36 4886.18 5059.03 5241.32 5179.17 [19] 5192.08 5125.80 5251.40 5205.33 5166.79 4731.34 4240.22 4254.80 3955.70 [28] 3966.57 4101.09 3948.02 3785.60 3643.38 3636.90 3861.94 3987.40 4118.55 [37] 4077.98 4180.67 4233.96 4289.43 4348.43 4389.59 4469.42 4441.96 4445.78 [46] 4514.61 4452.08 4476.20 4363.21 4381.97 4560.51 4643.89 4743.16 4745.00 [55] 4825.49 4998.01 4960.84 4886.81 4924.69 5049.30 5227.04 5306.39 5391.56 [64] 5291.92 5457.19 5546.21 5710.15 5805.73 5937.81 6053.41 5842.50 5667.05 [73] 5832.67 5876.73 5895.10 6100.38 6166.75 6170.56 6236.79 6361.69 6204.71 [82] 6433.35 6568.76 6596.96 6560.87 6176.22 6344.11 6598.27 6324.12 6430.14 [91] 6030.19 5909.13 5675.27 5992.57 6191.45 5777.27 5374.22 5464.67 5230.70 > y [1] 16972.38 16328.89 16152.34 15310.70 14759.87 14451.93 13719.95 13265.27 [9] 12707.47 13410.84 13974.55 12973.89 12150.11 11575.21 9995.83 10437.90 [17] 10510.22 10495.20 10299.79 9980.65 11447.79 11383.49 11716.46 10964.88 [25] 10351.27 9750.20 9353.01 8791.50 8720.14 8691.94 8569.73 8537.47 [33] 8168.75 7904.84 8144.82 8894.71 9675.31 9883.59 10636.44 10716.13 [41] 10204.29 10294.98 10891.76 10630.92 11440.08 11949.95 11036.54 11526.72 [49] 11382.89 10988.34 11078.42 11027.93 10972.00 11067.05 11393.84 11544.71 [57] 11808.38 11394.64 11081.38 11401.75 11715.87 12203.98 12985.62 13391.79 [65] 14367.05 15649.83 16101.64 16186.64 16310.54 17231.97 16396.83 14989.31 [73] 15146.55 15785.78 15933.09 16518.44 16100.07 16774.08 17285.32 17740.23 [81] 17127.37 17459.53 17610.14 18000.37 17973.77 16459.95 16234.39 16902.36 [89] 15542.76 15531.18 13730.31 13546.84 12601.93 13356.70 13994.33 14083.60 [97] 13167.91 12988.35 12122.53 > postscript(file="/var/www/html/rcomp/tmp/1xsn91228174276.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.117 0.156 0.193 0.238 0.285 0.341 0.400 0.453 0.504 0.558 0.614 0.669 0.720 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 0.772 0.826 0.874 0.916 0.905 0.893 0.879 0.866 0.851 0.832 0.806 0.776 0.750 10 11 12 13 14 15 16 0.725 0.689 0.651 0.612 0.569 0.535 0.497 > 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/2d4u71228174276.tab") > > system("convert tmp/1xsn91228174276.ps tmp/1xsn91228174276.png") > > > proc.time() user system elapsed 0.410 0.176 4.517