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(75.8,75.7,112.3,110.9,99.6,107.5,90,88.8,129.7,120.4,93.3,96,81.1,78,111.9,117.6,101,98.3,91,86.8,108.8,110.1,93.8,100.6,75.7,69,116,94.5,105.1,95.3,79.7,76.1,111.1,106.3,89.5,96.8,67.8,62.5,90.1,93.6,94.2,93.2,81,73.7,97.7,97.5,82.7,88.8,68.5,61.1,89.6,87.6,90.8,84.3,75,78.4,83.5,93,79.3,83.9,65,60.3,80.6,86.5,78.7,80.7,70.6,67.2,88,89.1,69,84.1) > 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/1q5lj1476809766.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/224r21476809766.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/3zk4m1476809766.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.418373720 0.041386985 0.102388572 -0.014413556 [6] 0.306471789 0.703154683 0.310518237 -0.067111324 0.020220944 [11] -0.033557861 0.243865058 0.650771193 0.285774337 -0.026860995 [16] -0.038518211 -0.157419158 0.112472680 0.444454592 0.145569035 [21] -0.114782606 -0.085199791 -0.198335327 0.041545928 0.415963163 [26] 0.111496075 -0.113231305 -0.118780588 -0.258449164 -0.056770786 [31] 0.204322781 0.019549345 -0.198981691 -0.169749944 -0.259098964 [36] -0.124156928 0.158145830 0.005711873 -0.183862336 -0.169634473 [41] -0.243303617 -0.154786448 0.034959608 -0.070021308 -0.216240926 [46] -0.184831942 -0.229245288 -0.141653068 0.015358679 > (mypacf <- c(rpacf$acf)) [1] 0.418373720 -0.162006678 0.186786242 -0.174093106 0.540259629 [6] 0.466537763 -0.167555049 -0.285304438 0.131970608 0.005225721 [11] 0.154382260 0.201453690 -0.073006000 0.068769630 -0.206417354 [16] -0.225472446 -0.027010697 -0.046762889 -0.085988405 0.040134982 [21] 0.107091322 -0.013226597 -0.056928903 0.072319045 -0.097507137 [26] -0.001485093 -0.091898799 0.048920134 -0.035247005 -0.207870141 [31] 0.071240677 -0.071814495 0.053750230 -0.028365960 -0.077293928 [36] 0.016150633 0.054456769 -0.173334821 0.115145126 0.095807414 [41] -0.045849211 -0.113104668 -0.042538901 0.044180986 -0.035944658 [46] -0.078941730 0.130165519 -0.027623185 > 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/42w7b1476809766.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/59qhj1476809766.tab") > > try(system("convert tmp/1q5lj1476809766.ps tmp/1q5lj1476809766.png",intern=TRUE)) character(0) > try(system("convert tmp/224r21476809766.ps tmp/224r21476809766.png",intern=TRUE)) character(0) > try(system("convert tmp/3zk4m1476809766.ps tmp/3zk4m1476809766.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.299 0.112 1.433