R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(16198.9,16554.2,19554.2,15903.8,18003.8,18329.6,16260.7,14851.9,18174.1,18406.6,18466.5,16016.5,17428.5,17167.2,19630.00,17183.6,18344.7,19301.4,18147.5,16192.9,18374.4,20515.2,18957.2,16471.5,18746.8,19009.5,19211.2,20547.7,19325.8,20605.5,20056.9,16141.4,20359.8,19711.6,15638.6,14384.5,13855.6,14308.3,15290.6,14423.8,13779.7,15686.3,14733.8,12522.5,16189.4,16059.1,16007.1,15806.8,15160.00,15692.1,18908.9,16969.9,16997.5,19858.9,17681.2) > x <- c(16896.2,16698.00,19691.6,15930.7,17444.6,17699.4,15189.8,15672.7,17180.8,17664.9,17862.9,16162.3,17463.6,16772.1,19106.9,16721.3,18161.3,18509.9,17802.7,16409.9,17967.7,20286.6,19537.3,18021.9,20194.3,19049.6,20244.7,21473.3,19673.6,21053.2,20159.5,18203.6,21289.5,20432.3,17180.4,15816.8,15071.8,14521.1,15668.8,14346.9,13881.00,15465.9,14238.2,13557.7,16127.6,16793.9,16014.00,16867.9,16014.6,15878.6,18664.9,17962.5,17332.7,19542.1,17203.6) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > 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#output/ > #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] 16895.2 16697.0 19690.6 15929.7 17443.6 17698.4 15188.8 15671.7 17179.8 [10] 17663.9 17861.9 16161.3 17462.6 16771.1 19105.9 16720.3 18160.3 18508.9 [19] 17801.7 16408.9 17966.7 20285.6 19536.3 18020.9 20193.3 19048.6 20243.7 [28] 21472.3 19672.6 21052.2 20158.5 18202.6 21288.5 20431.3 17179.4 15815.8 [37] 15070.8 14520.1 15667.8 14345.9 13880.0 15464.9 14237.2 13556.7 16126.6 [46] 16792.9 16013.0 16866.9 16013.6 15877.6 18663.9 17961.5 17331.7 19541.1 [55] 17202.6 > y [1] 16197.9 16553.2 19553.2 15902.8 18002.8 18328.6 16259.7 14850.9 18173.1 [10] 18405.6 18465.5 16015.5 17427.5 17166.2 19629.0 17182.6 18343.7 19300.4 [19] 18146.5 16191.9 18373.4 20514.2 18956.2 16470.5 18745.8 19008.5 19210.2 [28] 20546.7 19324.8 20604.5 20055.9 16140.4 20358.8 19710.6 15637.6 14383.5 [37] 13854.6 14307.3 15289.6 14422.8 13778.7 15685.3 14732.8 12521.5 16188.4 [46] 16058.1 16006.1 15805.8 15159.0 15691.1 18907.9 16968.9 16996.5 19857.9 [55] 17680.2 > postscript(file="/var/www/html/rcomp/tmp/146ul1292080948.ps",horizontal=F,onefile=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.480 -0.402 -0.184 -0.319 -0.354 -0.168 -0.022 -0.005 0.203 0.233 0.337 -3 -2 -1 0 1 2 3 4 5 6 7 0.472 0.390 0.553 0.935 0.573 0.484 0.570 0.462 0.388 0.360 0.174 8 9 10 11 12 13 14 0.156 0.011 -0.162 -0.097 0.038 -0.181 -0.265 > 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/2bprx1292080948.tab") > > try(system("convert tmp/146ul1292080948.ps tmp/146ul1292080948.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.394 0.181 0.807