R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(91.04,91.37,91.36,91.4,91.54,91.57,91.57,91.47,91.55,91.71,91.71,92.12,93.28,94.02,94.26,94.19,94.34,94.62,94.9,96.08,96.85,96.61,96.47,96.68,96.43,96.35,96.14,95.39,95.08,94.86,94.8,95.62,96.35,96.77,96.97,96.78,97.71,98.04,98.41,100.05,100.9,100.61,100.71,100.06,100.57,101.03,100.93,100.98,100.46,101.52,101.29,101.84,102.03,101.72,102.23,102.38,102.5,101.5,101.96,101.61) > 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.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) 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) > 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/16jhh1445586702.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/2qfpq1445586702.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/36agl1445586702.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.154251510 0.088728106 -0.022487565 -0.124981358 [6] 0.051007567 -0.016754087 0.087762705 -0.151421881 -0.121821903 [11] -0.224928593 -0.136789009 -0.139897344 -0.006417378 -0.058121643 [16] -0.136078182 -0.008094798 -0.103389696 -0.025978876 0.191403938 [21] 0.197346134 0.037561396 0.020820271 -0.055160601 -0.032248389 [26] -0.001960855 0.061630342 0.098318373 0.006766678 -0.039004053 [31] 0.029784114 -0.021284022 0.079227347 0.017392209 -0.088854831 [36] 0.035458076 0.003825577 -0.030054489 -0.026783987 0.006258251 [41] -0.039452824 -0.004823348 0.009868193 0.002880040 -0.046349772 [46] -0.068597884 -0.016395902 -0.033906263 0.002573154 > (mypacf <- c(rpacf$acf)) [1] 0.154251510 0.066517258 -0.046840839 -0.124720602 0.096664305 [6] -0.018381886 0.076620237 -0.198241946 -0.068845317 -0.191517083 [11] -0.042482879 -0.171315860 0.050569042 -0.139952743 -0.098601073 [16] -0.043321488 -0.074264399 -0.137281610 0.186793603 0.052044784 [21] -0.095375842 -0.074463145 -0.062428637 -0.089549601 -0.088082591 [26] -0.051123903 0.027204222 -0.004830772 -0.070825351 0.108352248 [31] 0.002336007 0.054537545 -0.071758307 -0.049721442 0.024976602 [36] 0.072645468 -0.060415442 -0.031369144 -0.045782924 -0.018622309 [41] 0.024805273 0.070445987 0.018828751 -0.006990422 -0.030465635 [46] -0.051086913 -0.021994509 -0.029451893 > 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/47gft1445586702.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/5s8p71445586702.tab") > > try(system("convert tmp/16jhh1445586702.ps tmp/16jhh1445586702.png",intern=TRUE)) character(0) > try(system("convert tmp/2qfpq1445586702.ps tmp/2qfpq1445586702.png",intern=TRUE)) character(0) > try(system("convert tmp/36agl1445586702.ps tmp/36agl1445586702.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.095 0.225 1.329