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(92.1,88.5,84.6,87,83.6,84.8,84.1,84.1,80.5,82.6,85.6,83.3,86.1,84.7,85.7,84.9,84.2,85.2,86.1,86,84.5,87.2,83.5,81.9,78.5,81.1,79.2,80.9,81.8,79.4,83.4,81.1,79.8,79.7,84,83.7,83.5,83.6,86,86.8,86.9,89,87.8,86.8,88.8,85.9,86.7,87.9,88.5,88.7,88.1,85.7,86.1,85.7,84.3,86.4,85.4,86.9,85.6,86.4) > x <- c(110.4,112.9,109.4,111.9,108.9,113.8,114.5,113.2,111,114.6,113.1,113.2,115.1,117.6,117.8,115.7,115.7,118.3,117.9,117.3,119.4,117.1,119,120,118.9,116,115.6,119.7,119.7,120.8,120,120.2,121.7,116.9,122.4,122.6,123.7,120.9,124.2,122.6,125.7,123.1,122.2,126.2,124.4,127.8,124.2,126.7,126.1,128.2,130.4,130.2,129.2,129.7,131,129.2,131.1,132.9,135.2,132.3) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '1' > par3 = '0' > par2 = '1' > par1 = '1' > ylab = '' > xlab = '' > main = '' > #'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] 2.5 -3.5 2.5 -3.0 4.9 0.7 -1.3 -2.2 3.6 -1.5 0.1 1.9 2.5 0.2 -2.1 [16] 0.0 2.6 -0.4 -0.6 2.1 -2.3 1.9 1.0 -1.1 -2.9 -0.4 4.1 0.0 1.1 -0.8 [31] 0.2 1.5 -4.8 5.5 0.2 1.1 -2.8 3.3 -1.6 3.1 -2.6 -0.9 4.0 -1.8 3.4 [46] -3.6 2.5 -0.6 2.1 2.2 -0.2 -1.0 0.5 1.3 -1.8 1.9 1.8 2.3 -2.9 > y [1] -3.6 -3.9 2.4 -3.4 1.2 -0.7 0.0 -3.6 2.1 3.0 -2.3 2.8 -1.4 1.0 -0.8 [16] -0.7 1.0 0.9 -0.1 -1.5 2.7 -3.7 -1.6 -3.4 2.6 -1.9 1.7 0.9 -2.4 4.0 [31] -2.3 -1.3 -0.1 4.3 -0.3 -0.2 0.1 2.4 0.8 0.1 2.1 -1.2 -1.0 2.0 -2.9 [46] 0.8 1.2 0.6 0.2 -0.6 -2.4 0.4 -0.4 -1.4 2.1 -1.0 1.5 -1.3 0.8 > postscript(file="/var/www/html/freestat/rcomp/tmp/1ryzj1228203368.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.080 -0.146 0.241 -0.177 0.014 -0.041 -0.016 0.088 -0.039 -0.014 0.062 -3 -2 -1 0 1 2 3 4 5 6 7 0.023 -0.159 0.010 0.073 0.027 0.201 -0.201 0.103 -0.225 0.186 -0.098 8 9 10 11 12 13 14 -0.010 0.072 0.100 0.003 -0.333 0.299 -0.167 > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/2q4d71228203369.tab") > > system("convert tmp/1ryzj1228203368.ps tmp/1ryzj1228203368.png") > > > proc.time() user system elapsed 0.544 0.231 0.604