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(1.56,1.56,1.54,1.54,1.54,1.54,1.57,1.58,1.57,1.57,1.57,1.57,1.56,1.58,1.58,1.58,1.58,1.53,1.48,1.48,1.48,1.48,1.48,1.57,1.57,1.57,1.60,1.60,1.65,1.71,1.71,1.71,1.74,1.78,1.84,1.84,1.76,1.72,1.66,1.65,1.66,1.66,1.66,1.61,1.55,1.56,1.55,1.55,1.61,1.54,1.48,1.42,1.42,1.42,1.43,1.46,1.50,1.47,1.43,1.42,1.39,1.37,1.38,1.51,1.47,1.47,1.53,1.55,1.50,1.52,1.53,1.53,1.52,1.60,1.52,1.64,1.63,1.69,1.73,1.69,1.61,1.52,1.55,1.56,1.56,1.56,1.54,1.53,1.54,1.48,1.38,1.34,1.28,1.28,1.30,1.31,1.31,1.31,1.32,1.31,1.27,1.24,1.24,1.24,1.24,1.24,1.24,1.24,1.23,1.26,1.28,1.32,1.40,1.41,1.37,1.33,1.33,1.34,1.34,1.38,1.43,1.39,1.33,1.33,1.34,1.38,1.37,1.38,1.31,1.38,1.30,1.30,1.29,1.31,1.31,1.32,1.31,1.30,1.31,1.33,1.34,1.42,1.42,1.36,1.36,1.34,1.34,1.33,1.31,1.25,1.23,1.17,1.19,1.19,1.19,1.19) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > 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/1nmkd1483893529.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/2647c1483893529.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/3xgp81483893529.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.0000000 0.9565103 0.9062868 0.8517428 0.8024111 0.7563380 0.7226067 [8] 0.6833070 0.6408999 0.5969058 0.5526208 0.5069551 0.4675541 0.4293738 [15] 0.3972057 0.3681650 0.3340983 0.3042952 0.2832345 0.2705972 0.2600637 [22] 0.2552969 0.2442563 0.2305391 0.2147006 0.2067137 0.2007555 0.2108966 [29] 0.2214121 0.2379029 0.2497269 0.2599639 0.2689136 0.2734213 0.2770187 [36] 0.2808437 0.2856744 0.2870465 0.2882388 0.2936562 0.3038255 0.3086042 [43] 0.3091478 0.3057102 0.2926919 0.2736886 0.2550510 0.2344969 0.2055180 > (mypacf <- c(rpacf$acf)) [1] 0.9565103412 -0.1013680377 -0.0717645953 0.0395916471 0.0043650806 [6] 0.1097145135 -0.1080694564 -0.0602826494 -0.0152490385 -0.0265540696 [11] -0.0323797092 0.0249179710 -0.0264282512 0.0419367475 0.0096900808 [16] -0.0972872050 0.0604504126 0.0810696950 0.0697626584 -0.0117228002 [21] 0.0284349586 -0.0623170624 -0.0085466161 -0.0220384462 0.0724247325 [26] 0.0116734265 0.1455916579 -0.0121695820 0.0656016272 -0.0101505648 [31] 0.0061863103 0.0561067204 -0.0899967493 0.0108261804 0.0005500413 [36] 0.0196867970 -0.0268049245 0.0222398957 0.0692625117 0.0748819175 [41] -0.0671447864 -0.0582431943 0.0231577211 -0.0865524371 -0.0115415994 [46] -0.0299075114 -0.0310404793 -0.1377747196 > 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/4ieav1483893529.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/5ux4g1483893529.tab") > > try(system("convert tmp/1nmkd1483893529.ps tmp/1nmkd1483893529.png",intern=TRUE)) character(0) > try(system("convert tmp/2647c1483893529.ps tmp/2647c1483893529.png",intern=TRUE)) character(0) > try(system("convert tmp/3xgp81483893529.ps tmp/3xgp81483893529.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.142 0.098 1.261