R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 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(831.5,831,830,828.4,828.1,827.6,828.2,828.2,828.7,830.5,831,831.9,832.2,831.9,830.6,829.7,828.8,826.7,825.8,825.4,825,825.6,824.6,824.5,822.6,822,821.2,820.4,819.4,819.7,818.2,817.7,817.5,817.7,817.5,816.9,820.3,819.7,819.4,818.6,818.2,817.6,817.3,816.7,817,817.6,817.8,817.8,820.9,820.7,820.6,820.8,820.4,820.2,819.8,819.6,819.6,819.8,819.9,820.3,822.9,821.9,820.6,818.9,817.3,815.6,813.8,812.1,810.8,809.6,808.7,807.3) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '48' > #'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/1r8z91483629107.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/2xisq1483629107.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/3zicg1483629107.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.308445923 0.322507826 0.205594251 0.088292639 [6] -0.071210759 -0.158237995 -0.097877319 -0.104313534 -0.050820726 [11] -0.001784686 -0.008767166 0.245010830 0.012432261 -0.046910648 [16] 0.023870501 -0.128853562 -0.155631550 -0.284866224 -0.226176365 [21] -0.178343991 -0.144358490 -0.099037051 -0.026334556 0.125659225 [26] 0.055556782 -0.034606768 0.092206087 -0.039763678 -0.109896261 [31] -0.141628307 -0.182302143 -0.120001285 -0.162820624 -0.109401279 [36] -0.028717667 0.053346678 0.141386029 0.102791766 0.217652723 [41] 0.099537365 0.062073305 0.023921705 -0.053700357 0.018685681 [46] -0.018868795 0.007723294 0.105599180 0.116763996 > (mypacf <- c(rpacf$acf)) [1] 3.084459e-01 2.512750e-01 6.323858e-02 -6.129575e-02 -1.758520e-01 [6] -1.594531e-01 3.532943e-02 4.839490e-02 5.896850e-02 3.507830e-02 [11] -5.979855e-02 2.516622e-01 -1.299970e-01 -2.219104e-01 3.234687e-02 [16] -1.134507e-01 -2.577364e-02 -1.360791e-01 -1.233120e-01 5.185453e-02 [21] 2.032672e-02 -5.329742e-02 2.062228e-02 1.536831e-02 -9.532052e-05 [26] -1.016831e-01 -1.213738e-02 -2.906041e-02 -1.014032e-01 -1.851060e-02 [31] -1.017958e-01 -5.316965e-02 -6.288767e-02 -7.837910e-02 -2.878400e-04 [36] -3.990216e-02 8.528800e-02 6.812705e-02 7.184453e-03 -9.084228e-02 [41] -1.631722e-02 -1.949357e-02 -1.671121e-02 4.395940e-02 2.720660e-02 [46] 3.176931e-02 4.827076e-02 -2.074815e-02 > 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/43zin1483629107.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/5x3fs1483629107.tab") > > try(system("convert tmp/1r8z91483629107.ps tmp/1r8z91483629107.png",intern=TRUE)) character(0) > try(system("convert tmp/2xisq1483629107.ps tmp/2xisq1483629107.png",intern=TRUE)) character(0) > try(system("convert tmp/3zicg1483629107.ps tmp/3zicg1483629107.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.292 0.079 1.391