R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(7175,7048.75,6922.5,6670,9225,9098.75,7175,5897.5,6023.75,6023.75,6150,6416.25,5645,4872.5,4240,4240,6670,6922.5,4998.75,2822.5,3973.75,3973.75,4872.5,5391.25,5265,3973.75,4620,4366.25,6542.5,6023.75,3973.75,2442.5,3847.5,4240,4620,5125,4100,3215,3595,3721.25,7048.75,7048.75,5125,4872.5,5645,5265,6290,7567.5,7821.25,6023.75,5517.5,4998.75,8466.25,8720,8073.75,8720,8592.5,7567.5,8720,9997.5,10516.25,8972.5,7947.5,8720,12047.5,13072.5,12820,13325,13198.75,11921.25,14097.5,14616.25,15375,13072.5,12173.75,13198.75,15641.25,17817.5,17298.75,17298.75,17552.5,16666.25,18970,18970,18577.5,16400,16792.5,17046.25,18716.25,20892.5,19348.75,20121.25,19475,19096.25,22045,21398.75,20500,19222.5,20500,21146.25,21917.5,22942.5,21917.5,22550,21778.75,21652.5,24853.75,25120,24095,22297.5,23828.75,24473.75,25246.25,26397.5,25246.25,26145,25752.5,24347.5,27296.25,27296.25) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > par2 <- '1' > par1 <- 'Default' > 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) > x <- na.omit(x) > 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/1d0751470838374.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/2bbzu1470838374.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/323px1470838374.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.0000000 0.9664156 0.9316638 0.9118267 0.8973204 0.8876422 0.8738002 [8] 0.8465190 0.8150941 0.7876122 0.7708825 0.7656463 0.7542094 0.7157997 [15] 0.6767152 0.6512203 0.6321683 0.6163018 0.5978136 0.5669497 0.5316119 > (mypacf <- c(rpacf$acf)) [1] 0.966415594 -0.034755195 0.208418793 0.063766119 0.117390016 [6] -0.037902659 -0.169762487 -0.089848749 -0.040235975 0.096083851 [11] 0.158376526 -0.025335356 -0.334452315 -0.030766065 0.064341846 [16] 0.019979018 -0.002377645 0.007741283 -0.062072546 -0.037211079 > 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/4byjs1470838374.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/51b3y1470838374.tab") > > try(system("convert tmp/1d0751470838374.ps tmp/1d0751470838374.png",intern=TRUE)) character(0) > try(system("convert tmp/2bbzu1470838374.ps tmp/2bbzu1470838374.png",intern=TRUE)) character(0) > try(system("convert tmp/323px1470838374.ps tmp/323px1470838374.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.042 0.095 1.154