R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" 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(89.8,89.2,89.9,88.9,84,86.3,89.3,90.6,88.3,91.6,95.4,96.8,92.5,93.6,93.8,92.7,88.3,90.4,91.2,91.5,88.9,88.6,89.1,89.4,86.7,89.8,90.9,91.4,90.2,92.2,94,95.8,95.1,96.2,96.8,97.1,96.5,97.2,97.8,99.9,101.2,103.3,104.5,100.8,95,93.4,93.1,94.9,96.9,100.9,100.2,101.8,105.4,106.4,105.6,107.5,109.5,108.6,109.2,110.3,110.3,107.9,107.7,108.1,108,105.9,105.9,104.7) > 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/150mb1458078157.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/2kdmp1458078157.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/3aov11458078157.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.94464044 0.87221038 0.81447108 0.75555036 0.66080198 [7] 0.59224958 0.54896763 0.50728085 0.43800432 0.38973231 0.35956311 [13] 0.33272870 0.28710350 0.26055933 0.24474255 0.23591728 0.21135822 [19] 0.19349422 0.18064052 0.17964213 0.16090730 0.14393339 0.12248448 [25] 0.09205767 0.03127304 -0.02718378 -0.07618517 -0.11648496 -0.16138861 [31] -0.20043739 -0.23919574 -0.27484275 -0.31569617 -0.34809327 -0.37114286 [37] -0.38160083 -0.38547356 -0.37556847 -0.35839822 -0.33350954 -0.31010726 [43] -0.28906792 -0.27453657 -0.26268470 -0.26193454 -0.26724790 -0.28115715 [49] -0.29186467 > (mypacf <- c(rpacf$acf)) [1] 0.944640437 -0.187035281 0.126326861 -0.094156640 -0.351404560 [6] 0.348734656 -0.015657948 -0.010563212 -0.179777905 0.086381611 [11] 0.044152002 0.057760828 -0.077075636 0.020007121 -0.011155893 [16] 0.129442607 -0.072409188 -0.076589550 0.028880043 0.110915099 [21] -0.088316028 -0.015109842 -0.155216823 -0.178950689 -0.083374397 [26] 0.016399564 0.036322032 -0.035409941 0.056109115 -0.185172260 [31] -0.081685454 -0.005646999 -0.002342232 -0.009010582 0.044188081 [36] -0.014629376 0.064538573 0.058303196 0.023349899 -0.009656316 [41] 0.025931754 -0.028491849 -0.068230386 -0.070689540 -0.075671991 [46] 0.001515165 -0.036870452 0.129726799 > 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/4cibm1458078157.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/5ckg41458078157.tab") > > try(system("convert tmp/150mb1458078157.ps tmp/150mb1458078157.png",intern=TRUE)) character(0) > try(system("convert tmp/2kdmp1458078157.ps tmp/2kdmp1458078157.png",intern=TRUE)) character(0) > try(system("convert tmp/3aov11458078157.ps tmp/3aov11458078157.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.178 0.235 1.419