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(101.74,100.73,100.86,100.78,100.76,100.77,100.77,101.93,101.98,102.47,102.59,102.54,102.54,101.29,101.49,101.71,101.98,102.11,102.11,103.13,103.43,103.8,103.99,104.03,104.03,102.58,102.65,102.81,102.98,103.12,103.12,104.33,104.41,104.66,104.81,104.9,100.15,98.74,98.74,98.96,99.34,99.4,99.5,100.5,100.77,101.08,101.39,101.43,101.43,101.29,101.33,101.15,101.25,101.13,101.07,101.33,101.61,101.29,101.39,101.46,101.81,101.78,101.93,102.01,102.03,102.14,101.81,101.52,101.38,101.5,101.65,101.64) > 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/10tdl1489660184.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/2djtt1489660184.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/339p21489660184.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.206632919 0.019219943 -0.063801525 -0.084241124 [6] -0.158592584 -0.280197052 -0.150286400 -0.092838949 -0.060282113 [11] -0.016389208 0.195334914 0.270674636 0.047586651 -0.001054850 [16] -0.022004751 -0.065457570 -0.101295670 -0.188095412 -0.058482332 [21] -0.079056894 0.006097826 -0.021758382 0.139710682 0.132121455 [26] 0.032233259 -0.020610382 -0.072532687 -0.022473461 -0.129263180 [31] -0.062402899 0.036361503 0.017835810 -0.011145054 -0.023113067 [36] 0.112855890 0.081419167 0.007773474 0.006414842 0.005079657 [41] 0.001290596 0.027810164 -0.028385125 -0.002247001 -0.003934389 [46] -0.015873434 -0.001932912 -0.022332189 0.004642584 > (mypacf <- c(rpacf$acf)) [1] 0.206632919 -0.024524340 -0.065643443 -0.059908038 -0.135427198 [6] -0.241717439 -0.073546256 -0.092335957 -0.100828388 -0.073347853 [11] 0.128042313 0.131276372 -0.099417565 -0.036787290 -0.031201766 [16] -0.064640445 -0.011180306 -0.103624764 -0.006784238 -0.085106013 [21] 0.010371406 -0.112119810 0.025299957 -0.014775349 -0.041820020 [26] -0.085156180 -0.094533364 -0.030268057 -0.115234234 -0.012831245 [31] 0.028107919 -0.047730198 -0.083288607 -0.096916781 -0.011465760 [36] -0.048162243 -0.035924269 -0.018379833 -0.013478986 -0.036790240 [41] 0.101949614 -0.090673988 -0.032455108 -0.007255825 -0.009187857 [46] -0.019850320 -0.100793789 -0.012287846 > 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/48dsv1489660184.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/5g83f1489660184.tab") > > try(system("convert tmp/10tdl1489660184.ps tmp/10tdl1489660184.png",intern=TRUE)) character(0) > try(system("convert tmp/2djtt1489660184.ps tmp/2djtt1489660184.png",intern=TRUE)) character(0) > try(system("convert tmp/339p21489660184.ps tmp/339p21489660184.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.292 0.115 1.436