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(10812,10738,10171,9721,9897,9828,9924,10371,10846,10413,10709,10662,10570,10297,10635,10872,10296,10383,10431,10574,10653,10805,10872,10625,10407,10463,10556,10646,10702,11353,11346,11451,11964,12574,13031,13812,14544,14931,14886,16005,17064,15168,16050,15839,15137,14954,15648,15305,15579,16348,15928,16171,15937,15713,15594,15683,16438,17032,17696,17745) > x <- c(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,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457) > par7 = '0' > par6 = '1' > par5 = '-0.6' > par4 = '12' > par3 = '0' > par2 = '1' > par1 = '0.6' > #'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.0146982642 0.0032981503 0.0039716661 0.0701164262 0.0076272097 [6] -0.0275014866 -0.0222235967 0.0079376905 0.0445129676 0.0009392262 [11] 0.0543064306 0.0299567007 0.0030057963 -0.0351736400 -0.0256468394 [16] 0.0020455407 0.0121493657 0.0118205770 -0.0083061613 0.0038792539 [21] 0.0249948640 0.0454756389 0.0373184139 -0.0258130544 -0.0094346598 [26] 0.0167816911 -0.0236295942 -0.0220949234 -0.0484945091 -0.0118599429 [31] 0.0235779981 -0.0033167149 -0.0223047813 -0.0213605854 0.0065469151 [36] 0.0229787174 -0.0153291065 0.0076286221 0.0232226561 0.0456108300 [41] -0.0109024456 0.0030932105 0.0115248351 -0.0076175791 -0.0105526590 [46] 0.0245029710 0.0298497282 -0.0192056235 0.0067452367 0.0150534131 [51] 0.0243885147 -0.0004432644 -0.0081678125 0.0262882317 -0.0082953294 [56] 0.0241168084 0.0288815800 0.0394378365 -0.0097913677 > y [1] -2.614373e-05 -2.103388e-04 -1.807712e-04 7.226655e-05 -2.808494e-05 [6] 3.898959e-05 1.738918e-04 1.721069e-04 -1.563840e-04 1.079998e-04 [11] -1.682781e-05 -3.328557e-05 -1.015608e-04 1.251256e-04 8.400501e-05 [16] -2.095105e-04 3.283412e-05 1.792759e-05 5.263586e-05 2.859285e-05 [21] 5.407094e-05 2.344914e-05 -8.761534e-05 -8.008071e-05 2.082583e-05 [26] 3.419460e-05 3.263571e-05 2.008476e-05 2.217584e-04 -2.275806e-06 [31] 3.390310e-05 1.587520e-04 1.751545e-04 1.225577e-04 1.942783e-04 [36] 1.667738e-04 8.284852e-05 -9.456249e-06 2.224038e-04 1.887032e-04 [41] -3.525903e-04 1.723094e-04 -3.982155e-05 -1.388351e-04 -3.789759e-05 [46] 1.399467e-04 -6.789764e-05 5.443129e-05 1.449092e-04 -7.775722e-05 [51] 4.538216e-05 -4.368161e-05 -4.278713e-05 -2.312986e-05 1.732528e-05 [56] 1.408961e-04 1.037720e-04 1.093550e-04 7.809713e-06 > postscript(file="/var/www/html/rcomp/tmp/12sus1228264095.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 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0.039 0.010 -0.099 0.060 0.078 0.044 -0.097 -0.102 0.030 -0.354 -0.089 -3 -2 -1 0 1 2 3 4 5 6 7 0.028 -0.093 -0.294 -0.052 0.065 -0.141 0.097 0.188 0.086 -0.158 0.014 8 9 10 11 12 13 14 -0.042 -0.133 -0.108 0.190 0.165 -0.047 0.102 > 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/2mws21228264095.tab") > > system("convert tmp/12sus1228264095.ps tmp/12sus1228264095.png") > > > proc.time() user system elapsed 0.404 0.172 0.460