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(15370.60,14956.90,15469.70,15101.80,11703.70,16283.60,16726.50,14968.90,14861.00,14583.30,15305.80,17903.90,16379.40,15420.30,17870.50,15912.80,13866.50,17823.20,17872.00,17420.40,16704.40,15991.20,16583.60,19123.50,17838.70,17209.40,18586.50,16258.10,15141.60,19202.10,17746.50,19090.10,18040.30,17515.50,17751.80,21072.40,17170.00,19439.50,19795.40,17574.90,16165.40,19464.60,19932.10,19961.20,17343.40,18924.20,18574.10,21350.60,18594.60,19823.10,20844.40,19640.20,17735.40,19813.60,22238.50,20682.20,17818.60,21872.10,22117.00,21865.90) > x <- c(12300.00,12092.80,12380.80,12196.90,9455.00,13168.00,13427.90,11980.50,11884.80,11691.70,12233.80,14341.40,13130.70,12421.10,14285.80,12864.60,11160.20,14316.20,14388.70,14013.90,13419.00,12769.60,13315.50,15332.90,14243.00,13824.40,14962.90,13202.90,12199.00,15508.90,14199.80,15169.60,14058.00,13786.20,14147.90,16541.70,13587.50,15582.40,15802.80,14130.50,12923.20,15612.20,16033.70,16036.60,14037.80,15330.60,15038.30,17401.80,14992.50,16043.70,16929.60,15921.30,14417.20,15961.00,17851.90,16483.90,14215.50,17429.70,17839.50,17629.20) > par7 = '1' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '1' > 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] 830.7 328.3 1905.0 667.7 1705.2 1148.2 960.8 2033.4 1534.2 1077.9 [11] 1081.7 991.5 1112.3 1403.3 677.1 338.3 1038.8 1192.7 -188.9 1155.7 [21] 639.0 1016.6 832.4 1208.8 -655.5 1758.0 839.9 927.6 724.2 103.3 [31] 1833.9 867.0 -20.2 1544.4 890.4 860.1 1405.0 461.3 1126.8 1790.8 [41] 1494.0 348.8 1818.2 447.3 177.7 2099.1 2801.2 227.4 > y [1] 1008.8 463.4 2400.8 811.0 2162.8 1539.6 1145.5 2451.5 1843.4 1407.9 [11] 1277.8 1219.6 1459.3 1789.1 716.0 345.3 1275.1 1378.9 -125.5 1669.7 [21] 1335.9 1524.3 1168.2 1948.9 -668.7 2230.1 1208.9 1316.8 1023.8 262.5 [31] 2185.6 871.1 -696.9 1408.7 822.3 278.2 1424.6 383.6 1049.0 2065.3 [41] 1570.0 349.0 2306.4 721.0 475.2 2947.9 3542.9 515.3 > postscript(file="/var/www/html/rcomp/tmp/1hzsi1228766149.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 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -0.001 0.062 -0.044 -0.042 0.109 0.012 -0.110 0.234 -0.039 0.036 0.216 -2 -1 0 1 2 3 4 5 6 7 8 -0.183 -0.211 0.955 -0.230 -0.131 0.189 -0.020 -0.046 0.167 -0.158 -0.044 9 10 11 12 13 0.061 -0.065 -0.142 0.024 -0.073 > 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/2s3eq1228766149.tab") > > system("convert tmp/1hzsi1228766149.ps tmp/1hzsi1228766149.png") > > > proc.time() user system elapsed 0.388 0.168 0.456