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(78.46,78.59,81.37,83.61,83.85,84.08,84.56,84.65,85.41,85.75,86.21,86.38,86.65,87.30,87.87,88.23,88.33,88.62,88.67,88.85,88.87,89.20,89.38,89.65,90.37,90.38,91.43,92.09,92.21,92.31,92.62,93.13,93.17,93.42,93.50,95.75,97.29,98.01,98.02,98.20,98.29,98.39,98.42,98.70,98.90,99.04,99.31,99.34,99.35,99.51,99.88,99.91,100.30,100.74,101.16,101.30,101.37,101.68,101.68,101.89,101.93,102.66,102.68,103.13,103.14,104.01,104.17,104.41,104.71,105.51,105.98,106.25) > 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/1b6sr1489659852.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/2ksax1489659852.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/3pinf1489659852.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.00000000 0.94411072 0.88522444 0.83706538 0.79902630 0.76055035 [7] 0.72167142 0.68314595 0.64573234 0.60942858 0.57351744 0.53746662 [13] 0.50186551 0.46554155 0.43079957 0.39687625 0.36385484 0.32994498 [19] 0.29606319 0.26184778 0.22806667 0.19400756 0.15953211 0.12481907 [25] 0.08985452 0.05568693 0.01983462 -0.01250756 -0.04326604 -0.07480443 [31] -0.10676323 -0.13902670 -0.17012429 -0.20314676 -0.23820632 -0.27572788 [37] -0.30313888 -0.32013938 -0.32809908 -0.33657928 -0.34445027 -0.35263001 [43] -0.35978286 -0.36678833 -0.37321154 -0.37936179 -0.38349737 -0.38396345 [49] -0.38508202 > (mypacf <- c(rpacf$acf)) [1] 0.9441107206 -0.0563307661 0.0685027874 0.0618167324 -0.0218043188 [6] -0.0094590616 -0.0122553563 -0.0124315287 -0.0110400821 -0.0167722750 [11] -0.0210011281 -0.0167391596 -0.0299557696 -0.0085392898 -0.0177067004 [16] -0.0148646015 -0.0294012518 -0.0223520001 -0.0290638738 -0.0236720795 [21] -0.0304949604 -0.0320557963 -0.0314660419 -0.0343913008 -0.0253839487 [26] -0.0500428497 -0.0003100449 -0.0224284075 -0.0385164080 -0.0311624165 [31] -0.0385922229 -0.0282689836 -0.0575682439 -0.0588718338 -0.0693480434 [36] 0.0413885619 0.0439576830 0.0594438988 -0.0061908148 0.0087141842 [41] -0.0141982220 -0.0111656229 -0.0196951188 -0.0159770724 -0.0186183703 [46] -0.0042287395 0.0127885767 -0.0280678722 > 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/4fqnu1489659852.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/5ii7i1489659852.tab") > > try(system("convert tmp/1b6sr1489659852.ps tmp/1b6sr1489659852.png",intern=TRUE)) character(0) > try(system("convert tmp/2ksax1489659852.ps tmp/2ksax1489659852.png",intern=TRUE)) character(0) > try(system("convert tmp/3pinf1489659852.ps tmp/3pinf1489659852.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.572 0.149 1.800