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(75.53,75.75,76.57,77.59,77.15,79.08,80.29,79.94,80.19,79.70,79.14,78.23,77.16,76.77,76.19,74.83,74.33,72.71,71.32,71.88,71.78,71.77,72.17,70.84,70.64,70.85,71.43,78.52,81.12,84.16,84.36,84.13,83.59,82.13,83.03,83.91,83.01,82.36,82.01,81.83,80.89,82.86,83.28,82.63,81.52,82.20,81.97,81.60,82.36,82.55,81.27,79.89,74.44,73.47,73.16,73.16,72.94,72.89,73.26,73.93,72.58,72.00,72.79,71.86,69.74,69.73,69.05,69.63,70.48,72.49,72.66,74.77) > x <- c(1.35,1.91,1.31,1.19,1.3,1.14,1.1,1.02,1.11,1.18,1.24,1.36,1.29,1.73,1.41,1.15,1.31,1.15,1.08,1.1,1.14,1.24,1.33,1.49,1.38,1.96,1.36,1.24,1.35,1.23,1.09,1.08,1.33,1.35,1.38,1.5,1.47,2.09,1.52,1.29,1.52,1.27,1.35,1.29,1.41,1.39,1.45,1.53,1.45,2.11,1.53,1.38,1.54,1.35,1.29,1.33,1.47,1.47,1.54,1.59,1.5,2,1.51,1.4,1.62,1.44,1.29,1.28,1.4,1.39,1.46,1.49) > par7 = '0' > par6 = '1' > par5 = '0.0' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '0.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] -0.045462374 -0.098981834 0.073562567 -0.034191365 0.007662873 [6] 0.008733680 -0.018349139 0.075507553 0.026668247 0.049596941 [11] 0.070067563 0.091291420 0.067441281 0.124823065 -0.036105005 [16] 0.075349437 0.030077455 0.067252227 0.009216655 -0.018349139 [21] 0.154150680 0.084993213 0.036904557 0.006688988 0.063178902 [26] 0.064219593 0.111225635 0.039530839 0.118605742 0.032002731 [31] 0.213926896 0.177681177 0.058410762 0.029199155 0.049480057 [36] 0.019802627 -0.013698844 0.009523882 0.006557401 0.067441281 [41] 0.013072082 0.061087692 -0.045462374 0.030536724 0.041672696 [46] 0.055958654 0.060218860 0.038466281 0.033901552 -0.053540767 [51] -0.013158085 0.014388737 0.050643733 0.064538521 0.000000000 [56] -0.038318864 -0.048790164 -0.055958654 -0.053345981 -0.064957896 > y [1] 0.0029085161 0.0107669107 0.0132331978 -0.0056869741 0.0247084195 [6] 0.0151850819 -0.0043687269 0.0031224655 -0.0061292330 -0.0070511498 [11] -0.0115652303 -0.0137720177 -0.0050672492 -0.0075837184 -0.0180113464 [16] -0.0067042354 -0.0220357121 -0.0193021337 0.0078212689 -0.0013921762 [21] -0.0001393243 0.0055578856 -0.0186006342 -0.0028272566 0.0029684098 [26] 0.0081529830 0.0946354202 0.0325761704 0.0367902091 0.0023736066 [31] -0.0027301340 -0.0064393259 -0.0176205380 0.0108986305 0.0105428076 [36] -0.0107837134 -0.0078612003 -0.0042586911 -0.0021972665 -0.0115537175 [41] 0.0240622296 0.0050559877 -0.0078356136 -0.0135244218 0.0083069131 [46] -0.0028019754 -0.0045240647 0.0092706202 0.0023042882 -0.0156272256 [51] -0.0171262563 -0.0706572567 -0.0131162721 -0.0042283361 0.0000000000 [56] -0.0030116381 -0.0006857300 0.0050633020 0.0091039422 -0.0184292978 [61] -0.0080232828 0.0109124641 -0.0128588014 -0.0299457404 -0.0001434000 [66] -0.0097997614 0.0083646291 0.0121334727 0.0281196397 0.0023424055 [71] 0.0286257082 > postscript(file="/var/www/html/rcomp/tmp/19sz51293208238.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.177 0.241 -0.103 0.077 0.102 0.119 0.067 -0.024 0.114 -0.017 -0.120 -3 -2 -1 0 1 2 3 4 5 6 7 0.017 0.103 0.026 0.155 -0.018 0.110 0.180 0.350 0.366 0.236 0.158 8 9 10 11 12 13 14 0.097 -0.113 -0.120 -0.049 -0.048 0.050 -0.186 > 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/2ftvz1293208238.tab") > > try(system("convert tmp/19sz51293208238.ps tmp/19sz51293208238.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.387 0.199 2.651