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(58.972,59.249,63.955,53.785,52.760,44.795,37.348,32.370,32.717,40.974,33.591,21.124,58.608,46.865,51.378,46.235,47.206,45.382,41.227,33.795,31.295,42.625,33.625,21.538,56.421,53.152,53.536,52.408,41.454,38.271,35.306,26.414,31.917,38.030,27.534,18.387,50.556,43.901,48.572,43.899,37.532,40.357,35.489,29.027,34.485,42.598,30.306,26.451,47.460,50.104,61.465,53.726,39.477,43.895,31.481,29.896,33.842,39.120,33.702,25.094) > x <- c(493.000,481.000,462.000,457.000,442.000,439.000,488.000,521.000,501.000,485.000,464.000,460.000,467.000,460.000,448.000,443.000,436.000,431.000,484.000,510.000,513.000,503.000,471.000,471.000,476.000,475.000,470.000,461.000,455.000,456.000,517.000,525.000,523.000,519.000,509.000,512.000,519.000,517.000,510.000,509.000,501.000,507.000,569.000,580.000,578.000,565.000,547.000,555.000,562.000,561.000,555.000,544.000,537.000,543.000,594.000,611.000,613.000,611.000,594.000,595.000) > par7 = '1' > par6 = '1' > par5 = '1.0' > par4 = '12' > par3 = '1' > par2 = '1' > par1 = '1.0' > #'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] 5 7 0 8 -2 4 -7 23 6 -11 4 -2 6 7 -4 1 6 8 -18 [20] -5 6 22 3 2 -1 -2 8 -2 5 1 3 0 -9 -8 5 0 1 1 [39] -10 1 0 -11 6 4 11 1 -7 > y [1] -12.020 -0.193 5.027 1.996 6.141 3.292 -2.454 -2.847 3.073 [10] -1.617 0.380 -2.601 8.474 -4.129 4.015 -11.925 -1.359 1.190 [19] -1.460 8.003 -5.217 -1.496 2.940 -2.714 -3.386 4.287 -3.545 [28] 4.587 6.008 -1.903 2.430 -0.045 2.000 -1.796 5.292 -11.160 [37] 9.299 6.690 -3.066 -7.882 1.593 -7.546 4.877 -1.512 -2.835 [46] 6.874 -4.753 > postscript(file="/var/www/html/rcomp/tmp/1u0v11229438752.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.150 0.013 0.165 -0.123 0.040 -0.090 0.049 0.186 0.048 -0.100 -0.043 -2 -1 0 1 2 3 4 5 6 7 8 0.116 0.049 0.023 -0.219 0.062 0.204 -0.087 -0.081 -0.128 -0.101 0.003 9 10 11 12 13 0.184 -0.144 0.009 0.097 -0.154 > 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/2vxub1229438752.tab") > > system("convert tmp/1u0v11229438752.ps tmp/1u0v11229438752.png") > > > proc.time() user system elapsed 0.388 0.173 0.446