R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" 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(98.98,98.97,98.91,98.98,98.95,98.96,98.96,99.04,99.33,100.04,100.14,100.21,100.21,100.27,100.44,100.57,100.51,100.47,100.47,100.49,101,101.61,101.65,101.74,101.74,101.73,101.77,101.82,101.97,102.09,102.09,102.08,102.42,102.78,103.04,103.08,99.16,99.19,99.23,99.31,99.46,99.49,99.95,100.14,100.43,101.1,101.26,101.28,101.04,101.12,101.07,100.97,101.01,100.99,101.19,101.25,101.33,101.79,102.06,102.09,102.27,102.26,102.46,102.46,102.51,102.56,102.59,102.26,102.33,102.84,102.93,102.95) > 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/1zfay1476909821.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/20wne1476909821.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/3c1e31476909821.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.060467637 -0.036816592 -0.071771017 -0.091808558 [6] 0.013934054 -0.082761931 -0.052532515 -0.079732893 -0.140382856 [11] -0.025413573 0.062862386 0.155580390 0.030446567 0.034654741 [16] -0.079024090 -0.101782574 0.024284756 -0.024347585 0.020783894 [21] 0.023618637 -0.105272152 -0.071147812 0.026213590 0.043529223 [26] 0.046132210 -0.034006281 -0.135943485 -0.058345085 -0.005203025 [31] 0.014694452 0.093594302 0.011648739 -0.092725433 0.025168881 [36] 0.034137586 0.044990207 0.033078937 -0.004517533 -0.015269114 [41] -0.007769158 -0.007014059 -0.004807086 -0.004790504 -0.006184142 [46] 0.001373049 -0.006907890 -0.004504582 0.030345049 > (mypacf <- c(rpacf$acf)) [1] 0.060467637 -0.040621453 -0.067355099 -0.085595470 0.019310977 [6] -0.097526892 -0.054409573 -0.089596772 -0.151502012 -0.049244331 [11] 0.030948696 0.108475587 -0.015974304 0.035742475 -0.093218592 [16] -0.104649538 0.007329920 -0.039820664 0.009499294 0.049825492 [21] -0.082610332 -0.092270104 0.005591340 -0.033203151 -0.017146036 [26] -0.043933559 -0.133865819 -0.064577843 -0.032337784 -0.051452810 [31] 0.016809115 -0.018081770 -0.117261233 0.003815114 -0.004024491 [36] -0.040083830 -0.032073454 0.006015819 -0.011888169 0.008207189 [41] 0.003378446 -0.069552249 -0.070945885 -0.015779077 -0.013335864 [46] -0.021952969 0.002625788 -0.041225814 > 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/4fmjj1476909821.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/5xnta1476909821.tab") > > try(system("convert tmp/1zfay1476909821.ps tmp/1zfay1476909821.png",intern=TRUE)) character(0) > try(system("convert tmp/20wne1476909821.ps tmp/20wne1476909821.png",intern=TRUE)) character(0) > try(system("convert tmp/3c1e31476909821.ps tmp/3c1e31476909821.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.219 0.112 1.347