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(2851,2672,2755,2721,2946,3036,2282,2212,2922,4301,5764,7132,2541,2475,3031,3266,3776,3230,3028,1759,3595,4474,6838,8357,3113,3006,4047,3523,3937,3986,3260,1573,3528,5211,7614,9254,5375,3088,3718,4514,4520,4539,3663,1643,4734,5428,8314,10651,3633,4292,4154,4121,4647,4753,3965,1723,5048,6923,9858,11331,4016,3957,4510,4276,4968,4677,3523,1821,5222,6872,10803,13916,2639,2899,3370,3740,2927,3986,4217,1738,5221,6424,9842,13076,3934,3162,4286,4676,5010,4874,4633,1659,5951,6981,9851,12670) > 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/1f3dr1302539672.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/2fvd41302539672.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/37q3k1302539672.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.058676491 -0.202215992 -0.109786741 -0.289821595 [6] 0.124252390 0.158715615 0.157625115 -0.316617220 -0.105430713 [11] -0.197387036 -0.072595997 0.806612770 0.003475736 -0.176103815 [16] -0.107270768 -0.249182343 0.102095088 0.151345211 0.148416279 [21] -0.294274536 -0.081218985 -0.161143152 -0.057979496 0.633769954 [26] 0.008909334 -0.125128809 -0.104521004 -0.199065238 0.082627779 [31] 0.112164048 0.117139955 -0.218133662 -0.075383316 -0.125357697 [36] -0.014831596 0.495076279 -0.021166934 -0.102418403 -0.066367068 [41] -0.157887057 0.059319312 0.096549277 0.081423859 -0.163255155 [46] -0.050627654 -0.110257523 0.003751860 0.367810936 > (mypacf <- c(rpacf$acf)) [1] -0.0586764913 -0.2063694378 -0.1427602439 -0.3776506170 -0.0147886166 [6] -0.0083023593 0.1510052193 -0.4024615719 -0.0511566580 -0.4700162125 [11] -0.2814055586 0.5914417312 0.0889393458 -0.0051792460 0.0262838609 [16] -0.0310981420 0.0281997309 -0.0654045687 -0.1048803111 -0.0361529027 [21] 0.0492227842 0.0370261817 0.0984427740 -0.0589907521 -0.0815769339 [26] 0.0210044128 -0.0122653575 -0.0103497004 -0.0038107579 -0.1188502602 [31] -0.0600730974 0.1131202299 -0.0398626910 -0.0008019744 0.0672124091 [36] 0.0136304756 -0.0454092880 -0.0799917572 0.0061826917 0.0063960131 [41] -0.0554757377 0.0333612856 0.0410435029 0.0146834779 0.0357730751 [46] -0.0266592831 -0.0626352962 -0.0980974407 > 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/48cdt1302539672.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/52spk1302539672.tab") > > try(system("convert tmp/1f3dr1302539672.ps tmp/1f3dr1302539672.png",intern=TRUE)) character(0) > try(system("convert tmp/2fvd41302539672.ps tmp/2fvd41302539672.png",intern=TRUE)) character(0) > try(system("convert tmp/37q3k1302539672.ps tmp/37q3k1302539672.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.260 0.204 1.444