R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(940,950,920,930,930,900,940,840,890,850,830,940,960,900,940,920,930,970,930,780,810,870,720,880,920,920,950,950,890,960,780,780,760,860,740,1020,890,1040,920,900,950,990,840,740,840,960,790,1010,900,970,920,980,890,1000,880,740,860,940,760,1010,870,980,920,950,880,980,910,730,880,820,690,990,800,960,910,950,940,1010,890,660,860,840,740,980,820,1080,930,970,930,1010,880,740,860,810,750,890,790,1000,890,970,900,990,910,730,850,840,830,950) > 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/16ghi1343560358.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/2axfh1343560358.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/38hon1343560358.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.049754157 0.223511864 0.029130232 -0.177859990 [6] -0.341657563 -0.279037206 -0.352349183 -0.164451537 0.070545847 [11] 0.175364192 0.052648297 0.778171349 -0.010195084 0.203270378 [16] -0.026024597 -0.144525703 -0.282297486 -0.262411804 -0.318327935 [21] -0.176692793 0.050519037 0.060579750 0.050933281 0.627020928 [26] -0.011122958 0.186893046 -0.019445995 -0.106625990 -0.222200357 [31] -0.173719940 -0.257436508 -0.173370098 0.046707360 0.017847460 [36] 0.043937254 0.500450818 0.016085931 0.172676777 0.035856721 [41] -0.006778171 -0.152271105 -0.132736059 -0.250435711 -0.153431543 [46] 0.036691569 -0.031375178 0.076555958 0.401344821 > (mypacf <- c(rpacf$acf)) [1] 4.975416e-02 2.215849e-01 9.961543e-03 -2.412986e-01 -3.749582e-01 [6] -2.355012e-01 -2.534085e-01 -1.472875e-01 8.245529e-02 1.381138e-01 [11] -2.466596e-01 6.457841e-01 -1.654010e-01 -9.099204e-02 -4.330956e-02 [16] 9.484812e-02 5.732865e-02 -1.150692e-01 -3.274743e-02 -1.220252e-01 [21] -1.043110e-01 -1.998978e-01 2.100289e-03 7.566949e-02 -2.834601e-02 [26] -1.782906e-01 -2.498524e-02 -2.785799e-02 -3.431427e-02 1.626935e-01 [31] 8.305594e-02 -9.186291e-02 -1.632583e-01 5.049879e-02 4.231761e-05 [36] -7.551566e-03 8.195286e-02 -1.325052e-02 1.021567e-02 4.960044e-02 [41] 1.798663e-02 -8.145898e-02 -1.003452e-01 1.028654e-01 1.189471e-01 [46] -5.199672e-02 7.251549e-02 -7.438106e-03 > 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/490051343560358.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/5k3qg1343560358.tab") > > try(system("convert tmp/16ghi1343560358.ps tmp/16ghi1343560358.png",intern=TRUE)) character(0) > try(system("convert tmp/2axfh1343560358.ps tmp/2axfh1343560358.png",intern=TRUE)) character(0) > try(system("convert tmp/38hon1343560358.ps tmp/38hon1343560358.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.171 0.306 1.506