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. Natural language support but running in an English locale 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(235.1,280.7,264.6,240.7,201.4,240.8,241.1,223.8,206.1,174.7,203.3,220.5,299.5,347.4,338.3,327.7,351.6,396.6,438.8,395.6,363.5,378.8,357,369,464.8,479.1,431.3,366.5,326.3,355.1,331.6,261.3,249,205.5,235.6,240.9,264.9,253.8,232.3,193.8,177,213.2,207.2,180.6,188.6,175.4,199,179.6,225.8,234,200.2,183.6,178.2,203.2,208.5,191.8,172.8,148,159.4,154.5,213.2,196.4,182.8,176.4,153.6,173.2,171,151.2,161.9,157.2,201.7,236.4,356.1,398.3,403.7) > x <- c(9700,9081,9084,9743,8587,9731,9563,9998,9437,10038,9918,9252,9737,9035,9133,9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556) > par7 = '1' > par6 = '1' > 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/ > #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] 37 -46 49 -256 113 -104 -616 -715 -608 -91 -290 66 -132 -395 81 [16] 80 -153 -442 523 -160 449 223 -194 337 -176 99 338 120 472 487 [31] -264 -54 510 142 671 208 227 556 394 14 30 518 500 696 105 [46] -318 328 210 456 -29 -126 396 66 221 -28 643 260 374 148 524 [61] 568 472 -264 > y [1] 2.3 7.0 13.3 63.2 5.6 41.9 -25.9 -14.4 46.7 -50.4 -5.2 16.8 [13] -33.6 -38.7 -54.2 -64.1 -16.2 -65.7 -27.1 19.8 -58.8 51.9 -6.7 -71.8 [25] -25.4 26.3 26.3 23.4 7.4 17.5 43.7 20.3 30.3 -6.5 -24.7 22.2 [37] 19.3 -12.3 21.9 11.4 -11.2 11.3 9.9 -27.0 -11.6 -12.2 14.5 12.5 [49] -25.0 20.2 10.2 -17.4 -5.4 -7.5 -3.1 29.7 20.1 33.1 39.6 61.0 [61] 59.0 19.0 > postscript(file="/var/www/html/freestat/rcomp/tmp/1woer1293211593.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.048 0.095 0.242 0.110 0.238 0.231 0.176 0.396 0.261 0.099 0.304 -3 -2 -1 0 1 2 3 4 5 6 7 0.272 0.067 0.318 0.119 0.205 0.262 -0.120 0.030 -0.096 -0.044 0.164 8 9 10 11 12 13 14 -0.026 -0.177 0.070 -0.080 -0.081 0.064 -0.314 > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/2oqd01293211594.tab") > > try(system("convert tmp/1woer1293211593.ps tmp/1woer1293211593.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.611 0.211 0.662