R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(2.4,2.4,2.5,2.6,2.4,2.6,2.4,2.3,2.4,2.4,2.4,2.4,2.4,2.4,2.4,2.4,2.5,2.1,2.1,2,2,2,1.9,1.9,2,1.8,1.6,1.3,1.4,1.4,1.5,1.7,1.6,1.5,1.6,1.5,1.1,1.1,1.1,1.4,1.3,1.4,1.3,1.1,1,0.9,0.8,0.8,0.8,0.8,1,1.1,1,0.9,1.1,1.2,1.2,1.4,1.5,1.7,1.9,1.9,1.9,1.7,1.7,2.1,2,2,2.5,2.4,2.5,2.5,2,1.9,2.2,2.7,3.1,2.8,2.6,2.3,2.2,2.2,2,2,2.6,2.5,2.5,2.3,2,1.9,2,2.1,2.1,2.3,2.3,2.3,2.1,2.4,2.5,2.1,1.8,1.9,1.9,2.1,2.2,2,2.2,2,1.9,1.6,1.7,2,2.5,2.4,2.3,2.3,2.1,2.4,2.2,2.4,1.9,2.1,2.1,2.1,2,2.1,2.2,2.2,2.6,2.5,2.3,2.2,2.4,2.3,2.2,2.5,2.5,2.5,2.4,2.3,1.7,1.6,1.9,1.9,1.8,1.8,1.9,1.9,1.9,1.9,1.8,1.7,2.1,2.6,3.1,3.1,3.2,3.3,3.6,3.3,3.7,4,4,3.8,3.6,3.2,2.1,1.6,1.1,1.2,0.6,0.6,0,-0.1,-0.6,-0.2,-0.3,-0.1,0.5,0.9) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > 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) > 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/www/rcomp/tmp/16blf1323203872.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/www/rcomp/tmp/2vfcd1323203872.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/www/rcomp/tmp/300jg1323203872.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.94186783 0.85988555 0.75565669 0.65283549 0.54672069 [7] 0.44557594 0.34500742 0.23983559 0.13666125 0.02907949 -0.07166914 [13] -0.17130394 -0.21823202 -0.23762462 -0.22529307 -0.20448840 -0.18114864 [19] -0.15695243 -0.13128708 -0.11007921 -0.09195762 -0.06944003 > (mypacf <- c(rpacf$acf)) [1] 0.941867831 -0.241214199 -0.210775396 0.018725613 -0.079847090 [6] -0.031272947 -0.069384894 -0.139943579 -0.045306296 -0.129875084 [11] -0.038097640 -0.100087896 0.393358671 0.064417633 0.060483026 [16] -0.026415708 -0.094128605 0.015483763 -0.002217657 -0.142640803 [21] -0.046582274 -0.016675106 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/43gv81323203872.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/rcomp/tmp/53u6t1323203872.tab") > > try(system("convert tmp/16blf1323203872.ps tmp/16blf1323203872.png",intern=TRUE)) character(0) > try(system("convert tmp/2vfcd1323203872.ps tmp/2vfcd1323203872.png",intern=TRUE)) character(0) > try(system("convert tmp/300jg1323203872.ps tmp/300jg1323203872.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.320 0.280 1.917