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(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 = '-0.6' > #'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] 3.470147e-04 5.550522e-05 6.233606e-05 3.629786e-04 -2.259181e-04 [6] -1.303186e-04 -1.176737e-04 -3.417683e-04 2.460903e-05 1.851725e-04 [11] -2.132115e-04 1.591170e-05 -1.217042e-04 -1.817467e-04 1.985857e-04 [16] -2.604429e-04 1.318273e-05 2.083355e-04 3.366012e-04 -6.373893e-05 [21] 1.133818e-04 3.154601e-04 -4.399059e-04 5.887374e-04 -4.247254e-04 [26] -1.267205e-04 3.377532e-04 -2.232785e-04 7.640852e-05 -1.296546e-04 [31] -4.009545e-04 2.231182e-04 2.273107e-04 -8.204708e-04 4.059844e-04 [36] -2.799861e-04 2.428855e-04 -2.687251e-05 2.284990e-05 1.094001e-04 [41] 1.454569e-04 -2.046229e-04 3.034154e-04 -4.522452e-04 1.573658e-04 [46] 5.979964e-05 1.731961e-04 -1.934646e-04 -1.331697e-04 5.571138e-04 [51] -6.580167e-04 -2.696993e-04 2.145952e-04 1.478942e-04 -3.373077e-04 [56] 6.634067e-04 -3.630791e-04 2.671683e-04 1.515982e-04 -2.594368e-04 [61] 1.037225e-04 -8.401697e-05 1.948670e-04 3.576545e-04 -1.046743e-04 [66] -3.194981e-05 3.684267e-06 1.666833e-04 -3.684490e-04 1.021359e-04 [71] -1.830114e-04 1.423711e-04 > 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/1l94r1229003369.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.030 0.122 -0.132 0.092 0.026 -0.044 0.011 -0.081 -0.024 0.084 0.063 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.101 -0.019 0.023 -0.006 -0.044 0.150 -0.229 0.126 -0.072 0.035 0.071 7 8 9 10 11 12 13 14 15 -0.017 0.046 0.074 -0.095 -0.020 -0.011 -0.079 0.089 0.065 > 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/2ye7f1229003369.tab") > > system("convert tmp/1l94r1229003369.ps tmp/1l94r1229003369.png") > > > proc.time() user system elapsed 0.384 0.174 0.564