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(105.71,105.82,105.82,105.72,105.76,105.8,105.09,105.06,105.16,105.2,105.21,105.23,105.19,105.16,104.88,104.52,104.09,104.35,104.48,104.47,104.55,104.59,104.59,104.72,104.65,104.72,104.92,105.05,103.74,103.81,103.79,104.28,103.8,103.8,104.02,104.02,104.91,104.97,103.86,104.17,103.21,103.21,101.91,101.84,101.91,101.79,101.79,101.79,102.09,102.18,102.2,101.97,102.05,102.04,101.78,101.79,101.8,101.83,101.83,101.88,101.9) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > 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/www/rcomp/tmp/1t6e81322165608.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/2c2a91322165608.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/3vwwk1322165608.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.1392104180 0.0949039476 -0.1102394105 0.0399812876 [6] 0.0004818513 -0.2454190641 -0.1339859336 -0.1288569554 -0.0313637242 [11] 0.2108040237 -0.2278238526 0.1916621048 0.0704907941 0.2240349241 [16] -0.1463345354 -0.0042764577 -0.0513522079 -0.0293740160 -0.0253929642 [21] -0.2077789908 -0.1012578743 0.1219561282 0.0105576207 0.0126686634 [26] -0.0456894748 0.1803492905 0.0195091010 0.0088386627 -0.0071579071 [31] -0.0821282678 -0.0271607708 0.0571072379 -0.0703431065 0.0303464207 [36] 0.0245040619 0.0865917881 -0.0280523886 -0.0079207536 0.0126533886 [41] 0.0035672120 -0.0302178962 -0.0261751279 -0.0134914365 -0.0082192762 [46] 0.0115661295 -0.0117469279 0.0078354306 0.0278590618 > (mypacf <- c(rpacf$acf)) [1] -0.139210418 0.077016960 -0.089580845 0.008159287 0.022773136 [6] -0.264724105 -0.211983052 -0.159277723 -0.132415448 0.205613088 [11] -0.210922646 0.033460732 0.107243874 0.084986128 -0.176268768 [16] 0.009250640 -0.090753634 -0.045446660 0.032980107 -0.207452458 [21] -0.088745217 0.069371599 -0.088736670 -0.128122261 0.038173605 [26] -0.067596435 -0.059728348 -0.060891751 -0.027121990 -0.054558640 [31] -0.114330538 0.001420368 0.017345891 0.091419709 -0.023645490 [36] -0.034824863 -0.008928431 -0.057039679 -0.077579360 -0.002480180 [41] -0.048713851 -0.038217597 0.077406377 -0.091415988 -0.042177134 [46] -0.017006389 -0.037100533 -0.079478051 > 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/480l01322165608.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/5och31322165608.tab") > > try(system("convert tmp/1t6e81322165608.ps tmp/1t6e81322165608.png",intern=TRUE)) character(0) > try(system("convert tmp/2c2a91322165608.ps tmp/2c2a91322165608.png",intern=TRUE)) character(0) > try(system("convert tmp/3vwwk1322165608.ps tmp/3vwwk1322165608.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.152 0.252 1.388