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 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '1' > 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.016 0.040 -0.020 0.028 -0.050 -0.054 -0.028 0.062 0.088 0.119 [11] -0.075 -0.037 0.050 -0.045 -0.013 0.001 -0.004 0.035 0.012 -0.087 [21] -0.172 -0.030 0.085 -0.030 -0.020 -0.084 0.031 -0.034 -0.107 -0.081 [31] -0.098 0.120 -0.155 -0.100 -0.175 0.017 -0.064 0.008 -0.054 -0.019 [41] 0.005 0.154 0.022 -0.166 0.122 0.039 0.129 > y [1] -0.039 0.068 -0.357 -0.087 0.009 -0.176 0.285 -0.127 0.668 -0.064 [11] -0.124 -0.359 0.049 -0.058 0.025 -0.125 -0.239 0.126 -0.248 -0.067 [21] -0.791 -0.094 -0.067 -0.186 0.211 -0.310 0.339 0.275 0.025 -0.209 [31] -0.341 0.218 -0.845 -0.109 -0.558 0.159 -0.707 -0.085 -0.256 -0.337 [41] -0.370 0.486 0.044 -0.557 0.739 0.144 0.567 > postscript(file="/var/www/html/freestat/rcomp/tmp/1rxug1228242369.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.019 -0.261 -0.050 -0.011 0.129 -0.159 0.010 0.053 0.214 0.222 -0.071 -2 -1 0 1 2 3 4 5 6 7 8 0.129 -0.070 0.735 -0.039 0.020 -0.014 0.135 -0.014 -0.203 -0.054 -0.130 9 10 11 12 13 0.112 -0.079 -0.034 -0.224 0.058 > 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/2r6791228242369.tab") > > system("convert tmp/1rxug1228242369.ps tmp/1rxug1228242369.png") > > > proc.time() user system elapsed 0.543 0.219 0.617