R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" 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(100,100,100,100,100,100,100,100,100,100,100,100,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,101.4,101.4,102,102,102.6,102.6,102.6,102.6,102.6,102.6,102.3,102.4,102.4,102.4,102.9,102.9,102.9,104.9,104.9,105.5,105.5,105.5,105.5,105.5,105.5,105.5,105.5,106.8,106.8,106.8,106.9,107.5,107.6,107.6,107.6,107.8,107.8,107.8) > 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/14loo1476882618.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/2aj171476882618.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/3yyu61476882618.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.95507982 0.90996135 0.86006182 0.80963792 0.75623962 [7] 0.70184985 0.64847579 0.60265007 0.55585713 0.50932858 0.45619026 [13] 0.41647638 0.37741466 0.33370407 0.28571916 0.23385653 0.18133292 [19] 0.12380793 0.06529147 0.01178962 -0.04151394 -0.07355610 -0.09894442 [25] -0.12605128 -0.14439139 -0.16431785 -0.18042386 -0.20089011 -0.22480005 [31] -0.25003195 -0.27561636 -0.30278712 -0.33215452 -0.36112754 -0.38374196 [37] -0.40679704 -0.42019966 -0.43474797 -0.43869863 -0.42947382 -0.42033714 [43] -0.40777661 -0.39530420 -0.38283180 -0.37035939 -0.35806325 -0.34576711 [49] -0.33347096 > (mypacf <- c(rpacf$acf)) [1] 0.9550798239 -0.0252340161 -0.0780926947 -0.0327633273 -0.0592503883 [6] -0.0414059440 -0.0171629519 0.0561157591 -0.0396834633 -0.0352060309 [11] -0.1082654558 0.1148221006 -0.0156055350 -0.0963118060 -0.0767982030 [16] -0.0854229863 -0.0501282582 -0.1061961238 -0.0310310064 0.0156647580 [21] -0.0534447851 0.1724957173 0.0621626306 -0.0699459913 0.0383385666 [26] -0.0700708887 -0.0077056640 -0.0800832962 -0.0684819782 -0.0507361287 [31] -0.0319306452 -0.0724874706 -0.0181864230 0.0001344374 -0.0170793570 [36] -0.0563495818 0.0300361104 -0.0620189593 0.0302481976 0.1029422787 [41] -0.0183695564 0.0100353418 0.0141417549 0.0169541766 -0.0383312094 [46] 0.0399996364 -0.0223081118 -0.0111296751 > 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/4qk1w1476882618.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/5tblh1476882618.tab") > > try(system("convert tmp/14loo1476882618.ps tmp/14loo1476882618.png",intern=TRUE)) character(0) > try(system("convert tmp/2aj171476882618.ps tmp/2aj171476882618.png",intern=TRUE)) character(0) > try(system("convert tmp/3yyu61476882618.ps tmp/3yyu61476882618.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.159 0.106 1.297