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(77.34,78.15,78.31,78.71,78.68,78.85,78.97,79.47,80.6,82.24,83.25,84.55,85.91,86.84,87.44,87.79,88.08,88.38,88.53,88.79,88.85,89.26,89.31,89.39,89.76,89.94,89.99,90.08,89.95,90.2,89.7,89.5,89.25,89.13,89.07,89.06,89.15,89.38,89.4,89.51,89.62,89.65,89.68,89.92,90.26,90.89,91.08,91.13,91.83,92.66,93.45,93.95,94.12,94.31,94.25,94.51,94.58,94.85,95.31,95.75,96.06,96.4,96.57,96.47,96.34,96.22,96.2,96.71,97.05,97.82,98.22,98.5,98.94,99.5,99.89,100,100.1,100.16,100.05,100.03,100,100.32,100.53,100.49,100.38,100.22,100.5,100.57,100.6,100.23,100.29,100.01,100.13,100.22,100.2,100.34,100.73,100.29,101.11,101.09,101.01,101.27,101.57,101.69,101,101.43,101.13,101.23) > 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/1112i1476876583.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/20inh1476876583.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/3gpbs1476876583.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.551610382 0.524818018 0.356988222 0.253963694 [6] 0.149040199 0.077378399 0.088424691 0.070228999 0.066379810 [11] 0.093978370 0.051875397 0.091290907 0.018758991 -0.049609701 [16] -0.070934396 -0.119888884 -0.150957981 -0.210067830 -0.176159658 [21] -0.180434966 -0.161806389 -0.162426204 -0.115466941 -0.023608237 [26] -0.064146899 -0.036591291 -0.101185612 -0.065693420 -0.073790285 [31] -0.127478388 -0.067967805 -0.041753216 -0.022800407 -0.011227371 [36] -0.012204076 0.087311196 0.071652323 0.080501188 0.028109004 [41] 0.065946179 0.046306254 0.004143778 -0.006214565 -0.037261932 [46] -0.029612088 -0.010793759 0.057275721 0.104881491 > (mypacf <- c(rpacf$acf)) [1] 0.551610382 0.316998371 -0.024922702 -0.065393854 -0.058480659 [6] -0.032179308 0.089692592 0.044300503 -0.003691109 0.046005361 [11] -0.051652423 0.047428575 -0.063093620 -0.135737685 -0.017886118 [16] -0.027412289 -0.052958163 -0.094796294 0.004597400 -0.011406236 [21] -0.004936755 -0.053051997 0.028116084 0.141056839 -0.064702266 [26] -0.024955061 -0.108250864 0.030588517 0.054993608 -0.086639068 [31] 0.020916393 0.053693232 -0.012545935 -0.026691520 -0.045011450 [36] 0.093904265 0.060932948 -0.028543243 -0.111083225 0.058639211 [41] 0.026741163 -0.022822735 -0.063028489 -0.090002099 0.030505480 [46] 0.095652901 0.105129200 0.003324737 > 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/4ykhf1476876583.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/58rrs1476876583.tab") > > try(system("convert tmp/1112i1476876583.ps tmp/1112i1476876583.png",intern=TRUE)) character(0) > try(system("convert tmp/20inh1476876583.ps tmp/20inh1476876583.png",intern=TRUE)) character(0) > try(system("convert tmp/3gpbs1476876583.ps tmp/3gpbs1476876583.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.222 0.096 1.334