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(2.282,2.266,1.878,2.267,2.069,1.746,2.299,2.36,2.214,2.825,2.355,2.333,3.016,2.155,2.172,2.15,2.533,2.058,2.16,2.259,2.498,2.695,2.799,2.945,2.93,2.318,2.54,2.57,2.669,2.45,2.842,3.439,2.677,2.979,2.257,2.842,2.546,2.455,2.293,2.379,2.478,2.054,2.272,2.351,2.271,2.542,2.304,2.194,2.722,2.395,2.146,1.894,2.548,2.087,2.063,2.481,2.476,2.212,2.834,2.148,2.598) > x <- c(507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478) > par7 = '0' > par6 = '1' > par5 = '-0.1' > par4 = '12' > par3 = '1' > par2 = '1' > par1 = '2.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] -4362.5 3923.0 2382.0 6205.5 -234.5 -3813.5 -6281.5 -618.5 415.5 [10] -319.0 363.5 -2104.0 1946.5 -5242.5 -1852.5 -8696.0 -17.0 597.5 [19] -8.0 -594.5 -2917.5 2901.5 2846.5 -1136.0 -2904.5 -1262.0 -3109.5 [28] -9408.0 -2434.5 -6245.5 4616.0 -4885.5 -3338.5 288.0 -7204.0 -6060.0 [37] 1476.5 1862.0 -8992.5 11310.5 3879.5 7101.5 -689.5 2047.5 1681.0 [46] 1699.5 -2292.0 10321.5 > y [1] -0.006481157 -0.174692598 0.175099143 -0.084595831 -0.159181982 [6] 0.256684111 0.024064094 -0.058793662 0.222366773 -0.165519696 [11] -0.008619320 0.232916272 -0.306124191 0.007274094 -0.009425551 [16] 0.150618014 -0.191217212 0.044896629 0.041399560 0.092233133 [21] 0.069004886 0.034225416 0.045757052 -0.004584761 -0.212901571 [26] 0.083701300 0.010690476 0.034328487 -0.077943472 0.134696689 [31] 0.170134460 -0.224175041 0.096351148 -0.252334660 0.210024093 [36] -0.099623012 -0.033209873 -0.062615374 0.033824781 0.037310645 [41] -0.173001226 0.093394092 0.031433492 -0.031839053 0.103270357 [46] -0.089989520 -0.045113270 0.197211662 -0.116532712 -0.101150748 [51] -0.116457031 0.274178930 -0.183586418 -0.010752190 0.170038529 [56] -0.001842309 -0.103557499 0.226068079 -0.253227085 0.174539696 > postscript(file="/var/www/html/rcomp/tmp/1wth11227980524.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.010 -0.024 0.062 -0.043 -0.035 0.175 0.019 0.032 -0.033 0.159 -0.069 -2 -1 0 1 2 3 4 5 6 7 8 0.052 -0.002 -0.066 0.083 -0.067 0.214 -0.170 0.057 -0.135 0.040 -0.213 9 10 11 12 13 -0.093 -0.005 0.168 -0.088 0.012 > 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/21inj1227980525.tab") > > system("convert tmp/1wth11227980524.ps tmp/1wth11227980524.png") > > > proc.time() user system elapsed 0.391 0.162 0.497