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(103.1,102.5,101.3,99.5,99.4,98.8,99.9,99.9,101.2,97.7,97,99.5,100.3,98.5,95.1,93.1,92.2,89,86.4,84.5,82.7,80.8,81.8,81.8,82.9,83.8,86.2,86.1,86.2,88.8,89.6,87.8,88.3,88.6,91,91.5,95.4,98.7,99.9,98.6,100.3,100.2,100.4,101.4,103,109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207,206.6,210.6,211.1,215,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221,213.6) > x <- c(105.3,103,103.8,103.4,105.8,101.4,97,94.3,96.6,97.1,95.7,96.9,97.4,95.3,93.6,91.5,93.1,91.7,94.3,93.9,90.9,88.3,91.3,91.7,92.4,92,95.6,95.8,96.4,99,107,109.7,116.2,115.9,113.8,112.6,113.7,115.9,110.3,111.3,113.4,108.2,104.8,106,110.9,115,118.4,121.4,128.8,131.7,141.7,142.9,139.4,134.7,125,113.6,111.5,108.5,112.3,116.6,115.5,120.1,132.9,128.1,129.3,132.5,131,124.9,120.8,122,122.1,127.4,135.2,137.3,135,136,138.4,134.7,138.4,133.9,133.6,141.2,151.8,155.4,156.6,161.6,160.7,156,159.5,168.7,169.9,169.9,185.9,190.8,195.8,211.9) > par7 = '1' > par6 = '1' > par5 = '-0.3' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '1.5' > #'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] -23.472279 8.134858 -4.071363 24.545659 -44.784156 -43.822748 [7] -26.406002 22.470523 4.920619 -13.745660 11.775889 4.928234 [13] -20.613086 -16.521461 -20.202503 15.371614 -13.457456 25.073288 [19] -3.880205 -28.837159 -24.610676 28.428528 3.826225 6.715984 [25] -3.840832 34.865609 1.956527 5.881834 25.699071 81.186029 [31] 28.104471 69.078276 -3.231795 -22.505221 -12.767444 11.700907 [37] 23.571757 -59.553630 10.526149 22.258928 -54.734765 -35.087232 [43] 12.319724 51.027186 43.573356 36.729118 32.849443 82.764585 [49] 33.096695 116.912256 14.314737 -41.582032 -55.021453 -110.526765 [55] -124.504126 -22.278732 -31.464022 39.926641 46.001285 -11.849905 [61] 49.925633 143.949079 -54.832794 13.613510 36.611464 -17.217337 [67] -68.998507 -45.442938 13.221787 1.104762 59.195403 89.373959 [73] 24.512436 -26.837087 11.640440 28.111687 -43.235875 43.235875 [79] -52.506902 -3.469510 89.082647 128.292417 44.616513 14.987986 [85] 63.066775 -11.425035 -59.142940 43.959273 117.849541 15.613832 [91] 0.000000 213.388666 67.247452 69.515701 229.854497 > y [1] -0.0031031015 -0.0059691600 -0.0009391859 -0.0022436016 -0.0076151409 [6] -0.0105334252 -0.0058553743 -0.0089496020 0.0026539867 0.0051084949 [11] -0.0064260295 0.0015444973 0.0074217434 0.0163581031 0.0051324504 [16] 0.0028015053 0.0169099121 0.0100782012 0.0005709938 0.0071891993 [21] 0.0070861660 0.0036464217 0.0014147148 0.0071439038 0.0057548548 [26] -0.0044055160 -0.0029927303 0.0039961822 -0.0080201893 -0.0018309924 [31] 0.0077672094 0.0024251170 0.0133179304 -0.0018447953 0.0043881610 [36] 0.0049134554 0.0023180109 0.0011178405 -0.0001317578 -0.0126941709 [41] 0.0012024298 0.0058438594 -0.0021165037 -0.0024491619 -0.0088382312 [46] 0.0013106288 -0.0076815328 0.0015478239 -0.0066331804 0.0012205701 [51] 0.0001614939 -0.0029175513 -0.0050014133 -0.0048756771 0.0088120588 [56] 0.0020511791 -0.0044598703 -0.0025378354 0.0110281572 -0.0037929229 [61] 0.0017495341 -0.0039011021 0.0195996768 0.0301191961 -0.0065430331 [66] 0.0081358651 -0.0091783841 -0.0063089689 0.0043543039 -0.0042528079 [71] -0.0052860858 -0.0128926814 -0.0023890147 0.0065697354 -0.0042334397 [76] -0.0182406985 0.0028658565 -0.0074039333 -0.0087341733 0.0023541669 [81] -0.0002524780 -0.0051515084 -0.0106416526 > postscript(file="/var/www/html/rcomp/tmp/1lwil1228236067.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 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 0.182 0.113 -0.040 0.085 -0.043 -0.154 -0.237 -0.163 -0.171 -0.122 -0.011 -5 -4 -3 -2 -1 0 1 2 3 4 5 0.097 -0.045 -0.050 0.220 -0.045 -0.172 0.050 -0.012 -0.131 -0.171 -0.134 6 7 8 9 10 11 12 13 14 15 16 -0.015 0.107 0.151 0.148 -0.072 -0.043 0.198 0.037 0.092 0.072 0.026 > 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/23jsv1228236067.tab") > > system("convert tmp/1lwil1228236067.ps tmp/1lwil1228236067.png") > > > proc.time() user system elapsed 0.398 0.165 0.504