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 = '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/1tlc11489657654.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/2i7ig1489657654.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/3t44a1489657654.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.52589120 0.24126533 0.16417179 0.30052695 0.38614690 [7] 0.44233272 0.34387131 0.13251294 0.08689096 0.20690007 0.27765493 [13] 0.18645095 0.09316404 0.07195204 0.04056097 0.07672384 0.07186665 [19] -0.04012640 -0.23374378 -0.15363341 -0.08214953 0.01498370 -0.09467464 [25] -0.17415603 -0.25646651 -0.21691052 -0.12506686 0.02135011 -0.10486792 [31] -0.22174134 -0.24069717 -0.15229925 -0.12104989 -0.12359322 -0.13430960 [37] -0.18681148 -0.18976015 -0.12129461 -0.04672150 -0.11748975 -0.15521192 [43] -0.06698367 -0.09357036 -0.06946133 -0.03698665 -0.02741305 -0.10059344 [49] -0.09416443 > (mypacf <- c(rpacf$acf)) [1] 0.5258911970 -0.0487895251 0.0786459583 0.2652142881 0.1705364539 [6] 0.2284829512 0.0487186929 -0.1584852936 -0.0137659783 0.0647486836 [11] -0.0038420288 -0.0930864862 -0.0328740163 0.0358028148 -0.0664226762 [16] -0.0079348122 -0.0677980980 -0.1505001070 -0.2512941801 0.0337427770 [21] -0.0713682887 0.1232847403 -0.0586005627 0.0114083238 -0.0153545358 [26] -0.0002159923 -0.0220474806 0.1865250890 -0.0944752059 0.0386019719 [31] -0.0055178695 0.0244378067 -0.0517539128 -0.0742922102 0.0010125709 [36] -0.0332026614 -0.0467354548 -0.0548180588 0.0489354450 -0.1076976975 [41] 0.0621435582 0.0411557571 -0.0908556903 -0.0110282736 0.0476022054 [46] -0.0054707275 0.0765749875 -0.0880309062 > 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/4yxp21489657654.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/5kias1489657654.tab") > > try(system("convert tmp/1tlc11489657654.ps tmp/1tlc11489657654.png",intern=TRUE)) character(0) > try(system("convert tmp/2i7ig1489657654.ps tmp/2i7ig1489657654.png",intern=TRUE)) character(0) > try(system("convert tmp/3t44a1489657654.ps tmp/3t44a1489657654.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.106 0.105 1.225