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(6,6.81,9.75,6.96,3.94,5,4.9,5.7,6.5,7.1,7.5,7.8,7,7.4,8.55,7.43,4.7,4.7,5.3,6.2,7.4,7.5,7.32,8.15,7.24,7.4,9.4,8.9,4.5,4.9,5.6,6.4,6,6.9,6.7,5.4,5.6,6.9,6.9,7,4,3.7,4.9,5,5.7,6.1,5.3,5.5,5.7,5.21,5.4,4.5,3.7,4.1,4.8,4.1,5,5.2,5.5,5.9) > 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] 1.00 0.59 -1.20 0.47 0.76 -0.30 0.40 0.50 0.90 0.40 -0.18 0.35 [13] 0.24 0.00 0.85 1.47 -0.20 0.20 0.30 0.20 -1.40 -0.60 -0.62 -2.75 [25] -1.64 -0.50 -2.50 -1.90 -0.50 -1.20 -0.70 -1.40 -0.30 -0.80 -1.40 0.10 [37] 0.10 -1.69 -1.50 -2.50 -0.30 0.40 -0.10 -0.90 -0.70 -0.90 0.20 0.40 > postscript(file="/var/www/html/rcomp/tmp/1smhf1292497100.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.180 -0.412 -0.095 -0.198 -0.348 -0.198 -0.124 0.043 -0.109 -0.151 0.129 -2 -1 0 1 2 3 4 5 6 7 8 -0.128 0.018 0.564 0.051 -0.066 0.205 0.268 0.316 0.294 0.333 0.302 9 10 11 12 13 0.144 0.412 0.384 0.159 0.321 > 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/2y5eq1292497100.tab") > try(system("convert tmp/1smhf1292497100.ps tmp/1smhf1292497100.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.390 0.182 0.985