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. > x <- c(18450,21845,26488,22394,28057,25451,24872,33424,24052,28449,33533,37351,19969,21701,26249,24493,24603,26485,30723,34569,26689,26157,32064,38870,21337,19419,23166,28286,24570,24001,33151,24878,26804,28967,33311,40226,20504,23060,23562,27562,23940,24584,34303,25517,23494,29095,32903,34379,16991,21109,23740,25552,21752,20294,29009,25500,24166,26960,31222,38641,14672,17543,25453,32683,22449,22316,27595,25451,25421,25288,32568,35110,16052,22146,21198,19543,22084,23816,29961,26773,26635,26972,30207,38687,16974,21697,24179,23757,25013,24019,30345,24488,25156,25650,30923,37240,17466,19463,24352,26805,25236,24735,29356,31234,22724,28496,32857,37198) > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > if (par1 == 'Default') { + par1 = 10*log10(length(x)) + } else { + par1 <- as.numeric(par1) + } > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > if (par6 == 'White Noise') par6 <- 'white' else par6 <- 'ma' > par7 <- as.numeric(par7) > if (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } > if (par3 > 0) x <- diff(x,lag=1,difference=par3) > if (par4 > 0) x <- diff(x,lag=par5,difference=par4) > postscript(file="/var/www/html/rcomp/tmp/1djsf1272484488.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > racf <- acf(x, par1, main='Autocorrelation', xlab='time lag', ylab='ACF', ci.type=par6, ci=par7, sub=paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='')) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2djsf1272484488.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF') > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.132587229 -0.236192844 -0.077444390 0.151842979 [6] 0.007513866 -0.402292092 -0.007993653 0.117603649 -0.114416996 [11] -0.254408961 0.051351495 0.755687564 0.112771324 -0.207861843 [16] -0.089601120 0.126102789 -0.010243745 -0.374805457 -0.036552695 [21] 0.086802468 -0.121583639 -0.210691760 0.085342616 0.636186707 [26] 0.089474848 -0.165174016 -0.083695217 0.127977841 -0.038904602 [31] -0.347140994 -0.024271006 0.065362762 -0.153784706 -0.268447090 [36] 0.052836324 0.529765001 0.039486140 -0.168781194 -0.090815812 [41] 0.115321938 -0.054147237 -0.323845345 -0.022584778 0.101490922 [46] -0.107309050 -0.197498571 0.031328072 0.443272862 0.064468214 [51] -0.127422738 -0.079823121 0.082814604 -0.017306701 -0.223420157 [56] -0.052498300 0.018132544 -0.094886470 -0.152260717 0.029862157 [61] 0.347258456 > (mypacf <- c(rpacf$acf)) [1] 0.1325872286 -0.2583132013 -0.0041334500 0.1138460600 -0.0618106888 [6] -0.3705730330 0.1470008546 -0.0938379729 -0.1957600334 -0.1393173879 [11] 0.0877876907 0.6684951481 -0.1152204352 0.0226052860 -0.1252642441 [16] -0.0723358709 -0.0872664934 0.0002910675 -0.0682657919 -0.0164024541 [21] -0.0267852258 0.0945466838 0.1547603489 0.0848515033 -0.0739015446 [26] 0.0035622978 -0.1065285089 0.0264491580 -0.0997393018 -0.0080096920 [31] 0.0316390918 0.0167185679 -0.0581382227 -0.1577732076 -0.0869180499 [36] -0.0463767505 -0.0870282839 -0.0552351852 -0.0594903625 -0.0603056450 [41] 0.0031878136 -0.0114824719 -0.0603511011 0.0575327941 -0.0146059996 [46] 0.1457320844 -0.1326165774 -0.0564994482 0.0057307957 0.0047154592 [51] -0.0344819648 -0.0733784027 0.0432226634 0.1294237282 -0.0825023480 [56] -0.1863343954 -0.0059341488 -0.0903966608 0.0546626244 -0.0002716665 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #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,'Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','ACF(k)','click here for more information about the Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 2:(par1+1)) { + a<-table.row.start(a) + a<-table.element(a,i-1,header=TRUE) + a<-table.element(a,round(myacf[i],6)) + mytstat <- myacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3gjql1272484488.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Partial Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','PACF(k)','click here for more information about the Partial Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:par1) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,round(mypacf[i],6)) + mytstat <- mypacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/4k27r1272484488.tab") > > try(system("convert tmp/1djsf1272484488.ps tmp/1djsf1272484488.png",intern=TRUE)) character(0) > try(system("convert tmp/2djsf1272484488.ps tmp/2djsf1272484488.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.604 0.312 0.806