R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(18.3,18.6,18.7,20.1,18.9,20.1,19.8,15.9,19.9,19.6,15.6,14.2,13.6,13.9,15,14.1,13.5,15.3,14.7,12.5,16.1,15.9,15.9,15.7,14.7,15.3,18.4,16.8,16.5,19.3,17.1,15.7,19.1,18.6,18.4,17.1,18.3,19.4,22.3,19.4,21.3,20.3,19.3,17.5,19.9,19.6,19.7,18.1,19.1,20.7,22.5,20,20.2,20.4,19.6,18.1,19.3,21,19.9,17.7,19.4,19.3,21.5,20.9,20.8,20.3,21.4,17.4,21.1,22,20.4,19) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '48' > 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/wessaorg/rcomp/tmp/1rgin1413375975.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/wessaorg/rcomp/tmp/2m12e1413375975.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/wessaorg/rcomp/tmp/3utik1413375975.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.000000000 0.719511663 0.610099424 0.632446539 0.602608572 [6] 0.517959500 0.513351004 0.387634505 0.402291704 0.313519527 [11] 0.190731742 0.253958125 0.363045861 0.166418517 0.083233801 [16] 0.062419215 0.065541539 0.031580469 0.021057282 -0.048498285 [21] -0.004766657 -0.096033967 -0.169761722 -0.110224862 -0.028501775 [26] -0.160877414 -0.211469974 -0.216315712 -0.142609772 -0.164790545 [31] -0.156702498 -0.164395142 -0.144314098 -0.207554116 -0.235158734 [36] -0.207036001 -0.154469150 -0.214158718 -0.296132681 -0.261228096 [41] -0.204652672 -0.218145476 -0.203087420 -0.202803820 -0.198233501 [46] -0.212781623 -0.223051206 -0.208582165 -0.149184378 > (mypacf <- c(rpacf$acf)) [1] 0.719511663 0.191585780 0.300744294 0.105610109 -0.033075383 [6] 0.087706649 -0.246589244 0.160109601 -0.231338045 -0.145609001 [11] 0.269841016 0.256778637 -0.283338979 -0.188319075 -0.125388251 [16] 0.091974714 -0.013387554 0.073882772 -0.005462372 -0.001083775 [21] -0.088523753 -0.040784517 -0.019819707 0.016509559 -0.100168126 [26] -0.024297750 0.043433569 0.184794536 -0.082943782 0.023973103 [31] -0.025871781 -0.187059177 -0.008547554 -0.037884305 -0.027540617 [36] -0.089821122 0.097003345 -0.063534193 0.110936938 -0.083336048 [41] 0.035917555 -0.064069219 -0.056674552 -0.013284749 0.023094630 [46] 0.023059628 -0.052529244 -0.078700711 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/49olt1413375975.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/wessaorg/rcomp/tmp/5mxi11413375975.tab") > > try(system("convert tmp/1rgin1413375975.ps tmp/1rgin1413375975.png",intern=TRUE)) character(0) > try(system("convert tmp/2m12e1413375975.ps tmp/2m12e1413375975.png",intern=TRUE)) character(0) > try(system("convert tmp/3utik1413375975.ps tmp/3utik1413375975.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.218 0.228 1.454