R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-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(1165010 + ,1160665 + ,1156265 + ,1147162.5 + ,1237238.75 + ,1232481.25 + ,1165010 + ,1120157.5 + ,1124488.75 + ,1124488.75 + ,1129328.75 + ,1138005 + ,1151507.5 + ,1151507.5 + ,1142831.25 + ,1120157.5 + ,1237238.75 + ,1255086.25 + ,1228136.25 + ,1165010 + ,1192015 + ,1151507.5 + ,1169781.25 + ,1178512.5 + ,1187615 + ,1165010 + ,1169781.25 + ,1138005 + ,1237238.75 + ,1268588.75 + ,1241638.75 + ,1192015 + ,1245983.75 + ,1187615 + ,1241638.75 + ,1237238.75 + ,1250755 + ,1201131.25 + ,1255086.25 + ,1250755 + ,1331715 + ,1313441.25 + ,1241638.75 + ,1205462.5 + ,1255086.25 + ,1187615 + ,1237238.75 + ,1245983.75 + ,1264257.5 + ,1223805 + ,1245983.75 + ,1259486.25 + ,1309110 + ,1268588.75 + ,1214633.75 + ,1156265 + ,1210288.75 + ,1061788.75 + ,1133660 + ,1174112.5 + ,1214633.75 + ,1156265 + ,1156265 + ,1156265 + ,1187615 + ,1142831.25 + ,1084036.25 + ,1034838.75 + ,1070533.75 + ,931205 + ,1016578.75 + ,1066188.75 + ,1075305 + ,1025681.25 + ,1030012.5 + ,1016578.75 + ,1061788.75 + ,1030012.5 + ,967381.25 + ,922102.5 + ,998662.5 + ,832383.75 + ,940362.5 + ,989560 + ,989560 + ,931205 + ,877236.25 + ,872905 + ,922102.5 + ,877236.25 + ,791931.25 + ,733136.25 + ,796276.25 + ,647831.25 + ,782760 + ,854562.5 + ,877236.25 + ,827626.25 + ,764926.25 + ,809778.75 + ,827626.25 + ,814110 + ,679126.25 + ,616481.25 + ,661278.75 + ,526350 + ,665678.75 + ,715302.5 + ,755755 + ,688283.75 + ,625157.5 + ,661278.75 + ,679126.25 + ,643431.25 + ,508502.5 + ,449707.5 + ,503676.25 + ,355231.25 + ,517178.75 + ,616481.25) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '1' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '1' > par3 <- '0' > par2 <- '1' > par1 <- '48' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_autocorrelation.wasp/ > #Source of accompanying publication: > # > 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/145e31377008932.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/27z111377008932.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/3rgof1377008932.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.00000000 0.95483706 0.91767825 0.87054878 0.84122472 0.80316613 [7] 0.75925008 0.72009846 0.68308020 0.65683176 0.63370937 0.62124201 [13] 0.60074852 0.58031114 0.56474216 0.54893724 0.53006862 0.50522119 [19] 0.48065213 0.46415389 0.45399005 0.42994715 0.39621655 0.35120922 [25] 0.31288227 0.27314408 0.23689484 0.19642480 0.15653573 0.11766610 [31] 0.07621108 0.04743337 0.01487450 -0.01390142 -0.03481100 -0.05271676 [37] -0.06750354 -0.09008486 -0.10722064 -0.12152162 -0.13365647 -0.14500618 [43] -0.15873954 -0.17369545 -0.18822381 -0.19761180 -0.21201169 -0.22345268 [49] -0.23691045 > (mypacf <- c(rpacf$acf)) [1] 0.9548370564 0.0675580361 -0.1251062398 0.1622310881 -0.0805196977 [6] -0.1403028895 0.0765677338 -0.0009626425 0.0629456280 0.0765976486 [11] 0.1023203006 -0.0843841551 -0.0401192410 0.0847847062 -0.0565575031 [16] -0.0699805767 -0.0017400235 -0.0200331455 0.0826266122 0.0930911158 [21] -0.1850543792 -0.1545285880 -0.1255557424 -0.0276774473 -0.0632308204 [26] 0.0216212979 -0.0005093594 -0.0323317165 -0.0167452742 -0.1299563077 [31] 0.0016023662 -0.0472667898 -0.0397525162 0.1540185394 0.0015088835 [36] -0.0192348180 -0.0257924245 0.0248781819 0.0006858834 -0.0784322612 [41] 0.0542963300 0.0141909942 0.0095903788 0.1156667535 0.0361261270 [46] -0.1317906286 0.0293592820 -0.0166149236 > 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/4q0511377008932.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/5vodl1377008932.tab") > > try(system("convert tmp/145e31377008932.ps tmp/145e31377008932.png",intern=TRUE)) character(0) > try(system("convert tmp/27z111377008932.ps tmp/27z111377008932.png",intern=TRUE)) character(0) > try(system("convert tmp/3rgof1377008932.ps tmp/3rgof1377008932.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.400 0.576 2.953