R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(9769,9321,9939,9336,10195,9464,10010,10213,9563,9890,9305,9391,9928,8686,9843,9627,10074,9503,10119,10000,9313,9866,9172,9241,9659,8904,9755,9080,9435,8971,10063,9793,9454,9759,8820,9403,9676,8642,9402,9610,9294,9448,10319,9548,9801,9596,8923,9746,9829,9125,9782,9441,9162,9915,10444,10209,9985,9842,9429,10132,9849,9172,10313,9819,9955,10048,10082,10541,10208,10233,9439,9963,10158,9225,10474,9757,10490,10281,10444,10640,10695,10786,9832,9747,10411,9511,10402,9701,10540,10112,10915,11183,10384,10834,9886,10216) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > 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 (par8 != '') par8 <- as.numeric(par8) > ox <- x > if (par8 == '') { + if (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } + } else { + x <- log(x,base=par8) + } > if (par3 > 0) x <- diff(x,lag=1,difference=par3) > if (par4 > 0) x <- diff(x,lag=par5,difference=par4) > postscript(file="/var/fisher/rcomp/tmp/1e3lv1354365138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > plot(ox,type='l',main='Original Time Series',xlab='time',ylab='value') > if (par8=='') { + mytitle <- paste('Working Time Series (lambda=',par2,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } else { + mytitle <- paste('Working Time Series (base=',par8,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(base=',par8,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } > plot(x,type='l', main=mytitle,xlab='time',ylab='value') > par(op) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/22hde1354365138.ps",horizontal=F,onefile=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=mysub) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/38lrl1354365138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF',sub=mysub) > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.00000000 0.22220763 0.11674536 0.20959044 0.18794028 0.31655172 [7] 0.25551138 0.13829627 0.17123905 0.34770766 0.12892453 0.07968606 [13] -0.01714185 0.03454974 0.33704523 0.13782803 0.05654400 0.12172949 [19] 0.11446041 -0.04049879 -0.04071382 0.01187038 -0.04275428 0.18395749 [25] -0.06860253 -0.12047010 -0.06399490 -0.03266388 -0.09122715 -0.12104408 [31] -0.16162554 -0.12180648 0.08256115 -0.07311334 -0.18140938 -0.12192540 [37] -0.18153187 -0.02602415 -0.01251801 -0.12035934 -0.09980738 -0.03393662 [43] -0.10756933 -0.07031768 -0.10241106 -0.15082073 -0.02534931 -0.06157330 [49] -0.14469569 -0.04333742 -0.12317799 -0.13153930 -0.06104554 -0.12645432 [55] -0.08598323 -0.01773640 -0.05545171 -0.09846139 -0.02888330 -0.01235548 [61] -0.01970143 > (mypacf <- c(rpacf$acf)) [1] 0.222207634 0.070868335 0.179457411 0.113076486 0.259103282 [6] 0.136407640 0.023812093 0.047306539 0.241832145 -0.079304491 [11] -0.071824402 -0.215246304 -0.086512419 0.215464797 0.002733699 [16] 0.029958261 0.100709488 0.052629236 -0.217464312 -0.189513782 [21] 0.006967983 -0.114735875 0.059769874 -0.144347036 -0.032606958 [26] 0.027467846 0.097418433 -0.101231079 -0.022236948 -0.107015681 [31] -0.133406236 0.023346023 0.145878846 0.032503312 0.060373052 [36] -0.067987058 0.020012310 0.103887163 0.042625209 -0.043465297 [41] -0.062934677 -0.042214001 0.031177614 -0.015911152 0.094153997 [46] -0.032343332 -0.057648422 -0.199910382 -0.003421234 -0.091995718 [51] 0.025911930 -0.028777627 -0.056954417 -0.018649115 0.013117822 [56] 0.042018177 0.083818340 0.038235108 0.064059849 -0.084936157 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/4uzf91354365139.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/fisher/rcomp/tmp/5tx501354365139.tab") > > try(system("convert tmp/1e3lv1354365138.ps tmp/1e3lv1354365138.png",intern=TRUE)) character(0) > try(system("convert tmp/22hde1354365138.ps tmp/22hde1354365138.png",intern=TRUE)) character(0) > try(system("convert tmp/38lrl1354365138.ps tmp/38lrl1354365138.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.803 0.474 2.258