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(2.32,1.93,0.62,0.6,-0.37,-1.1,-1.68,-0.77,-1.2,-0.97,-0.12,0.26,0.62,0.7,1.65,1.79,2.28,2.46,2.57,2.32,2.91,3.01,2.87,3.11,3.22,3.38,3.52,3.41,3.35,3.68,3.75,3.6,3.56,3.57,3.85,3.48,3.65,3.66,3.36,3.19,2.81,2.25,2.32,2.85,2.75,2.78,2.26,2.23,1.46,1.19,1.11,1,1.18,1.59,1.51,1.01,0.9,0.63,0.81,0.97,1.14,0.97,0.89,0.62,0.36,0.27,0.34,0.02,-0.12,0.09,-0.11,-0.38,-0.65,-0.4,-0.4,0.29,0.56,0.63,0.46,0.91,1.06,1.28,1.52,1.5) > 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/1mlrv1484012758.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/234qw1484012758.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/3lhmb1484012758.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.211984475 0.250484271 0.162181104 0.192211643 [6] -0.142308955 0.049132704 0.121759427 -0.128749401 0.003886657 [11] -0.083273044 -0.052857258 -0.345225664 0.041165569 -0.064033499 [16] -0.038925952 0.041046145 0.045390300 -0.128843671 -0.059800957 [21] -0.038129489 -0.143615793 0.056134612 0.032968620 -0.083519713 [26] -0.139071358 -0.034837897 -0.071415110 -0.168572782 -0.003475380 [31] -0.044461583 -0.097057972 -0.068272462 0.053026644 -0.159784944 [36] -0.075098561 0.075097257 -0.017578779 -0.061705911 -0.027979958 [41] 0.016092281 -0.165183999 0.043942928 0.050225089 0.089598262 [46] 0.019245785 0.126642497 -0.019938065 -0.062631349 > (mypacf <- c(rpacf$acf)) [1] 0.21198448 0.21521820 0.08221911 0.11074664 -0.26651164 0.04385705 [7] 0.18806594 -0.20630354 0.07213747 -0.14742366 -0.03369074 -0.22139336 [13] 0.12801497 0.09699487 -0.02584671 0.12240453 -0.15024149 -0.14328997 [19] 0.10421012 -0.18090266 0.03865280 0.15304702 -0.08097754 -0.19491909 [25] -0.07343908 -0.01357425 0.10473585 -0.05605606 -0.02535163 -0.17131627 [31] -0.04638496 -0.02275624 0.03316018 0.01635923 -0.05319962 -0.03177141 [37] -0.07218376 -0.13935298 -0.04100607 0.01633204 -0.06142356 0.07794500 [43] 0.00480308 -0.01516306 -0.02557200 -0.07486748 -0.03500546 -0.04875110 > 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/49eni1484012758.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/5txlq1484012758.tab") > > try(system("convert tmp/1mlrv1484012758.ps tmp/1mlrv1484012758.png",intern=TRUE)) character(0) > try(system("convert tmp/234qw1484012758.ps tmp/234qw1484012758.png",intern=TRUE)) character(0) > try(system("convert tmp/3lhmb1484012758.ps tmp/3lhmb1484012758.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.379 0.095 1.526