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(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,1.4748,1.5527,1.575,1.5557,1.5553,1.577) > x <- c(1190.8,728.8,995.6,1260.3,994,957.3,975.6,884.9,908.4,1022.8,958.6,825.1,1116.6,724.2,1004.5,1058.9,854.7,943.4,792.4,873.2,1101.4,987.1,1038.8,1060.7,1047.7,840,1044,1097.4,987.5,934,977,881.1,1083.3,1074.7,1182.2,1117.5,1117.4,936.2,1246.3,1175.1,1177.7,1035.8,1091.6,998.7,1247.9,1034.7,1287.7,994.0,1122.8,1017.3,1106.0,1191.8,1030.1,989.4,979.6,1088.0,1389.2,1043.9,1182.1,1109.6,1463.3,1276.2,1082.4,1360.4,1130.2,1019.6,1077.0,958.8,959.6,907.2,880.8,759.6,1137.2) > 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] 1189.8 727.8 994.6 1259.3 993.0 956.3 974.6 883.9 907.4 1021.8 [11] 957.6 824.1 1115.6 723.2 1003.5 1057.9 853.7 942.4 791.4 872.2 [21] 1100.4 986.1 1037.8 1059.7 1046.7 839.0 1043.0 1096.4 986.5 933.0 [31] 976.0 880.1 1082.3 1073.7 1181.2 1116.5 1116.4 935.2 1245.3 1174.1 [41] 1176.7 1034.8 1090.6 997.7 1246.9 1033.7 1286.7 993.0 1121.8 1016.3 [51] 1105.0 1190.8 1029.1 988.4 978.6 1087.0 1388.2 1042.9 1181.1 1108.6 [61] 1462.3 1275.2 1081.4 1359.4 1129.2 1018.6 1076.0 957.8 958.6 906.2 [71] 879.8 758.6 1136.2 > y [1] -0.0078 -0.0222 -0.0192 -0.0189 0.0014 0.0183 0.0622 0.0773 0.0807 [10] 0.0848 0.1582 0.1663 0.1372 0.1139 0.1222 0.1692 0.1702 0.2286 [19] 0.2613 0.2646 0.2262 0.1985 0.2007 0.2138 0.2266 0.2176 0.2218 [28] 0.2490 0.2991 0.3408 0.3119 0.3014 0.3201 0.2938 0.2694 0.2165 [37] 0.2037 0.2292 0.2256 0.2015 0.1786 0.1856 0.2103 0.1938 0.2020 [46] 0.2271 0.2770 0.2650 0.2684 0.2811 0.2727 0.2611 0.2881 0.3213 [55] 0.2999 0.3074 0.3242 0.3516 0.3511 0.3419 0.3716 0.3622 0.3896 [64] 0.4227 0.4684 0.4570 0.4718 0.4748 0.5527 0.5750 0.5557 0.5553 [73] 0.5770 > postscript(file="/var/www/html/rcomp/tmp/14rb61228069845.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.148 0.181 0.184 0.268 0.282 0.284 0.356 0.385 0.343 0.315 0.271 0.238 0.198 -2 -1 0 1 2 3 4 5 6 7 8 9 10 0.152 0.072 0.100 0.125 0.105 0.133 0.204 0.198 0.191 0.185 0.177 0.177 0.191 11 12 13 14 15 0.162 0.132 0.148 0.116 0.111 > 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/2zm0a1228069845.tab") > > system("convert tmp/14rb61228069845.ps tmp/14rb61228069845.png") > > > proc.time() user system elapsed 1.185 0.296 1.247