R version 3.3.3 (2017-03-06) -- "Another Canoe" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(86.37,86.84,86.73,90.99,92.61,93.83,94.2,94.01,93.47,93.27,94.3,94.53,94.59,94.69,94.67,96.55,97.14,97.32,97.97,98.49,99.11,99.09,98.76,99.2,99.61,99.54,99.68,100.75,100.38,100.79,100.39,100.39,100.12,100,99.17,99.17,99.59,99.96,99.68,101.03,100.99,101.38,101.84,101.52,101.37,101.22,101.45,101.99,104.05,104.61,105.06,105.4,104.71,104.8,104.83,104.81,104.49,104.59,104.5,104.61) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '60' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Mon, 30 Nov 2015 06:58:35 +0000) > #Author: root > #To cite this work: Wessa P., (2015), (Partial) Autocorrelation Function (v1.0.12) 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) > x <- na.omit(x) > 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/1oj9l1489960670.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/2ipa51489960670.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/38n3g1489960670.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.0000000000 0.2029262117 0.1363127451 -0.0202455531 -0.1246987868 [6] -0.1134889765 -0.0443449799 -0.0177222950 -0.0578086108 0.0487671169 [11] -0.0041636006 0.0143259270 0.2883761112 -0.0070936798 -0.0248702045 [16] 0.0014818798 -0.0339377900 -0.0345321029 -0.0958774973 -0.0875067117 [21] 0.0028695753 0.1053678052 0.0355173720 0.0192438061 0.1700198209 [26] -0.0976879375 0.0233701599 -0.0918002817 -0.0777484378 -0.0965634454 [31] -0.0724033419 -0.1240454069 0.0053807305 0.0737440329 0.0007316596 [36] -0.0295132117 0.1161146959 -0.0792116419 0.0355367945 -0.0583203125 [41] -0.1617596678 -0.1169741839 -0.0728005601 0.0456500954 0.1200271259 [46] 0.2321361394 0.0190235916 0.0148771128 -0.0254851902 -0.1130415171 [51] -0.0172182783 -0.0521296015 -0.0618111617 -0.0871133512 -0.0378001614 [56] -0.0530152016 -0.0187014634 0.0005518216 -0.0009171871 > (mypacf <- c(rpacf$acf)) [1] 0.2029262117 0.0992194606 -0.0687780792 -0.1292653427 -0.0604146258 [6] 0.0198095731 0.0022117729 -0.0784868218 0.0549497439 -0.0149655019 [11] -0.0006244674 0.2998242993 -0.1311526996 -0.0909841449 0.0717628054 [16] 0.0315344966 -0.0057167069 -0.1392247788 -0.0654886805 0.1345495499 [21] 0.0804286108 -0.0439958202 -0.0459604840 0.1031864655 -0.0798338800 [26] 0.0824890813 -0.1329593745 -0.0674251436 -0.0332770516 0.0278820351 [31] -0.0888801081 -0.0210423681 -0.0112467103 0.0351883655 -0.0616871625 [36] 0.0408192587 -0.0650813790 0.0366212472 -0.0152277406 -0.1504234641 [41] -0.0724559949 0.0276070133 0.1695025818 0.0619087893 0.0458817640 [46] -0.1024752951 0.0635012607 -0.0373188068 -0.0178403768 -0.0639391802 [51] 0.0201401353 0.0371879056 -0.0504171408 -0.0897365255 -0.0551442118 [56] -0.0639605805 -0.0404872048 0.0136212109 > 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/40fm01489960670.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/5a1q41489960670.tab") > > try(system("convert tmp/1oj9l1489960670.ps tmp/1oj9l1489960670.png",intern=TRUE)) character(0) > try(system("convert tmp/2ipa51489960670.ps tmp/2ipa51489960670.png",intern=TRUE)) character(0) > try(system("convert tmp/38n3g1489960670.ps tmp/38n3g1489960670.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.286 0.078 1.384