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(1.5421,1.5642,1.5827,1.5878,1.5703,1.5968,1.5978,1.5575,1.5749,1.6176,1.6387,1.6422,1.6891,1.7236,1.8072,1.7847,1.6813,1.6469,1.689,1.7169,1.8036,1.7955,1.7172,1.7348,1.7094,1.6963,1.6695,1.6537,1.6662,1.6793,1.7922,1.8045,1.7927,1.7831,1.7847,1.8076,1.8218,1.8112,1.795,1.7813,1.7866,1.7552,1.7184,1.7114,1.6967,1.6867,1.6337,1.6626,1.6374,1.626,1.637,1.6142,1.7033,1.7483,1.7135,1.7147,1.7396,1.7049,1.6867,1.7462,1.7147,1.667,1.6806,1.6738,1.6571,1.5875,1.6002,1.6144,1.6009,1.5937,1.603,1.5979,1.6152,1.6102,1.654,1.6662,1.6715,1.7104,1.6869,1.6788,1.6839,1.6733,1.6684,1.6814,1.6602,1.6708,1.6704,1.6336,1.6378,1.593,1.5809,1.6442,1.6445,1.5837,1.6373,1.6703,1.6694) > x <- c(1.0137,0.9834,0.9643,0.947,0.906,0.9492,0.9397,0.9041,0.8721,0.8552,0.8564,0.8973,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,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '1' > 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.0137 -0.0166 -0.0357 -0.0530 -0.0940 -0.0508 -0.0603 -0.0959 -0.1279 [10] -0.1448 -0.1436 -0.1027 -0.0617 -0.0783 -0.0905 -0.1080 -0.1258 -0.1468 [19] -0.1393 -0.0995 -0.0889 -0.0941 -0.1117 -0.1076 -0.1167 -0.1300 -0.1242 [28] -0.1142 -0.0830 -0.0446 -0.0078 -0.0222 -0.0192 -0.0189 0.0014 0.0183 [37] 0.0622 0.0773 0.0807 0.0848 0.1582 0.1663 0.1372 0.1139 0.1222 [46] 0.1692 0.1702 0.2286 0.2613 0.2646 0.2262 0.1985 0.2007 0.2138 [55] 0.2266 0.2176 0.2218 0.2490 0.2991 0.3408 0.3119 0.3014 0.3201 [64] 0.2938 0.2694 0.2165 0.2037 0.2292 0.2256 0.2015 0.1786 0.1856 [73] 0.2103 0.1938 0.2020 0.2271 0.2770 0.2650 0.2684 0.2811 0.2727 [82] 0.2611 0.2881 0.3213 0.2999 0.3074 0.3242 0.3516 0.3511 0.3419 [91] 0.3716 0.3622 0.3896 0.4227 0.4684 0.4570 0.4718 > y [1] 0.5421 0.5642 0.5827 0.5878 0.5703 0.5968 0.5978 0.5575 0.5749 0.6176 [11] 0.6387 0.6422 0.6891 0.7236 0.8072 0.7847 0.6813 0.6469 0.6890 0.7169 [21] 0.8036 0.7955 0.7172 0.7348 0.7094 0.6963 0.6695 0.6537 0.6662 0.6793 [31] 0.7922 0.8045 0.7927 0.7831 0.7847 0.8076 0.8218 0.8112 0.7950 0.7813 [41] 0.7866 0.7552 0.7184 0.7114 0.6967 0.6867 0.6337 0.6626 0.6374 0.6260 [51] 0.6370 0.6142 0.7033 0.7483 0.7135 0.7147 0.7396 0.7049 0.6867 0.7462 [61] 0.7147 0.6670 0.6806 0.6738 0.6571 0.5875 0.6002 0.6144 0.6009 0.5937 [71] 0.6030 0.5979 0.6152 0.6102 0.6540 0.6662 0.6715 0.7104 0.6869 0.6788 [81] 0.6839 0.6733 0.6684 0.6814 0.6602 0.6708 0.6704 0.6336 0.6378 0.5930 [91] 0.5809 0.6442 0.6445 0.5837 0.6373 0.6703 0.6694 > postscript(file="/var/www/html/rcomp/tmp/1xqop1228293452.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.443 -0.462 -0.493 -0.511 -0.520 -0.527 -0.521 -0.499 -0.478 -0.459 -0.444 -5 -4 -3 -2 -1 0 1 2 3 4 5 -0.413 -0.375 -0.332 -0.284 -0.231 -0.185 -0.168 -0.152 -0.129 -0.082 -0.053 6 7 8 9 10 11 12 13 14 15 16 -0.024 0.015 0.052 0.074 0.084 0.074 0.074 0.095 0.121 0.158 0.185 > 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/2abpp1228293452.tab") > > system("convert tmp/1xqop1228293452.ps tmp/1xqop1228293452.png") > > > proc.time() user system elapsed 0.389 0.176 0.602