R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(7.3,7.1,7.1,6.8,6.5,6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8,8.1,8.2,8.3,8.2,8,7.9,7.6,7.6,8.2,8.3,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.6,6.2,6.2,6.8,6.9) > x <- c(13139.7,14532.2,15167,16071.1,14827.5,15082,14772.7,16083,14272.5,15223.3,14897.3,13062.6,12603.8,13629.8,14421.1,13978.3,12927.9,13429.9,13470.1,14785.8,14292,14308.8,14013,13240.9,12153.4,14289.7,15669.2,14169.5,14569.8,14469.1,14264.9,15320.9,14433.5,13691.5,14194.1,13519.2,11857.9,14616,15643.4,14077.2,14887.5,14159.9,14643,17192.5,15386.1,14287.1,17526.6,14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.7,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6,22404.1,21099,22486.5,23707.5,21897.5,23326.4,23765.4,20444) > par7 = '1' > par6 = '2' > par5 = '1' > par4 = '12' > par3 = '2' > 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] 1476.8 431.7 290.0 1257.5 -850.2 -593.9 -265.1 -1710.3 175.2 [10] 768.2 -965.4 54.9 -488.5 -940.3 990.4 -1040.7 -24.2 931.7 [19] 1753.2 -525.4 401.8 1938.5 -2451.9 2136.4 -1148.6 -634.2 1576.8 [28] -965.9 149.2 -474.4 -1955.2 1166.7 1072.0 -4160.5 2115.5 -816.2 [37] 731.0 -421.4 659.9 439.5 763.9 -1234.7 2087.7 -3113.6 1293.7 [46] -129.2 953.8 -897.3 -982.4 3491.3 -4132.4 -1864.3 1690.8 787.0 [55] -2977.9 4927.1 -2145.6 1625.9 1167.9 -1783.8 552.1 -52.5 972.7 [64] 2176.5 -115.4 -509.7 377.5 1523.2 -3160.9 1019.6 -771.8 51.2 > y [1] 1.000000e-01 -4.000000e-01 1.000000e-01 -2.000000e-01 -2.000000e-01 [6] -1.000000e-01 -3.000000e-01 2.000000e-01 4.000000e-01 3.000000e-01 [11] -6.000000e-01 -1.000000e-01 -3.000000e-01 6.000000e-01 -1.000000e-01 [16] 1.000000e-01 -3.552714e-15 -2.000000e-01 2.000000e-01 -2.000000e-01 [21] 2.000000e-01 -2.000000e-01 1.000000e-01 -1.000000e-01 -1.000000e-01 [26] 1.000000e-01 2.000000e-01 1.000000e-01 -2.000000e-01 -3.000000e-01 [31] -4.000000e-01 7.000000e-01 3.000000e-01 4.000000e-01 -3.000000e-01 [36] -5.000000e-01 -5.000000e-01 1.000000e-01 4.000000e-01 -3.552714e-15 [41] 3.000000e-01 3.000000e-01 -1.000000e-01 -2.000000e-01 -6.000000e-01 [46] -3.000000e-01 3.000000e-01 5.000000e-01 2.000000e-01 1.000000e-01 [51] -4.000000e-01 1.776357e-15 -1.000000e-01 0.000000e+00 4.000000e-01 [56] -4.000000e-01 -1.776357e-15 -4.000000e-01 3.000000e-01 1.000000e-01 [61] 2.000000e-01 -1.776357e-15 -2.000000e-01 0.000000e+00 1.000000e-01 [66] 0.000000e+00 2.000000e-01 -3.000000e-01 -2.000000e-01 5.000000e-01 [71] -3.000000e-01 -2.000000e-01 5.000000e-01 -2.000000e-01 2.000000e-01 [76] -2.000000e-01 -2.000000e-01 0.000000e+00 -1.000000e-01 2.000000e-01 [81] 6.000000e-01 -2.000000e-01 8.881784e-16 > postscript(file="/var/www/html/rcomp/tmp/1gg0u1261917250.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -0.062 0.175 -0.138 0.096 0.028 -0.085 0.014 -0.072 0.026 0.046 0.070 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.145 0.024 0.044 -0.018 -0.059 0.174 -0.212 0.094 -0.034 -0.036 0.095 7 8 9 10 11 12 13 14 15 -0.012 0.040 0.107 -0.130 0.009 -0.049 -0.064 0.038 0.103 > 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/2z6701261917250.tab") > > try(system("convert tmp/1gg0u1261917250.ps tmp/1gg0u1261917250.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.392 0.173 0.484