R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(16896.20,16698.00,19691.60,15930.70,17444.60,17699.40,15189.80,15672.70,17180.80,17664.90,17862.90,16162.30,17463.60,16772.10,19106.90,16721.30,18161.30,18509.90,17802.70,16409.90,17967.70,20286.60,19537.30,18021.90,20194.30,19049.60,20244.70,21473.30,19673.60,21053.20,20159.50,18203.60,21289.50,20432.30,17180.40,15816.80,15076.60,14531.60,15761.30,14345.50,13916.80,15496.80,14285.60,13597.30,16263.10,16773.30,15986.90,16842.60,16014.60,15878.60,18664.90,17690.50,17107.60,19165.70,17203.60,16579.00,18885.10) > x <- c(16198.90,16554.20,19554.20,15903.80,18003.80,18329.60,16260.70,14851.90,18174.10,18406.60,18466.50,16016.50,17428.50,17167.20,19630.00,17183.60,18344.70,19301.40,18147.50,16192.90,18374.40,20515.20,18957.20,16471.50,18746.80,19009.50,19211.20,20547.70,19325.80,20605.50,20056.90,16141.40,20359.80,19711.60,15638.60,14384.50,13721.40,14134.30,15021.70,14212.60,13635.00,15446.90,14762.10,12521.00,16236.80,16065.00,16032.10,15794.30,15160.00,15692.10,18908.90,17424.50,17014.20,19790.40,17681.20,16006.90,19601.70) > par7 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '1' > par2 = '1' > par1 = '1' > 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] -616.6 -537.2 1204.0 -938.9 630.9 915.0 -545.8 -1140.7 1908.3 [10] -1617.9 -35.7 863.3 524.0 -2261.1 3782.9 -2383.0 323.0 605.3 [19] -1960.9 2036.9 -2789.0 -2515.0 1231.6 -2938.4 150.2 685.7 -2145.6 [28] 644.3 532.2 -136.2 1674.4 -502.6 476.4 4040.1 1016.3 28.8 [37] 119.2 2329.4 -675.3 167.3 964.3 -1424.4 566.8 -121.0 > y [1] -493.3 -658.8 1375.3 -73.9 93.8 1802.4 -1875.7 49.7 1834.8 [10] -947.3 185.2 871.1 -453.2 -1139.7 3614.2 -3239.7 1031.0 -186.5 [19] -563.1 1528.1 -3176.1 -2502.6 151.8 -2912.6 599.7 34.6 -2644.4 [28] 1371.0 200.4 -317.5 1267.6 -420.1 1367.4 2465.5 2219.3 -87.8 [37] 409.0 1556.6 441.4 -154.2 478.1 -750.9 63.7 -359.7 > postscript(file="/var/www/rcomp/tmp/1dgo61293609824.ps",horizontal=F,onefile=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 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -0.066 -0.195 0.003 -0.064 -0.195 0.205 -0.297 0.099 0.248 -0.225 0.348 -2 -1 0 1 2 3 4 5 6 7 8 0.198 -0.335 0.889 -0.115 -0.117 0.553 -0.307 0.119 0.252 -0.363 0.060 9 10 11 12 13 0.011 -0.240 0.044 -0.130 -0.286 > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/2kzl01293609824.tab") > > try(system("convert tmp/1dgo61293609824.ps tmp/1dgo61293609824.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.430 0.230 0.643