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(10772.8,9987.7,8638.7,11063.7,11855.7,10684.5,11337.4,10478,11123.9,12909.3,11339.9,10462.2,12733.5,10519.2,10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16213.3,15544.5,14750.6,17292.7,17568.5,17930.8,18644.7,16694.8,17242.8) > x <- c(12192.5,11268.8,9097.4,12639.8,13040.1,11687.3,11191.7,11391.9,11793.1,13933.2,12778.1,11810.3,13698.4,11956.6,10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17157.3,16159.1,13405.7,17224.7,17338.4,17370.6,18817.8,16593.2,17979.5) > par7 = '1' > par6 = '0' > par5 = '-0.3' > par4 = '12' > par3 = '1' > par2 = '0' > par1 = '-0.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.0451891071 0.0232371220 0.0655611464 0.0378606742 0.0268826733 [6] 0.0647969059 0.0577409213 0.0366125851 0.0359983466 0.0259629323 [11] 0.0289920756 0.0377746747 0.0097616928 -0.0046119282 0.0306977935 [16] 0.0142729071 -0.0101676028 0.0249536206 0.0261164831 0.0303286335 [21] 0.0189750681 0.0309547815 -0.0146204298 0.0480824754 0.0372796225 [26] 0.0417724782 0.0331853671 0.0146818793 0.0485323048 0.0175889147 [31] -0.0221920536 0.0324113567 0.0165434499 0.0007500509 0.0315694129 [36] 0.0102058781 0.0114617664 0.0335818549 0.0182856595 0.0043084620 [41] 0.0396833211 0.0176091601 0.0087539986 0.0597979027 0.0765360534 [46] 0.0263233311 0.1015498956 0.0348301556 0.0449956805 > y [1] 0.0100628546 0.0032472646 0.0119880634 0.0072265775 0.0025996581 [6] 0.0083672769 0.0077859288 0.0056962869 0.0052821218 0.0043534227 [11] 0.0065667050 0.0085325437 0.0020987866 0.0020925623 0.0050287974 [16] 0.0052095388 0.0006282575 0.0076129940 0.0057441384 0.0092075772 [21] 0.0064914243 0.0085297450 0.0014318265 0.0091537443 0.0043343436 [26] 0.0069828215 0.0064210609 0.0020033286 0.0073454722 0.0015925726 [31] -0.0047472658 0.0011862054 0.0002378998 -0.0029136217 0.0014882224 [36] 0.0012411334 0.0026107372 0.0080520122 0.0017006158 0.0008526388 [41] 0.0073395245 0.0043607352 0.0065938534 0.0128520949 0.0140872338 [46] 0.0083169672 0.0185798003 0.0082149184 0.0079614939 > postscript(file="/var/www/html/rcomp/tmp/15wol1228765520.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.116 0.012 -0.093 -0.203 0.041 -0.070 -0.242 0.007 -0.057 -0.034 0.286 -2 -1 0 1 2 3 4 5 6 7 8 0.207 0.144 0.862 0.191 0.275 0.427 0.170 0.036 0.219 -0.080 0.001 9 10 11 12 13 0.068 -0.229 -0.233 -0.132 -0.342 > 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/2f9n41228765521.tab") > > system("convert tmp/15wol1228765520.ps tmp/15wol1228765520.png") > > > proc.time() user system elapsed 0.412 0.175 0.951