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 = '1' > 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] -207.2 288.0 -183.9 -2741.9 3713.0 259.9 -1447.4 -95.7 -193.1 [10] 542.1 2107.6 -1210.7 -709.6 1864.7 -1421.2 -1704.4 3156.0 72.5 [19] -374.8 -594.9 -649.4 545.9 2017.4 -1089.9 -418.6 1138.5 -1760.0 [28] -1003.9 3309.9 -1309.1 969.8 -1111.6 -271.8 361.7 2393.8 -2954.2 [37] 1994.9 220.4 -1672.3 -1207.3 2689.0 421.5 2.9 -1998.8 1292.8 [46] -292.3 2363.5 -2409.3 1051.2 885.9 -1008.3 -1504.1 1543.8 1890.9 [55] -1368.0 -2268.4 3214.2 409.8 -210.3 > y [1] -413.7 512.8 -367.9 -3398.1 4579.9 442.9 -1757.6 -107.9 -277.7 [10] 722.5 2598.1 -1524.5 -959.1 2450.2 -1957.7 -2046.3 3956.7 48.8 [19] -451.6 -716.0 -713.2 592.4 2539.9 -1284.8 -629.3 1377.1 -2328.4 [28] -1116.5 4060.5 -1455.6 1343.6 -1049.8 -524.8 236.3 3320.6 -3902.4 [37] 2269.5 355.9 -2220.5 -1409.5 3299.2 467.5 29.1 -2617.8 1580.8 [46] -350.1 2776.5 -2756.0 1228.5 1021.3 -1204.2 -1904.8 2078.2 2424.9 [55] -1556.3 -2863.6 4053.5 244.9 -251.1 > postscript(file="/var/www/html/rcomp/tmp/1gbuq1228766004.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.131 -0.262 0.623 -0.155 -0.262 0.038 0.182 -0.232 0.249 -0.202 0.147 -3 -2 -1 0 1 2 3 4 5 6 7 0.119 -0.315 -0.359 0.998 -0.368 -0.315 0.126 0.143 -0.190 0.241 -0.229 8 9 10 11 12 13 14 0.174 0.039 -0.260 -0.152 0.628 -0.269 -0.141 > 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/26hnp1228766004.tab") > > system("convert tmp/1gbuq1228766004.ps tmp/1gbuq1228766004.png") > > > proc.time() user system elapsed 0.395 0.171 0.494