R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" 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(80.44,80.9,81.03,81.6,81.56,82.08,83.44,83.55,82.63,82.43,82.42,82.48,82.51,83.23,83.41,83.88,83.96,84.32,85.82,85.72,84.36,84.36,84.36,85.08,84.95,85.62,86.22,86.4,86.71,87.51,89.22,89.43,88.24,88.9,88.78,89.25,88.8,89.46,89.66,90.29,90.08,90.42,92.14,92.09,91.35,91.22,90.99,91.48,90.98,91.52,91.62,92.12,92.26,92.18,94.12,93.82,93.2,93.34,93.11,93.63,93.29,93.69,94.19,94.82,94.52,94.94,96.87,96.6,95.43,95.56,95.37,96,95.6,96.17,96.26,97.2,97.23,97.74,99.37,99.37,98.22,98.27,97.98,98.53,97.98,98.63,98.74,99.37,99.51,99.66,101.62,101.71,100.49,100.81,100.48,101.01,100.62,101.12,101.45,101.34,101.39,101.93,102.42,102.18,102.72,102.43,102.35,102.69) > 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/1ka1n1452212115.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/2uejv1452212115.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/3uolv1452212115.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.968515102 0.938647503 0.910072046 0.881837212 [6] 0.853088582 0.824237220 0.802009950 0.780411380 0.755023355 [11] 0.728769293 0.704206951 0.680236078 0.647324628 0.616862805 [16] 0.587006240 0.558799646 0.526641806 0.494605216 0.472528790 [21] 0.449820568 0.422668812 0.396519791 0.371784288 0.349712645 [26] 0.319237910 0.291121459 0.264500646 0.238181034 0.208779539 [31] 0.180301052 0.161427932 0.143679744 0.121808846 0.103260048 [36] 0.085548123 0.069964468 0.046604714 0.025974077 0.005785776 [41] -0.012589582 -0.034801903 -0.057830061 -0.071042497 -0.083575006 [46] -0.099692422 -0.114924438 -0.128973652 -0.141337635 > (mypacf <- c(rpacf$acf)) [1] 0.968515102 0.010100286 0.006092987 -0.008412593 -0.022569774 [6] -0.017322251 0.090797359 0.002756212 -0.069290362 -0.029999021 [11] 0.008437059 -0.004936239 -0.147904572 0.017309243 -0.022311725 [16] 0.003515376 -0.074351266 -0.016390097 0.114906879 -0.018987431 [21] -0.072632108 0.001713641 -0.009840284 0.022016321 -0.108984479 [26] 0.010544514 -0.020691544 -0.026049540 -0.044828831 -0.003702335 [31] 0.086356082 0.011458438 -0.058827005 0.038788692 -0.025739123 [36] 0.009414780 -0.072513081 0.013859421 -0.045157572 0.004453528 [41] -0.051928509 -0.034019732 0.074160656 0.005350456 -0.045726301 [46] -0.018499018 -0.018861256 -0.006472071 > 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/4ig1c1452212115.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/5sa3m1452212115.tab") > > try(system("convert tmp/1ka1n1452212115.ps tmp/1ka1n1452212115.png",intern=TRUE)) character(0) > try(system("convert tmp/2uejv1452212115.ps tmp/2uejv1452212115.png",intern=TRUE)) character(0) > try(system("convert tmp/3uolv1452212115.ps tmp/3uolv1452212115.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.348 0.269 1.621