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(-14,-7,-9,-9,-4,-3,1,-1,-2,1,-3,-2,0,-2,-4,-4,-7,-9,-13,-8,-13,-15,-15,-15,-10,-12,-11,-11,-17,-18,-19,-22,-24,-24,-20,-25,-22,-17,-9,-11,-13,-11,-9,-7,-3,-3,-6,-4,-8,-1,-2,-2,-1,1,2,2,-1,1,-1,-8) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > 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/16mh81321976458.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/2oa7h1321976458.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/3euh81321976458.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.8973776819 0.8266867513 0.7500845212 0.6531868299 [6] 0.5603129705 0.4439857714 0.3590351273 0.2674057519 0.1548586733 [11] 0.1007556784 0.0479438357 -0.0296643523 -0.0921209466 -0.1715232658 [16] -0.2367332811 -0.3293219463 -0.3837412476 -0.4196384774 -0.4759763583 [21] -0.5239606397 -0.5765650684 -0.5958795478 -0.5769054002 -0.5623128737 [26] -0.5040908093 -0.4608492221 -0.4060494890 -0.3272934372 -0.2698388047 [31] -0.1983111314 -0.1504286556 -0.0988853225 -0.0627528506 -0.0421764298 [36] -0.0079573522 0.0253750305 0.0629905125 0.0975207112 0.1183408434 [41] 0.1428944280 0.1580677138 0.1642651581 0.1765916865 0.1663515702 [46] 0.1677214533 0.1606910689 0.1357349283 0.1351914172 0.1054958664 [51] 0.0788181895 0.0598718700 0.0353720402 0.0109448054 -0.0061814562 [56] -0.0176608712 -0.0103537619 -0.0132929049 -0.0127371218 -0.0006698608 > (mypacf <- c(rpacf$acf)) [1] 8.973777e-01 1.099054e-01 -4.605411e-02 -1.546225e-01 -6.959318e-02 [6] -1.804837e-01 6.258774e-02 -5.094313e-02 -1.715741e-01 1.747678e-01 [11] 5.040824e-02 -2.122800e-01 -6.057494e-02 -1.553215e-01 -1.155234e-01 [16] -1.849985e-01 1.299811e-01 -1.523604e-02 -9.015631e-02 -7.810759e-02 [21] -2.244321e-01 -2.287766e-02 2.214636e-01 1.226683e-02 9.769255e-02 [26] -1.824730e-02 3.615687e-02 -1.090211e-02 -6.130876e-02 -9.037734e-02 [31] -1.030725e-01 1.215218e-01 -8.428185e-02 -2.999701e-02 8.315908e-03 [36] -9.135215e-02 -5.648093e-05 -6.773624e-02 -2.146751e-02 -5.381780e-02 [41] 1.365926e-02 -1.319240e-01 -1.102397e-01 5.137881e-02 4.285340e-02 [46] 4.747869e-02 -8.453202e-02 7.352021e-02 -7.634842e-02 -1.026757e-01 [51] 3.911835e-02 -2.231084e-02 -5.721796e-02 1.400688e-01 -5.501969e-02 [56] -7.578263e-03 -3.015432e-03 -3.324650e-02 -6.516691e-02 > 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/43jkm1321976458.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/5ic9q1321976458.tab") > > try(system("convert tmp/16mh81321976458.ps tmp/16mh81321976458.png",intern=TRUE)) character(0) > try(system("convert tmp/2oa7h1321976458.ps tmp/2oa7h1321976458.png",intern=TRUE)) character(0) > try(system("convert tmp/3euh81321976458.ps tmp/3euh81321976458.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.312 0.228 1.526