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(97.78,97.73,97.61,97.69,97.68,97.67,97.67,97.96,98.27,99.52,99.59,99.75,99.75,99.8,99.99,100.25,100.08,100.08,100.08,100.06,101,101.81,101.82,101.96,101.96,101.93,102.03,102.11,102.07,102.34,102.34,102.33,102.77,103.08,103.38,103.44,99.1,99.15,99.21,99.01,99.08,99.11,100.11,100.31,100.55,101.38,101.49,101.5,100.69,100.8,100.58,100.34,100.38,100.33,101.06,101.15,101.36,101.98,102.24,102.34,101.91,101.8,101.8,101.73,101.8,101.81,102.28,101.7,101.7,102.37,102.43,102.41) > 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/108pm1476875620.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/27dff1476875620.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/3pz8h1476875620.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.050729220 -0.022556776 0.005630711 -0.092374202 [6] -0.005975361 -0.220109657 -0.080868565 -0.033987939 -0.122505174 [11] -0.013668973 0.085475018 0.298718720 0.021483211 0.070822982 [16] -0.070139526 -0.159976079 0.023786613 -0.160853357 -0.015349049 [21] 0.026082369 -0.104524261 -0.023346343 0.028054414 0.161499091 [26] 0.043166340 0.000424263 -0.181304877 -0.069205960 -0.043886268 [31] -0.088569789 0.106766246 0.022553250 -0.055960764 0.068131252 [36] 0.050405222 0.056699169 0.038089720 -0.006350503 -0.050772577 [41] -0.031486839 -0.040191374 -0.017045113 -0.002154875 -0.008299027 [46] 0.035130496 0.010399944 -0.007339865 0.041314847 > (mypacf <- c(rpacf$acf)) [1] 0.0507292200 -0.0251950677 0.0081079543 -0.0939647976 0.0041866756 [6] -0.2275463762 -0.0589705984 -0.0564031181 -0.1292202663 -0.0564271860 [11] 0.0656069059 0.2538573233 -0.0449508947 0.0842764933 -0.1386859585 [16] -0.1504619377 0.0284694652 -0.0746093275 0.0160576549 0.0653196927 [21] -0.0513419955 -0.1143518125 -0.0112199607 0.0291091110 -0.0462085511 [26] -0.0059675005 -0.1993396103 -0.0350077726 -0.0745623173 -0.0046121414 [31] 0.0450359061 0.0094872173 -0.0762177497 0.0030280800 0.0327062477 [36] -0.1003572831 0.0007806330 -0.0008563695 0.0150136107 0.0336825217 [41] 0.0481611663 -0.0427602527 -0.1353702759 -0.0094443622 -0.0288114076 [46] -0.0081941684 0.0205432840 -0.0403707717 > 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/4at7o1476875620.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/5e5cl1476875620.tab") > > try(system("convert tmp/108pm1476875620.ps tmp/108pm1476875620.png",intern=TRUE)) character(0) > try(system("convert tmp/27dff1476875620.ps tmp/27dff1476875620.png",intern=TRUE)) character(0) > try(system("convert tmp/3pz8h1476875620.ps tmp/3pz8h1476875620.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.252 0.082 1.357