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(16,29,22,30,20,39,18,9.6,10.2,20.2,50,120,19.8,18,3,11,15,27,28,14,5.6,6.5,8.5,87.9,5.8,25.2,7.5,13.7,34,17,9,9.2,5,24,40,86.5,0.54,14,4.8,28,16,5.8,16,9.1,6,17,26,99.6,41,72,23,42,40,18,45,18,2,10,13.6,160) > x <- c(1606,1634,2013,1654,1003,1029,1052,1653,1918,1926,1862,1816,1712,1646,1555,1402,1047,891,940,1372,2012,1879,1667,1856,1771,1721,1773,1507,1033,1011,1111,1736,1865,2078,1947,1428,1500,1950,1591,1613,1077,880,1128,1320,1692,1575,1478,1500,1368,1563,1424,1274,1047,1049,1069,981,1540,1559,1459,1559) > par7 = '1' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '1' > 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#output/ > #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] 106 12 -458 -252 44 -138 -112 -281 94 -47 -195 40 59 75 218 [16] 105 -14 120 171 364 -147 199 280 -428 -271 229 -182 106 44 -131 [31] 17 -416 -173 -503 -469 72 -132 -387 -167 -339 -30 169 -59 -339 -152 [46] -16 -19 59 > y [1] 3.80 -11.00 -19.00 -19.00 -5.00 -12.00 10.00 4.40 -4.60 -13.70 [11] -41.50 -32.10 -14.00 7.20 4.50 2.70 19.00 -10.00 -19.00 -4.80 [21] -0.60 17.50 31.50 -1.40 -5.26 -11.20 -2.70 14.30 -18.00 -11.20 [31] 7.00 -0.10 1.00 -7.00 -14.00 13.10 40.46 58.00 18.20 14.00 [41] 24.00 12.20 29.00 8.90 -4.00 -7.00 -12.40 60.40 > postscript(file="/var/www/rcomp/tmp/1hws81292067249.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.166 0.047 -0.083 -0.116 -0.061 0.030 -0.036 -0.147 -0.102 -0.364 -0.236 -2 -1 0 1 2 3 4 5 6 7 8 0.011 0.039 0.062 -0.209 -0.241 -0.069 -0.047 0.150 0.003 -0.264 -0.080 9 10 11 12 13 -0.073 -0.149 -0.141 -0.150 0.014 > 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/2g7ax1292067250.tab") > try(system("convert tmp/1hws81292067249.ps tmp/1hws81292067249.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.430 0.260 0.639