R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 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(516922,507561,492622,490243,469357,477580,528379,533590,517945,506174,501866,516141,528222,532638,536322,536535,523597,536214,586570,596594,580523,564478,557560,575093,580112,574761,563250,551531,537034,544686,600991,604378,586111,563668,548604,551174,555654,547970,540324,530577,520579,518654,572273,581302,563280,547612,538712,540735,561649,558685,545732,536352,527676,530455,581744,598714,583775,571477,563278,564872,577537,572399,565430,560619,551227,553397,610893,621668,613148,598778,590623,595902,612186,603453,593362,581940,568075,567467,619423,627325,617144,602280,590816,589812) > 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/10h081450686711.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/2qy2j1450686711.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/34v301450686711.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.0000000000 0.8418079295 0.6034821616 0.4623413814 0.4356473472 [6] 0.4686821017 0.4718119813 0.3902371638 0.2669963925 0.1881222319 [11] 0.2109851020 0.3315056483 0.4011272478 0.2459885764 0.0283662166 [16] -0.0955793776 -0.1159405284 -0.0779400064 -0.0593862711 -0.0996067944 [21] -0.1681418411 -0.1940535346 -0.1286804893 0.0225013208 0.1378798825 [26] 0.0635417670 -0.0776816702 -0.1519135421 -0.1442538631 -0.0874636193 [31] -0.0379340355 -0.0303051206 -0.0553013763 -0.0547428882 0.0067638275 [36] 0.1271986873 0.2238302521 0.1753879868 0.0649116221 0.0053623280 [41] 0.0031789486 0.0316965927 0.0513447884 0.0481680895 0.0152047533 [46] 0.0006994372 0.0303244181 0.1071512024 0.1676415316 > (mypacf <- c(rpacf$acf)) [1] 0.841807929 -0.360923399 0.295173833 0.130216435 0.139399883 [6] -0.043569682 -0.130982438 -0.046355906 0.043694415 0.165877652 [11] 0.261768576 -0.142728637 -0.589993370 0.129599189 -0.001478105 [16] -0.097536789 -0.021114025 -0.001961844 0.125313010 0.064498869 [21] 0.077629248 0.077369011 0.060019911 0.078944059 -0.132183261 [26] -0.003079377 -0.084716371 -0.055129500 -0.020069518 0.044347923 [31] 0.062524771 -0.001577620 0.070847736 -0.026761750 -0.032291398 [36] 0.054908706 0.025514815 -0.004480424 0.020332920 -0.028376041 [41] -0.028982012 -0.045058228 0.048163651 -0.071444718 0.013296193 [46] -0.020109427 0.026062785 -0.040288738 > 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/40y151450686711.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/5sai01450686711.tab") > > try(system("convert tmp/10h081450686711.ps tmp/10h081450686711.png",intern=TRUE)) character(0) > try(system("convert tmp/2qy2j1450686711.ps tmp/2qy2j1450686711.png",intern=TRUE)) character(0) > try(system("convert tmp/34v301450686711.ps tmp/34v301450686711.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.135 0.206 1.351