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(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2,71.7,77.5,89.8,80.3,78.7,93.8,57.6,60.6,91,85.3,77.4,77.3,68.3,69.9,81.7,75.1,69.9,84,54.3,60,89.9,77,85.3,77.6,69.2,75.5,85.7,72.2,79.9,85.3,52.2,61.2,82.4,85.4,78.2,70.2) > x <- c(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5) > par7 = '1' > par6 = '0' > par5 = '0.0' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '-1.9' > 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] 1.466498e-06 0.000000e+00 -3.388644e-06 6.609275e-06 1.557708e-06 [6] -5.117280e-06 1.019340e-05 -4.024930e-06 1.271321e-06 -4.995126e-07 [11] -2.497397e-06 5.534855e-06 1.533072e-05 9.254263e-06 1.042586e-05 [16] 9.508991e-06 -3.487560e-06 7.727342e-06 1.239062e-05 1.100483e-05 [21] 1.604829e-05 7.226760e-06 1.124433e-05 2.490365e-05 -1.358977e-05 [26] 4.225821e-07 7.955498e-06 2.577023e-07 6.181549e-06 1.574352e-05 [31] 3.462063e-06 8.972494e-06 3.638312e-06 -3.305629e-06 7.001609e-06 [36] 5.611175e-06 1.128413e-05 1.655614e-06 -5.590899e-07 4.643873e-06 [41] 1.012254e-05 -4.803801e-06 -1.482010e-05 -1.385393e-06 -8.550189e-07 [46] -3.720584e-06 2.826023e-07 -1.106535e-05 2.776498e-06 8.544987e-06 [51] 8.951494e-06 -2.631344e-06 8.752389e-06 3.384844e-06 6.588877e-06 [56] 6.096917e-06 5.465675e-07 1.073191e-05 5.247648e-06 3.249516e-06 > y [1] -0.123533483 -0.060130184 -0.067964726 0.038890871 -0.046043939 [6] -0.067010710 -0.042065665 -0.163924192 0.011310205 -0.110021604 [11] -0.012764042 -0.004287252 -0.029258963 -0.103960935 -0.122853673 [16] -0.048584000 -0.173356627 -0.236850931 -0.076961041 -0.114078967 [21] -0.056882803 0.000993542 -0.160428579 -0.112426836 -0.160704174 [26] -0.101741070 -0.022027322 -0.140357358 -0.020126466 0.162895270 [31] -0.081643989 0.059490776 -0.102278849 -0.165971345 -0.107683397 [36] -0.073553392 -0.048580981 -0.103212287 -0.094530973 -0.066949062 [41] -0.118577506 -0.110348057 -0.058998341 -0.009950331 -0.012161565 [46] -0.102369033 0.097187674 0.003873472 0.013091096 0.077067007 [51] 0.047798824 -0.039380513 0.133710204 0.015357656 -0.039441732 [56] 0.019802627 -0.087112505 0.103540679 -0.086904807 -0.100219116 > postscript(file="/var/www/html/rcomp/tmp/1sl521228391046.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.043 -0.077 0.018 -0.118 -0.251 0.064 0.004 -0.148 -0.040 -0.429 -0.447 -3 -2 -1 0 1 2 3 4 5 6 7 -0.076 -0.255 -0.292 0.218 -0.132 0.068 -0.017 -0.158 0.037 -0.110 0.041 8 9 10 11 12 13 14 0.201 0.109 0.086 0.111 -0.156 -0.236 -0.050 > 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/216zc1228391046.tab") > > system("convert tmp/1sl521228391046.ps tmp/1sl521228391046.png") > > > proc.time() user system elapsed 0.395 0.176 0.457