R version 2.7.0 (2008-04-22) 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(90.8,96.4,90,92.1,97.2,95.1,88.5,91,90.5,75,66.3,66,68.4,70.6,83.9,90.1,90.6,87.1,90.8,94.1,99.8,96.8,87,96.3,107.1,115.2,106.1,89.5,91.3,97.6,100.7,104.6,94.7,101.8,102.5,105.3,110.3,109.8,117.3,118.8,131.3,125.9,133.1,147,145.8,164.4,149.8,137.7,151.7,156.8,180,180.4,170.4,191.6,199.5,218.2,217.5,205,194,199.3,219.3,211.1,215.2,240.2,242.2,240.7,255.4,253,218.2,203.7,205.6,215.6) > x <- c(0.9383,0.9217,0.9095,0.892,0.8742,0.8532,0.8607,0.9005,0.9111,0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > 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] -0.0617 -0.0783 -0.0905 -0.1080 -0.1258 -0.1468 -0.1393 -0.0995 -0.0889 [10] -0.0941 -0.1117 -0.1076 -0.1167 -0.1300 -0.1242 -0.1142 -0.0830 -0.0446 [19] -0.0078 -0.0222 -0.0192 -0.0189 0.0014 0.0183 0.0622 0.0773 0.0807 [28] 0.0848 0.1582 0.1663 0.1372 0.1139 0.1222 0.1692 0.1702 0.2286 [37] 0.2613 0.2646 0.2262 0.1985 0.2007 0.2138 0.2266 0.2176 0.2218 [46] 0.2490 0.2991 0.3408 0.3119 0.3014 0.3201 0.2938 0.2694 0.2165 [55] 0.2037 0.2292 0.2256 0.2015 0.1786 0.1856 0.2103 0.1938 0.2020 [64] 0.2271 0.2770 0.2650 0.2684 0.2811 0.2727 0.2611 0.2881 0.3213 > y [1] 89.8 95.4 89.0 91.1 96.2 94.1 87.5 90.0 89.5 74.0 65.3 65.0 [13] 67.4 69.6 82.9 89.1 89.6 86.1 89.8 93.1 98.8 95.8 86.0 95.3 [25] 106.1 114.2 105.1 88.5 90.3 96.6 99.7 103.6 93.7 100.8 101.5 104.3 [37] 109.3 108.8 116.3 117.8 130.3 124.9 132.1 146.0 144.8 163.4 148.8 136.7 [49] 150.7 155.8 179.0 179.4 169.4 190.6 198.5 217.2 216.5 204.0 193.0 198.3 [61] 218.3 210.1 214.2 239.2 241.2 239.7 254.4 252.0 217.2 202.7 204.6 214.6 > postscript(file="/var/www/html/rcomp/tmp/1zfn71228750384.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 0.687 0.689 0.691 0.693 0.701 0.710 0.720 0.727 0.733 0.731 0.729 0.729 0.729 -2 -1 0 1 2 3 4 5 6 7 8 9 10 0.725 0.727 0.736 0.701 0.667 0.634 0.598 0.542 0.482 0.430 0.378 0.331 0.293 11 12 13 14 15 0.250 0.201 0.154 0.111 0.065 > 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/2u2hr1228750384.tab") > > system("convert tmp/1zfn71228750384.ps tmp/1zfn71228750384.png") > > > proc.time() user system elapsed 1.185 0.296 1.235