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(62.38,62.62,64.15,64.97,66.12,67.08,68.66,69.04,70.8,73.2,74.19,75.36,75.54,76.81,77.69,79.34,80.36,80.74,81.12,82.95,87.31,88.93,90.8,91.29,91.36,92.72,95.75,97.19,98.73,99.03,99.4,99.66,100.5,101.21,101.26,101.44,101.97,102.23,102.58,101.91,101.63,101.1,100.71,100.75,100.14,97.72,94.91,94.34,97.11,96.51,95.8,95.25,95.09,94.97,95.21,95.46,95.33,95.14,95.6,95.66,95.66,96.33,97.66,98.27,99.53,100.86,101.26,101.29,101.38,101.49,101.29,101.26) > 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/1y0ra1489657021.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/2bt611489657021.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/3har91489657021.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.952054508 0.898662764 0.845327174 0.791068913 [6] 0.735739769 0.678138556 0.619931910 0.559650535 0.502661684 [11] 0.450508119 0.399306737 0.348408036 0.295182721 0.243359059 [16] 0.192495101 0.144291857 0.096865543 0.048924209 0.001320762 [21] -0.040881738 -0.071388088 -0.098428490 -0.122207024 -0.145495137 [26] -0.165345518 -0.180978938 -0.190474177 -0.198476818 -0.204028258 [31] -0.208840110 -0.212284468 -0.214690889 -0.214938996 -0.214028817 [36] -0.212700743 -0.210619969 -0.206154282 -0.200355194 -0.193643916 [41] -0.188689973 -0.183778767 -0.179906325 -0.177295533 -0.174673485 [46] -0.172712796 -0.176677423 -0.186123264 -0.196146477 > (mypacf <- c(rpacf$acf)) [1] 0.9520545075 -0.0827528316 -0.0243663783 -0.0390850955 -0.0407608988 [6] -0.0553103916 -0.0384067732 -0.0579770264 -0.0002760068 0.0111015160 [11] -0.0295937070 -0.0337841954 -0.0639110395 -0.0256692810 -0.0354043168 [16] -0.0165351864 -0.0380367036 -0.0464012928 -0.0404417987 0.0120319581 [21] 0.0743618185 -0.0133923815 -0.0034516922 -0.0347884264 0.0001670128 [26] 0.0011712329 0.0259341234 -0.0240766527 0.0072096926 -0.0128361085 [31] -0.0085388101 -0.0194416621 -0.0087718199 -0.0116136509 -0.0128600037 [36] -0.0058403300 0.0034505409 -0.0088561555 -0.0111980461 -0.0270108536 [41] -0.0036569365 -0.0211547996 -0.0266846407 -0.0163601532 -0.0156905185 [46] -0.0696919883 -0.0613777997 -0.0235010512 > 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/4eqnf1489657021.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/5gr851489657021.tab") > > try(system("convert tmp/1y0ra1489657021.ps tmp/1y0ra1489657021.png",intern=TRUE)) character(0) > try(system("convert tmp/2bt611489657021.ps tmp/2bt611489657021.png",intern=TRUE)) character(0) > try(system("convert tmp/3har91489657021.ps tmp/3har91489657021.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.395 0.129 1.552