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(336766 + ,332201 + ,323529 + ,320287 + ,314768 + ,316870 + ,347093 + ,358764 + ,356615 + ,352559 + ,342807 + ,344952 + ,346958 + ,338371 + ,328380 + ,323111 + ,314764 + ,312235 + ,342631 + ,353912 + ,345948 + ,334046 + ,326268 + ,325939 + ,323758 + ,319275 + ,313328 + ,308612 + ,301096 + ,305610 + ,333005 + ,343322 + ,337653 + ,325595 + ,316726 + ,317578 + ,314484 + ,310166 + ,301792 + ,294495 + ,287256 + ,286224 + ,313654 + ,329656 + ,319784 + ,301995 + ,291228 + ,293041 + ,291908 + ,285121 + ,278310 + ,271158 + ,266586 + ,266426 + ,294354 + ,309380 + ,297710 + ,285409 + ,274580 + ,274402 + ,274452 + ,267700 + ,257841 + ,255124 + ,247377 + ,247823 + ,276919 + ,294271 + ,281758 + ,270434 + ,258848 + ,256674 + ,258882 + ,255060 + ,247698 + ,244779 + ,240901 + ,239933 + ,270247 + ,283893 + ,282348 + ,273570 + ,254756 + ,254354 + ,255843 + ,254490 + ,251995 + ,246339 + ,244019 + ,245953 + ,279806 + ,283111 + ,281097 + ,275964 + ,270694 + ,271901 + ,274412 + ,272433 + ,268361 + ,268586 + ,264768 + ,269974 + ,304744 + ,309365 + ,308347 + ,298427 + ,289231 + ,291975 + ,294912 + ,293488 + ,290555 + ,284736 + ,281818 + ,287854 + ,316263 + ,325412 + ,326011 + ,328282 + ,317480 + ,317539 + ,313737 + ,312276 + ,309391 + ,302950 + ,300316 + ,304035 + ,333476 + ,337698 + ,335932 + ,323931 + ,313927 + ,314485 + ,313218 + ,309664 + ,302963 + ,298989 + ,298423 + ,301631 + ,329765 + ,335083 + ,327616 + ,309119 + ,295916 + ,291413 + ,291542 + ,284678 + ,276475 + ,272566 + ,264981 + ,263290 + ,296806 + ,303598 + ,286994 + ,276427 + ,266424 + ,267153 + ,268381 + ,262522 + ,255542 + ,253158 + ,243803 + ,250741 + ,280445 + ,285257 + ,270976 + ,261076) > x <- c(263151 + ,259372 + ,251960 + ,246936 + ,240570 + ,238382 + ,261156 + ,272095 + ,272017 + ,271876 + ,266863 + ,270878 + ,274212 + ,265841 + ,255968 + ,250606 + ,240470 + ,232662 + ,256235 + ,266169 + ,261751 + ,255914 + ,252397 + ,254227 + ,255699 + ,252285 + ,247132 + ,242785 + ,235667 + ,234952 + ,255179 + ,263727 + ,261315 + ,252049 + ,245914 + ,248289 + ,246790 + ,243978 + ,238108 + ,231776 + ,224585 + ,219058 + ,240429 + ,254569 + ,249074 + ,237521 + ,230384 + ,232521 + ,234611 + ,230592 + ,225144 + ,218143 + ,212434 + ,208676 + ,229328 + ,242148 + ,233916 + ,225628 + ,217837 + ,217786 + ,218413 + ,213261 + ,204094 + ,201484 + ,194600 + ,191325 + ,211261 + ,226293 + ,219734 + ,214591 + ,205348 + ,203496 + ,208155 + ,205010 + ,200290 + ,198088 + ,195186 + ,191395 + ,213768 + ,225780 + ,230579 + ,229261 + ,216228 + ,216713 + ,220206 + ,220115 + ,218444 + ,214912 + ,210705 + ,209673 + ,237041 + ,242081 + ,241878 + ,242621 + ,238545 + ,240337 + ,244752 + ,244576 + ,241572 + ,240541 + ,236089 + ,236997 + ,264579 + ,270349 + ,269645 + ,267037 + ,258113 + ,262813 + ,267413 + ,267366 + ,264777 + ,258863 + ,254844 + ,254868 + ,277267 + ,285351 + ,286602 + ,283042 + ,276687 + ,277915 + ,277128 + ,277103 + ,275037 + ,270150 + ,267140 + ,264993 + ,287259 + ,291186 + ,292300 + ,288186 + ,281477 + ,282656 + ,280190 + ,280408 + ,276836 + ,275216 + ,274352 + ,271311 + ,289802 + ,290726 + ,292300 + ,278506 + ,269826 + ,265861 + ,269034 + ,264176 + ,255198 + ,253353 + ,246057 + ,235372 + ,258556 + ,260993 + ,254663 + ,250643 + ,243422 + ,247105 + ,248541 + ,245039 + ,237080 + ,237085 + ,225554 + ,226839 + ,247934 + ,248333 + ,246969 + ,245098) > par7 = '0' > par6 = '0' > par5 = '1' > par4 = '12' > par3 = '0' > par2 = '0' > 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] 263150 259371 251959 246935 240569 238381 261155 272094 272016 271875 [11] 266862 270877 274211 265840 255967 250605 240469 232661 256234 266168 [21] 261750 255913 252396 254226 255698 252284 247131 242784 235666 234951 [31] 255178 263726 261314 252048 245913 248288 246789 243977 238107 231775 [41] 224584 219057 240428 254568 249073 237520 230383 232520 234610 230591 [51] 225143 218142 212433 208675 229327 242147 233915 225627 217836 217785 [61] 218412 213260 204093 201483 194599 191324 211260 226292 219733 214590 [71] 205347 203495 208154 205009 200289 198087 195185 191394 213767 225779 [81] 230578 229260 216227 216712 220205 220114 218443 214911 210704 209672 [91] 237040 242080 241877 242620 238544 240336 244751 244575 241571 240540 [101] 236088 236996 264578 270348 269644 267036 258112 262812 267412 267365 [111] 264776 258862 254843 254867 277266 285350 286601 283041 276686 277914 [121] 277127 277102 275036 270149 267139 264992 287258 291185 292299 288185 [131] 281476 282655 280189 280407 276835 275215 274351 271310 289801 290725 [141] 292299 278505 269825 265860 269033 264175 255197 253352 246056 235371 [151] 258555 260992 254662 250642 243421 247104 248540 245038 237079 237084 [161] 225553 226838 247933 248332 246968 245097 > y [1] 336765 332200 323528 320286 314767 316869 347092 358763 356614 352558 [11] 342806 344951 346957 338370 328379 323110 314763 312234 342630 353911 [21] 345947 334045 326267 325938 323757 319274 313327 308611 301095 305609 [31] 333004 343321 337652 325594 316725 317577 314483 310165 301791 294494 [41] 287255 286223 313653 329655 319783 301994 291227 293040 291907 285120 [51] 278309 271157 266585 266425 294353 309379 297709 285408 274579 274401 [61] 274451 267699 257840 255123 247376 247822 276918 294270 281757 270433 [71] 258847 256673 258881 255059 247697 244778 240900 239932 270246 283892 [81] 282347 273569 254755 254353 255842 254489 251994 246338 244018 245952 [91] 279805 283110 281096 275963 270693 271900 274411 272432 268360 268585 [101] 264767 269973 304743 309364 308346 298426 289230 291974 294911 293487 [111] 290554 284735 281817 287853 316262 325411 326010 328281 317479 317538 [121] 313736 312275 309390 302949 300315 304034 333475 337697 335931 323930 [131] 313926 314484 313217 309663 302962 298988 298422 301630 329764 335082 [141] 327615 309118 295915 291412 291541 284677 276474 272565 264980 263289 [151] 296805 303597 286993 276426 266423 267152 268380 262521 255541 253157 [161] 243802 250740 280444 285256 270975 261075 > postscript(file="/var/www/html/freestat/rcomp/tmp/15ed71228247734.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 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 0.282 0.306 0.306 0.304 0.329 0.403 0.521 0.622 0.614 0.551 0.504 0.492 0.513 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 0.525 0.513 0.494 0.504 0.562 0.668 0.752 0.704 0.604 0.523 0.479 0.469 0.455 7 8 9 10 11 12 13 14 15 16 17 18 19 0.409 0.354 0.330 0.353 0.419 0.460 0.390 0.277 0.181 0.123 0.100 0.076 0.025 > 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/2be891228247734.tab") > > system("convert tmp/15ed71228247734.ps tmp/15ed71228247734.png") > > > proc.time() user system elapsed 0.564 0.209 0.614