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(98.98,98.97,98.91,98.98,98.95,98.96,98.96,99.04,99.33,100.04,100.14,100.21,100.21,100.27,100.44,100.57,100.51,100.47,100.47,100.49,101,101.61,101.65,101.74,101.74,101.73,101.77,101.82,101.97,102.09,102.09,102.08,102.42,102.78,103.04,103.08,99.16,99.19,99.23,99.31,99.46,99.49,99.95,100.14,100.43,101.1,101.26,101.28,101.04,101.12,101.07,100.97,101.01,100.99,101.19,101.25,101.33,101.79,102.06,102.09,102.27,102.26,102.46,102.46,102.51,102.56,102.59,102.26,102.33,102.84,102.93,102.95) > 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/1lmgf1476909568.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/2str81476909568.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/3pi4y1476909568.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.883539959 0.755477696 0.631845431 0.527954535 [6] 0.437851520 0.338205845 0.250549432 0.171788279 0.110223967 [11] 0.082672806 0.063082913 0.033084373 -0.020338653 -0.078347017 [16] -0.135429065 -0.170424662 -0.189456337 -0.212945016 -0.229870110 [21] -0.250914907 -0.266523825 -0.256160039 -0.234737580 -0.214892822 [26] -0.206569846 -0.206016852 -0.196929992 -0.153709227 -0.093344177 [31] -0.026539505 0.046075556 0.104286519 0.169860798 0.259076011 [36] 0.350489513 0.438552149 0.380356675 0.315117895 0.252926875 [41] 0.198111314 0.150583780 0.102168982 0.060565792 0.023085899 [46] -0.007563832 -0.027169366 -0.043608326 -0.060637758 > (mypacf <- c(rpacf$acf)) [1] 0.883539959 -0.114722330 -0.050187476 0.013692510 -0.013056159 [6] -0.112188041 -0.006997076 -0.028511969 0.002659199 0.092758812 [11] -0.006966266 -0.081083858 -0.123817393 -0.059497366 -0.073818341 [16] 0.033179005 0.020107763 -0.055238351 0.004526202 -0.058402376 [21] -0.056477726 0.048318175 0.015569541 -0.028194267 -0.022421970 [26] -0.028049280 -0.003007577 0.129464321 0.067608348 0.056213241 [31] 0.109785228 0.008868496 0.066313072 0.174983254 0.095298225 [36] 0.112010324 -0.555450073 0.068773414 -0.009974149 -0.045319674 [41] -0.037165074 0.048291059 -0.023804912 0.003257694 -0.042395825 [46] -0.130209839 -0.031403515 0.039938033 > 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/4qoaw1476909568.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/5uq581476909568.tab") > > try(system("convert tmp/1lmgf1476909568.ps tmp/1lmgf1476909568.png",intern=TRUE)) character(0) > try(system("convert tmp/2str81476909568.ps tmp/2str81476909568.png",intern=TRUE)) character(0) > try(system("convert tmp/3pi4y1476909568.ps tmp/3pi4y1476909568.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.319 0.075 1.408