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(93.43,93.59,95.28,94.95,94.49,94.45,94.35,95.52,96.89,97.54,97.65,97.35,98.2,99.46,100.35,99.72,99.69,99.62,99.77,100.19,100.82,100.36,101.08,100.73,101.51,102.12,102.88,103.47,103.53,103.67,103.68,103.76,103.67,103.01,103.39,103.43,103.4,104.8,105.53,107.45,108.73,109.04,108.75,108.75,108.76,108.41,110.15,109.93,110.6,112.17,113.47,113.35,114.12,115,114.01,113.86,113.83,112.7,111.79,113.77) > 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/11rkz1490092861.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/22k6l1490092861.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/3qhx81490092861.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.94822729 0.90107687 0.85564496 0.80121187 0.74375723 [7] 0.68562181 0.61948338 0.55988787 0.51128417 0.46289382 0.41591628 [13] 0.37028516 0.32623865 0.28218283 0.24767278 0.20698981 0.16596003 [19] 0.12453280 0.08191700 0.04152468 0.00750103 -0.02157146 -0.04713098 [25] -0.06924693 -0.09069973 -0.11166214 -0.12984706 -0.15046788 -0.17239269 [31] -0.19440920 -0.21816650 -0.24162548 -0.26735380 -0.29500204 -0.31807371 [37] -0.33933818 -0.35873797 -0.37624426 -0.38884043 -0.39728586 -0.39872263 [43] -0.39847084 -0.39979825 -0.40156204 -0.40356274 -0.40973776 -0.40517356 [49] -0.39750498 > (mypacf <- c(rpacf$acf)) [1] 0.948227287 0.019252333 -0.005818076 -0.112234460 -0.068100623 [6] -0.046281341 -0.110523920 0.022438318 0.079916228 -0.002547004 [11] -0.017721207 -0.039012975 -0.024531157 -0.049768298 0.047324907 [16] -0.076040031 -0.029332326 -0.052753009 -0.048930508 -0.014625187 [21] 0.021813343 0.043522799 0.021910624 -0.008233250 -0.037113026 [26] -0.051613126 -0.022989047 -0.060851780 -0.027888166 -0.034026542 [31] -0.035262447 -0.027336287 -0.062338971 -0.051343373 0.010937506 [36] -0.013702884 -0.014787223 -0.033157108 -0.001468685 -0.004123944 [41] 0.030710616 -0.014217769 -0.035819941 -0.043262835 -0.049046190 [46] -0.080655038 0.072271045 0.031650448 > 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/4ycn41490092861.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/5d5um1490092861.tab") > > try(system("convert tmp/11rkz1490092861.ps tmp/11rkz1490092861.png",intern=TRUE)) character(0) > try(system("convert tmp/22k6l1490092861.ps tmp/22k6l1490092861.png",intern=TRUE)) character(0) > try(system("convert tmp/3qhx81490092861.ps tmp/3qhx81490092861.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.359 0.125 1.549