R version 2.7.0 (2008-04-22) 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(93.5,94.7,112.9,99.2,105.6,113,83.1,81.1,96.9,104.3,97.7,102.6,89.9,96,112.7,107.1,106.2,121,101.2,83.2,105.1,113.3,99.1,100.3,93.5,98.8,106.2,98.3,102.1,117.1,101.5,80.5,105.9,109.5,97.2,114.5,93.5,100.9,121.1,116.5,109.3,118.1,108.3,105.4,116.2,111.2,105.8,122.7,99.5,107.9,124.6,115,110.3,132.7,99.7,96.5,118.7,112.9,130.5,137.9,115,116.8,140.9,120.7,134.2,147.3,112.4,107.1,128.4,137.7,135,151,137.4,132.4,161.3,139.8,146,166.5,143.3,121,152.6,154.4,154.6,158) > x <- c(97.3,101,113.2,101,105.7,113.9,86.4,96.5,103.3,114.9,105.8,94.2,98.4,99.4,108.8,112.6,104.4,112.2,81.1,97.1,112.6,113.8,107.8,103.2,103.3,101.2,107.7,110.4,101.9,115.9,89.9,88.6,117.2,123.9,100,103.6,94.1,98.7,119.5,112.7,104.4,124.7,89.1,97,121.6,118.8,114,111.5,97.2,102.5,113.4,109.8,104.9,126.1,80,96.8,117.2,112.3,117.3,111.1,102.2,104.3,122.9,107.6,121.3,131.5,89,104.4,128.9,135.9,133.3,121.3,120.5,120.4,137.9,126.1,133.2,151.1,105,119,140.4,156.6,137.1,122.7) > par7 = '1' > par6 = '1' > par5 = '0.0' > par4 = '12' > par3 = '1' > par2 = '1' > par1 = '-1.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] -1.731865e-04 -1.225420e-04 8.625936e-04 -7.134797e-04 -8.944506e-06 [6] -4.029148e-04 5.263587e-04 4.601811e-04 -5.530879e-04 1.622917e-04 [11] 4.750828e-04 -2.810846e-04 -1.910469e-04 -1.716333e-04 -5.169320e-05 [16] -3.736030e-05 3.250013e-04 5.965705e-04 -1.401908e-03 8.450602e-04 [21] 2.273907e-04 -8.991463e-04 4.783752e-04 -6.215894e-04 4.401304e-04 [26] 7.292267e-04 -4.559251e-04 3.244710e-05 2.293693e-04 -4.409054e-04 [31] 6.851529e-04 -4.300505e-04 -4.058177e-04 9.843502e-04 -3.414843e-04 [36] -2.136251e-04 2.205601e-05 -5.166060e-04 1.334424e-04 1.749774e-04 [41] 2.624229e-05 -8.742683e-04 8.058680e-04 -1.779012e-04 -1.116356e-04 [46] 4.564818e-04 -1.736199e-04 3.378490e-04 -2.118119e-04 3.171535e-04 [51] -5.395506e-04 9.201464e-04 -6.032850e-04 6.109559e-04 -3.370250e-04 [56] 4.443592e-06 4.768696e-04 -3.241262e-04 -1.609448e-04 4.575814e-04 [61] -1.281767e-04 -2.559589e-04 3.034857e-04 -3.937196e-04 1.477623e-04 [66] 4.827235e-04 -3.506173e-04 -3.443516e-04 2.018182e-04 -4.637654e-04 [71] -6.911728e-05 > y [1] 0.052897686 -0.015407241 0.078398013 -0.070959226 0.062736989 [6] 0.128651328 -0.171489668 0.055668372 0.001535047 -0.068539924 [11] -0.036900120 0.061935733 -0.010514082 -0.088154726 -0.026333638 [16] 0.046367567 0.006609109 0.035722317 -0.035950205 0.040573138 [21] -0.041697594 0.014755889 0.151767858 -0.132409128 0.021032323 [26] 0.110260219 0.038574704 -0.101723576 -0.059640217 0.056342903 [31] 0.204659096 -0.176687860 -0.077411759 0.069373975 -0.015612279 [36] -0.006971321 0.004878737 -0.038582989 -0.041451100 0.022066676 [41] 0.107451687 -0.199298695 -0.005480151 0.109506085 -0.006114368 [46] 0.194650618 -0.093036274 0.027988051 -0.065516286 0.043683614 [51] -0.074565813 0.147751299 -0.091746916 0.015517878 -0.015678291 [56] -0.025668879 0.120023845 -0.164673383 0.056849500 0.087213199 [61] -0.052599678 0.009850993 0.011689135 -0.062629305 0.038248589 [66] 0.120352411 -0.120848829 0.050642159 -0.058200496 0.021097126 [71] -0.090251162 > postscript(file="/var/www/html/rcomp/tmp/1szqw1228235372.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 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -0.029 0.044 0.045 -0.088 -0.020 0.030 0.148 -0.156 -0.087 -0.003 0.325 -4 -3 -2 -1 0 1 2 3 4 5 6 -0.370 0.135 0.035 -0.229 0.472 -0.348 0.066 0.083 -0.034 -0.007 0.127 7 8 9 10 11 12 13 14 15 -0.235 0.131 0.138 -0.166 -0.017 0.077 -0.071 0.050 0.014 > 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/2z88h1228235372.tab") > > system("convert tmp/1szqw1228235372.ps tmp/1szqw1228235372.png") > > > proc.time() user system elapsed 1.171 0.280 1.229