R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" 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(177.6 + ,176.5285714 + ,175.7714286 + ,174.9857143 + ,177.3571429 + ,176.3714286 + ,174.1 + ,171.1714286 + ,166.4571429 + ,163.8 + ,161.7857143 + ,156.5142857 + ,152.5428571 + ,149.3142857 + ,146.8142857 + ,144.0571429 + ,141.4142857 + ,134.9571429 + ,128.7428571 + ,124.6571429 + ,119.8714286 + ,117.9857143 + ,118.2857143 + ,115.4142857 + ,115.9714286 + ,116.9714286 + ,121.3571429 + ,131.5714286 + ,137.2428571 + ,136.8714286 + ,139.7857143 + ,146.2 + ,147.0714286 + ,146.9142857 + ,144.5857143 + ,144.3571429 + ,147.3571429 + ,150.0142857 + ,154.8571429 + ,162.0285714 + ,158.6142857 + ,163.6428571 + ,166.6 + ,169.7571429 + ,170.6714286 + ,165.9714286 + ,166.1714286 + ,170.7857143 + ,170.1142857 + ,171.0857143 + ,175.6285714 + ,178.2 + ,176.7285714 + ,177.4428571 + ,179.4142857 + ,175.6714286 + ,174.2571429 + ,169.3 + ,170.0428571 + ,173.9428571 + ,171.2714286 + ,166.7714286 + ,168.7285714 + ,164.7 + ,164.1 + ,156.5142857 + ,150.2 + ,149.4 + ,147.4857143 + ,137.3571429 + ,135.1571429 + ,130.7428571 + ,130.1714286 + ,126.4 + ,122.3428571 + ,120.9571429 + ,124.9857143 + ,124.0428571 + ,127.3 + ,124.9714286 + ,128.7 + ,131.3285714 + ,134.1285714 + ,139.4142857 + ,144 + ,145.6857143 + ,153.4428571 + ,157.9428571 + ,157.9 + ,158.7857143 + ,155.2142857 + ,159.6 + ,158.3714286 + ,161.8714286 + ,165.5857143 + ,168.6142857 + ,170.2428571 + ,176.4142857 + ,171.7285714 + ,174.0571429 + ,170.5714286 + ,168.9285714 + ,171.0857143 + ,173.1571429 + ,172.1857143 + ,177.3 + ,179.0428571 + ,181.5571429 + ,180.5285714 + ,181.5714286 + ,181.8428571 + ,180.9142857 + ,175.6857143 + ,174.1 + ,171.4428571 + ,171.5714286 + ,167.0571429 + ,160.3142857 + ,152.5285714 + ,150.1285714 + ,145.6571429 + ,140.6) > par8 = '' > par7 = '0.95' > par6 = 'MA' > par5 = '1' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'MA' > par5 <- '1' > par4 <- '0' > par3 <- '0' > par2 <- '1' > par1 <- '60' > #'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/1iuoc1393880962.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/2bojg1393880962.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/3es3u1393880962.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.97310589 0.93220279 0.87798200 0.81098396 0.73252298 [7] 0.64668599 0.55490323 0.46634396 0.37168205 0.27616318 0.18038161 [13] 0.08418253 -0.01169838 -0.10327496 -0.18882363 -0.26691210 -0.34040492 [19] -0.40673066 -0.46036557 -0.50523537 -0.54186168 -0.57081955 -0.59082813 [25] -0.60495012 -0.60986655 -0.60954243 -0.60255256 -0.59513294 -0.58219072 [31] -0.56471962 -0.53524489 -0.50184948 -0.46017269 -0.41221404 -0.35468655 [37] -0.29456031 -0.22972317 -0.16442296 -0.09637729 -0.03023944 0.03937320 [43] 0.10837422 0.17779097 0.24257485 0.30189333 0.35738229 0.40531099 [49] 0.44353408 0.47522007 0.49899036 0.51234723 0.51815345 0.51509984 [55] 0.50634522 0.48835312 0.46052708 0.42419204 0.38625194 0.34051583 [61] 0.29003049 > (mypacf <- c(rpacf$acf)) [1] 0.973105889 -0.277627501 -0.221212849 -0.192639131 -0.160963489 [6] -0.077988523 -0.073198429 0.108665282 -0.174388334 -0.061207931 [11] -0.082798279 -0.103965198 -0.079004084 -0.013039976 0.040823654 [16] -0.025675312 -0.081278708 -0.052735322 0.066326119 -0.042848617 [21] -0.028239535 -0.050892376 -0.024654021 -0.110050152 0.016707831 [26] -0.047320262 -0.053084702 -0.174265378 -0.022743248 -0.031917520 [31] 0.136275881 -0.023069736 0.062109052 0.007919223 0.037829936 [36] -0.043532267 0.031935936 0.007952177 0.011925371 -0.016291942 [41] 0.105113857 0.006555098 0.029929359 -0.036379832 -0.055249510 [46] 0.007330721 -0.077066228 -0.011276682 0.076551676 0.016003081 [51] -0.064328008 -0.002852089 0.010223539 0.016937212 -0.008999444 [56] -0.044343958 -0.042464292 0.040549551 -0.034561230 -0.035367534 > 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/48kv31393880962.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/55ebf1393880962.tab") > > try(system("convert tmp/1iuoc1393880962.ps tmp/1iuoc1393880962.png",intern=TRUE)) character(0) > try(system("convert tmp/2bojg1393880962.ps tmp/2bojg1393880962.png",intern=TRUE)) character(0) > try(system("convert tmp/3es3u1393880962.ps tmp/3es3u1393880962.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.636 0.515 3.147