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(655362,873127,1107897,1555964,1671159,1493308,2957796,2638691,1305669,1280496,921900,867888,652586,913831,1108544,1555827,1699283,1509458,3268975,2425016,1312703,1365498,934453,775019,651142,843192,1146766,1652601,1465906,1652734,2922334,2702805,1458956,1410363,1019279,936574,708917,885295,1099663,1576220,1487870,1488635,2882530,2677026,1404398,1344370,936865,872705,628151,953712,1160384,1400618,1661511,1495347,2918786,2775677,1407026,1370199,964526,850851,683118,847224,1073256,1514326,1503734,1507712,2865698,2788128,1391596,1366378,946295,859626) > par8 = '2' > 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/www/rcomp/tmp/1ibt71323200052.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/2oawr1323200052.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/3mi3w1323200052.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.663664316 0.294956345 -0.006926191 -0.367115624 [6] -0.652936558 -0.799622558 -0.639245296 -0.315997876 0.010407189 [11] 0.290080606 0.587897420 0.821916511 0.554831718 0.254019580 [16] 0.004817519 -0.292861397 -0.525597100 -0.650950920 -0.525294380 [21] -0.259283170 -0.009723333 0.227197302 0.470846797 0.650560418 [26] 0.447939182 0.196934403 0.008928511 -0.210636380 -0.406748758 [31] -0.502797832 -0.408351633 -0.211115589 -0.007341541 0.172363729 [36] 0.342872784 0.494990876 0.342068071 0.153596515 0.013388016 [41] -0.157823772 -0.296415198 -0.370952136 -0.299961002 -0.159050732 [46] -0.005336422 0.126830627 0.237767099 0.336240695 > (mypacf <- c(rpacf$acf)) [1] 0.6636643156 -0.2600197706 -0.1552786795 -0.4324078470 -0.3755048385 [6] -0.4932650849 -0.1549784898 -0.1264198248 -0.1110257198 -0.3105088789 [11] -0.0262587196 0.3507702782 -0.4794418848 -0.0224305899 -0.0992681486 [16] 0.0787362358 -0.0466046515 0.0710785474 -0.0558012954 -0.0528173878 [21] -0.0372883312 0.0281422328 0.0145298138 0.0425453346 -0.0498551591 [26] -0.1152532966 0.0001644054 0.0709357802 -0.0303823603 0.0807787296 [31] -0.0328052558 -0.0604794195 0.0973392934 0.0021034210 -0.0465555316 [36] 0.0744346066 -0.0191677668 0.0573536648 -0.0647645643 0.0138412078 [41] 0.0524918060 0.0065463505 0.0874607650 -0.0253723934 0.0438445237 [46] 0.0085556040 0.0230429468 -0.1489555104 > 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/4gbtf1323200052.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/5vbia1323200052.tab") > > try(system("convert tmp/1ibt71323200052.ps tmp/1ibt71323200052.png",intern=TRUE)) character(0) > try(system("convert tmp/2oawr1323200052.ps tmp/2oawr1323200052.png",intern=TRUE)) character(0) > try(system("convert tmp/3mi3w1323200052.ps tmp/3mi3w1323200052.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.432 0.268 1.925