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(95.2,95.34,95.32,96.04,99.65,100.85,108.18,108.18,103.14,99.71,99.39,98.99,98.83,99.52,99.5,99.5,99.39,101.79,106.03,105.41,104.32,101.17,99.79,100.08,100.27,101.63,101.74,103.73,103.29,105.71,107.42,107.57,105.13,103.61,102.35,102.14,104.32,104.69,106.02,104.78,106.36,109.27,113.46,113.46,110.61,104.37,103.82,104.1) > 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/17wf91489652579.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/2cjo61489652579.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/3x17w1489652579.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.0000000000 0.8161387822 0.5251193568 0.2472475387 0.0714246451 [6] 0.0012823096 -0.0221045067 0.0281069884 0.0931036909 0.1638003335 [11] 0.2565546966 0.3738146491 0.4043803520 0.3166268433 0.1521371110 [16] -0.0172893680 -0.1268246425 -0.1854428251 -0.1950931342 -0.1462178076 [21] -0.0909790977 -0.0199344730 0.0486243366 0.1135320220 0.1060749846 [26] 0.0054746443 -0.1328151981 -0.2562741578 -0.3054277441 -0.3049707370 [31] -0.2671687682 -0.2156156578 -0.1593339570 -0.1191637665 -0.0554829615 [36] -0.0005987816 0.0159558377 -0.0351414691 -0.1418464028 -0.2344051741 [41] -0.2872982601 -0.3070277834 -0.2738273105 -0.1860804965 -0.0972251684 [46] -0.0290846547 -0.0169059915 -0.0098188269 > (mypacf <- c(rpacf$acf)) [1] 0.816138782 -0.422149662 -0.064541460 0.095892801 0.037712268 [6] -0.074960211 0.205813354 -0.009350563 0.075650056 0.216490655 [11] 0.225389416 -0.238425161 -0.077352020 -0.007471751 -0.080739044 [16] -0.045941512 -0.013107006 -0.124525910 0.054078106 -0.047313552 [21] 0.054314059 -0.053412679 0.076461345 -0.198195875 -0.060484785 [26] -0.003759385 -0.044353642 -0.006026215 0.029543925 -0.116090304 [31] -0.011094778 0.045221793 -0.092841670 0.099453222 0.004919525 [36] -0.027303540 -0.054246298 0.019602716 -0.067544796 -0.038295835 [41] -0.084141758 0.035399860 0.077079964 -0.035248354 -0.077055021 [46] -0.089402132 0.064191541 > 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/44gr81489652579.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/57ia61489652579.tab") > > try(system("convert tmp/17wf91489652579.ps tmp/17wf91489652579.png",intern=TRUE)) character(0) > try(system("convert tmp/2cjo61489652579.ps tmp/2cjo61489652579.png",intern=TRUE)) character(0) > try(system("convert tmp/3x17w1489652579.ps tmp/3x17w1489652579.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.275 0.075 1.372