R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(621.0,604.0,584.0,574.0,555.0,545.0,599.0,620.0,608.0,590.0,579.0,580.0,579.0,572.0,560.0,551.0,537.0,541.0,588.0,607.0,599.0,578.0,563.0,566.0,561.0,554.0,540.0,526.0,512.0,505.0,554.0,584.0,569.0,540.0,522.0,526.0,527.0,516.0,503.0,489.0,479.0,475.0,524.0,552.0,532.0,511.0,492.0,492.0,493.0,481.0,462.0,457.0,442.0,439.0,488.0,521.0,501.0,485.0,464.0,460.0,467.0,460.0,448.0,443.0,436.0,431.0,484.0,510.0,513.0,503.0,471.0,471.0,476.0,475.0,470.0,461.0,455.0,456.0,517.0,525.0,523.0,519.0,509.0,512.0,519.0,517.0,510.0,509.0,501.0,507.0,569.0,580.0,578.0,565.0,547.0,555.0,562.0,561.0,555.0,544.0,537.0,543.0,594.0,611.0,613.0,611.0,594.0,595.0,591.0,589.0,584.0,573.0,567.0,569.0,621.0,629.0,628.0,612.0,595.0,597.0,593.0,590.0,580.0,574.0,573.0,573.0,620.0,626.0,620.0,588.0,566.0,557.0,561.0,549.0,532.0,526.0,511.0,499.0,555.0,565.0,542.0,527.0,510.0,514.0,517.0,508.0,493.0,490.0,469.0,478.0,528.0,534.0,518.0,506.0,502.0) > x <- c(67.8,66.9,71.5,75.9,71.9,70.7,73.5,76.1,82.5,87.1,83.2,86.1,85.9,77.4,74.4,69.9,73.8,69.2,69.7,71.0,71.2,75.8,73.0,66.4,58.6,55.5,52.6,54.9,54.6,51.2,50.9,49.6,53.4,52.0,47.5,42.1,44.5,43.2,51.4,59.4,60.3,61.4,68.8,73.6,81.8,79.6,85.8,88.1,89.1,95.0,96.2,84.2,96.9,103.1,99.3,103.5,112.4,111.1,113.7,92.0,93.0,98.4,92.6,94.6,99.5,97.6,91.3,93.6,93.1,78.4,70.2,69.3,71.1,73.5,85.9,91.5,91.8,88.3,91.3,94.0,99.3,96.7,88.0,96.7,106.8,114.3,105.7,90.1,91.6,97.7,100.8,104.6,95.9,102.7,104.0,107.9,113.8,113.8,123.1,125.1,137.6,134.0,140.3,152.1,150.6,167.3,153.2,142.0,154.4,158.5,180.9,181.3,172.4,192.0,199.3,215.4,214.3,201.5,190.5,196.0,215.7,209.4,214.1,237.8,239.0,237.8,251.5,248.8,215.4,201.2,203.1,214.2,188.9,203.0,213.3,228.5,228.2,240.9,258.8,248.5,269.2,289.6,323.4,317.2,322.8,340.9,368.2,388.5,441.2,474.3,483.9,417.9,365.9,263.0,199.4) > par7 = '1' > par6 = '1' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '2' > 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#output/ > #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.0523053307 -0.0046840510 -0.0740602991 0.0242257534 0.0363065289 [6] -0.0027412425 0.0295692899 -0.0173444100 -0.0641783648 0.0513545645 [11] -0.0234711461 -0.0656100729 0.0414595617 -0.0150336910 0.0760832269 [16] -0.0774040632 0.0467058931 0.0073660113 -0.0102407964 0.0389021218 [21] -0.0652002707 -0.0375341914 -0.0206609198 0.0463821230 0.0002630528 [26] 0.0647451267 -0.0324054471 -0.0395645131 0.0392707216 -0.0135214870 [31] 0.0672636419 -0.0676480861 -0.0433749628 -0.0212803724 0.1205637515 [36] -0.0583515626 0.1385446831 -0.0213791016 -0.0868626695 0.0019991882 [41] 0.0629734269 -0.0309352798 0.0243369299 -0.0859372308 0.0658108365 [46] -0.0313096948 -0.0097180186 0.0335859039 -0.0328383218 -0.0929120571 [51] 0.1745031382 -0.0504130486 -0.0628008797 0.0497693714 0.0255547014 [56] -0.0589160298 0.0216852262 -0.1477492128 0.1401976099 0.0288957730 [61] -0.0742808419 0.0520825005 0.0183880030 -0.0441428517 -0.0301624341 [66] 0.0581670343 -0.0192246784 -0.1067490927 0.0383335208 0.0633782795 [71] 0.0252022916 0.0048752768 0.0790168394 -0.0603232685 -0.0382475602 [76] -0.0268689975 0.0460946244 -0.0027793039 0.0161982446 -0.0515026575 [81] -0.0431920063 0.1199333606 0.0026148002 -0.0201840894 -0.0912876316 [86] -0.0521113025 0.1115198352 0.0303861860 -0.0211803002 0.0035628115 [91] -0.0780694469 0.0980399024 -0.0353468629 0.0151840048 0.0101530820 [96] -0.0332476688 0.0487362639 -0.0387846872 0.0485295697 -0.0747045559 [101] 0.0443109285 0.0209707702 -0.0550577841 0.0693560962 -0.1163552945 [106] 0.0069238499 0.0968652310 -0.0349779275 0.0633150888 -0.0778142913 [111] -0.0313138845 0.0939943253 -0.0419769476 0.0235558294 -0.0485651540 [116] -0.0331258299 0.0030020348 0.0499301389 0.0394130467 -0.0735716469 [121] 0.0303379277 0.0480723047 -0.0581537100 -0.0058233839 0.0352302481 [126] -0.0385322246 -0.0774181278 0.0436442729 0.0455148633 0.0256673800 [131] -0.1051483079 0.1164229640 -0.0134474954 0.0111041612 -0.0408892801 [136] 0.0321442784 0.0098876246 -0.0646165639 0.0692555287 -0.0043161761 [141] 0.0206890628 -0.0731521476 0.0207012316 0.0207032232 0.0122988855 [146] -0.0131879482 0.0399878090 -0.0304253022 -0.0283964284 -0.0904172328 [151] 0.0064517341 -0.1128982650 0.0252633798 > y [1] 10 8 1 5 14 -7 -2 4 -3 -4 2 -4 0 -2 -5 0 -11 2 [19] 11 -7 -8 -3 1 6 -4 1 0 4 3 0 -2 -5 8 -1 -4 0 [37] -1 -6 9 -5 1 0 5 0 5 -2 -4 6 5 7 0 8 -2 4 [55] -7 23 6 -11 4 -2 6 7 -4 1 6 8 -18 -5 6 22 3 2 [73] -1 -2 8 -2 5 1 3 0 -9 -8 5 0 1 1 -10 1 0 -11 [91] 6 4 11 1 -7 -11 -1 1 0 1 -4 1 -9 -3 -14 0 1 0 [109] -1 -5 5 5 -2 -5 -2 -5 -16 -5 -11 8 -9 -7 0 -14 -12 9 [127] 4 -17 17 5 13 -1 3 2 3 -6 21 -6 -4 7 3 13 > postscript(file="/var/www/html/rcomp/tmp/1dsaq1261242699.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 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -0.047 -0.098 -0.073 0.049 0.049 -0.013 -0.067 0.104 -0.045 0.012 0.018 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 -0.078 -0.056 0.145 -0.023 -0.075 0.016 0.089 -0.031 0.004 -0.025 0.124 4 5 6 7 8 9 10 11 12 13 14 -0.077 -0.089 0.032 0.037 -0.043 -0.008 0.120 -0.159 0.069 0.009 -0.002 15 16 17 18 -0.111 -0.017 0.049 0.130 > 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/2mas31261242699.tab") > > try(system("convert tmp/1dsaq1261242699.ps tmp/1dsaq1261242699.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.386 0.180 0.902