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 = '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/1fbol1489658274.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/21g671489658274.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/3ddwt1489658274.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.000000e+00 3.647746e-01 -5.496383e-02 -3.640205e-01 -2.714213e-01 [6] -1.324190e-01 -6.554288e-03 -3.762761e-02 -1.720986e-01 -1.935105e-01 [11] -9.334002e-02 2.794354e-01 4.039879e-01 2.785235e-01 5.731840e-03 [16] -2.173172e-01 -1.961204e-01 -9.838926e-02 -6.265681e-02 -3.178586e-02 [21] -9.220529e-02 -8.456536e-02 -3.459260e-02 2.584273e-01 3.213651e-01 [26] 1.700748e-01 -5.638673e-02 -2.094073e-01 -1.933045e-01 -5.910252e-02 [31] 2.446610e-02 5.554395e-04 -2.182708e-02 -1.292178e-01 -1.204007e-02 [36] 1.247365e-01 2.970244e-01 1.983271e-01 -8.882900e-03 -1.930446e-01 [41] -9.263622e-02 -9.502472e-02 -2.072060e-02 5.629835e-03 2.071688e-03 [46] 6.976566e-05 -1.781601e-05 > (mypacf <- c(rpacf$acf)) [1] 0.3647746485 -0.2168829305 -0.3153254612 -0.0321721896 -0.0902593691 [6] -0.0916490491 -0.1564707498 -0.2716454937 -0.2029138227 -0.1857786803 [11] 0.1610617498 0.0762401674 -0.0097606572 0.0207747790 -0.0776216408 [16] 0.0328969863 -0.0204996172 -0.1471614664 0.0081519086 -0.0890227047 [21] -0.0161714059 -0.0963730157 0.1561378850 0.0546791855 -0.1032203233 [26] 0.0334930949 -0.0700457897 -0.0598543575 0.0790284700 -0.0471783283 [31] 0.0005379586 0.0384798343 -0.1073819796 0.0155060005 -0.0748938314 [36] 0.1307537959 -0.0098370563 -0.0082482033 0.0597232306 0.1247343372 [41] -0.0420798602 0.0261143631 0.0212147583 0.0860602914 0.1059922143 [46] 0.0284520725 > 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/4338g1489658274.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/53n121489658274.tab") > > try(system("convert tmp/1fbol1489658274.ps tmp/1fbol1489658274.png",intern=TRUE)) character(0) > try(system("convert tmp/21g671489658274.ps tmp/21g671489658274.png",intern=TRUE)) character(0) > try(system("convert tmp/3ddwt1489658274.ps tmp/3ddwt1489658274.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.322 0.118 1.477