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(5740,5639,5538,5336,7380,7279,5740,4718,4819,4819,4920,5133,4516,3898,3392,3392,5336,5538,3999,2258,3179,3179,3898,4313,4212,3179,3696,3493,5234,4819,3179,1954,3078,3392,3696,4100,3280,2572,2876,2977,5639,5639,4100,3898,4516,4212,5032,6054,6257,4819,4414,3999,6773,6976,6459,6976,6874,6054,6976,7998,8413,7178,6358,6976,9638,10458,10256,10660,10559,9537,11278,11693,12300,10458,9739,10559,12513,14254,13839,13839,14042,13333,15176,15176,14862,13120,13434,13637,14973,16714,15479,16097,15580,15277,17636,17119,16400,15378,16400,16917,17534,18354,17534,18040,17423,17322,19883,20096,19276,17838,19063,19579,20197,21118,20197,20916,20602,19478,21837,21837) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > 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/1nure1312384306.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/20xi41312384306.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/3be731312384306.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.966415594 0.931663836 0.911826726 0.897320360 [6] 0.887642224 0.873800155 0.846519039 0.815094091 0.787612190 [11] 0.770882482 0.765646265 0.754209385 0.715799749 0.676715243 [16] 0.651220323 0.632168292 0.616301769 0.597813632 0.566949661 [21] 0.531611937 0.500930741 0.480796223 0.469309281 0.452553114 [26] 0.415318333 0.376305877 0.349466561 0.325371774 0.305218038 [31] 0.284924037 0.250773705 0.215135142 0.185300791 0.165622316 [36] 0.152000015 0.131166570 0.095611707 0.059587437 0.031897015 [41] 0.003853908 -0.016649137 -0.035910297 -0.066429730 -0.098184178 [46] -0.123797015 -0.138450384 -0.149949272 -0.167092087 -0.192106315 [51] -0.217688500 -0.236879422 -0.258907020 -0.273286676 -0.284196276 [56] -0.305297008 -0.327912750 -0.342906729 -0.349243458 -0.352475097 [61] -0.359955799 > (mypacf <- c(rpacf$acf)) [1] 0.9664155942 -0.0347551951 0.2084187928 0.0637661193 0.1173900155 [6] -0.0379026595 -0.1697624869 -0.0898487490 -0.0402359749 0.0960838510 [11] 0.1583765260 -0.0253353563 -0.3344523151 -0.0307660652 0.0643418465 [16] 0.0199790182 -0.0023776450 0.0077412830 -0.0620725463 -0.0372110790 [21] -0.0319343477 0.0104121367 0.0313089818 0.0166027967 -0.1334575381 [26] -0.0493943549 0.0187275088 -0.0742181946 0.0054346803 0.0172378994 [31] -0.0791847620 0.0277991607 -0.0187372213 0.0269870030 -0.0216455884 [36] -0.0428483020 -0.0545244434 -0.0319633758 -0.0302099684 -0.1229547127 [41] 0.0512335598 0.0200819773 -0.0025350832 0.0059017604 -0.0154601477 [46] 0.0582569295 -0.0405495704 -0.0097742176 0.0038925393 -0.0261531885 [51] 0.0057975455 -0.1352703795 0.0290102153 0.0169533930 0.0057889880 [56] 0.0095902163 0.0050568288 0.0528839330 -0.0002426836 -0.0034514508 > 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/405pw1312384306.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/5hd2v1312384306.tab") > > try(system("convert tmp/1nure1312384306.ps tmp/1nure1312384306.png",intern=TRUE)) character(0) > try(system("convert tmp/20xi41312384306.ps tmp/20xi41312384306.png",intern=TRUE)) character(0) > try(system("convert tmp/3be731312384306.ps tmp/3be731312384306.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.007 0.169 1.171