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(11.836,11.85,11.897,12.082,11.936,11.928,12.646,12.747,12.447,12.445,12.257,12.878,13.69,13.665,13.78,13.608,13.375,13.376,13.918,14.304,13.877,14.543,14.291,14.788,15.241,15.265,15.322,15.175,14.817,14.579,15.247,15.385,14.891,14.766,14.42,14.85,15.117,15.352,15.099,15.291,15.208,14.995,15.454,15.251,14.975,14.005,13.55,13.422,13.848,13.376,13.038,12.974,12.554,11.971,12.916,12.757,11.924,11.693,11.382,11.821) > x <- c(3.253,3.233,3.196,3.138,3.091,3.17,3.378,3.468,3.33,3.413,3.356,3.525,3.633,3.597,3.6,3.522,3.503,3.532,3.686,3.748,3.672,3.843,3.905,3.999,4.07,4.084,4.042,3.951,3.933,3.958,4.147,4.221,4.058,4.057,4.089,4.268,4.309,4.303,4.177,4.117,4.065,3.983,4.091,4.067,4.024,3.868,3.8,3.804,3.862,3.792,3.674,3.56,3.489,3.412,3.674,3.672,3.463,3.429,3.4,3.533) > par7 = '0' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '1' > 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] -0.020 -0.037 -0.058 -0.047 0.079 0.208 0.090 -0.138 0.083 -0.057 [11] 0.169 0.108 -0.036 0.003 -0.078 -0.019 0.029 0.154 0.062 -0.076 [21] 0.171 0.062 0.094 0.071 0.014 -0.042 -0.091 -0.018 0.025 0.189 [31] 0.074 -0.163 -0.001 0.032 0.179 0.041 -0.006 -0.126 -0.060 -0.052 [41] -0.082 0.108 -0.024 -0.043 -0.156 -0.068 0.004 0.058 -0.070 -0.118 [51] -0.114 -0.071 -0.077 0.262 -0.002 -0.209 -0.034 -0.029 0.133 > y [1] 0.014 0.047 0.185 -0.146 -0.008 0.718 0.101 -0.300 -0.002 -0.188 [11] 0.621 0.812 -0.025 0.115 -0.172 -0.233 0.001 0.542 0.386 -0.427 [21] 0.666 -0.252 0.497 0.453 0.024 0.057 -0.147 -0.358 -0.238 0.668 [31] 0.138 -0.494 -0.125 -0.346 0.430 0.267 0.235 -0.253 0.192 -0.083 [41] -0.213 0.459 -0.203 -0.276 -0.970 -0.455 -0.128 0.426 -0.472 -0.338 [51] -0.064 -0.420 -0.583 0.945 -0.159 -0.833 -0.231 -0.311 0.439 > postscript(file="/var/www/html/rcomp/tmp/1ihxn1228241103.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.043 0.124 0.434 -0.041 -0.252 -0.114 -0.055 0.263 0.353 0.278 -0.146 -3 -2 -1 0 1 2 3 4 5 6 7 -0.183 -0.005 0.175 0.852 -0.027 -0.306 -0.095 0.039 0.245 0.280 0.163 8 9 10 11 12 13 14 -0.204 -0.130 -0.005 0.193 0.404 -0.003 -0.257 > 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/29h7g1228241103.tab") > > system("convert tmp/1ihxn1228241103.ps tmp/1ihxn1228241103.png") > > > proc.time() user system elapsed 0.419 0.184 0.600