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(91.16,91.17,91.17,91.38,92.68,92.72,92.79,92.81,92.81,92.81,92.81,92.81,92.81,92.82,92.82,92.88,93.38,93.89,94.1,94.18,94.3,94.31,94.36,94.38,94.38,94.5,94.57,94.89,96.71,97.57,97.88,97.97,98.4,98.51,98.46,98.46,98.48,98.6,98.6,98.71,99.13,99.2,99.3,100.18,101.37,101.77,102.28,102.38,102.35,103.23,105.37,106.62,107,107.24,107.31,107.35,107.42,107.58,107.64,107.64,107.68,108.51,110.37,111.31,111.57,111.66,111.69,111.9,111.95,112.04,112.13,112.14) > 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/1tpxi1476876587.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/2jnwb1476876587.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/35ubr1476876587.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.963763214 0.923477671 0.881602398 0.839294352 [6] 0.799221500 0.758642053 0.716685040 0.673523989 0.630211129 [11] 0.589297150 0.553585127 0.518419565 0.480351607 0.440186727 [16] 0.398922204 0.357005945 0.315066645 0.273047178 0.229921737 [21] 0.186393711 0.143432529 0.103290696 0.068768752 0.035825835 [26] 0.001227248 -0.033746519 -0.067417044 -0.099417686 -0.123079374 [31] -0.141947156 -0.160204010 -0.178433764 -0.194840920 -0.212191425 [36] -0.231584757 -0.251695771 -0.272317364 -0.292973031 -0.314059964 [41] -0.335041644 -0.354085336 -0.373027860 -0.391011604 -0.403911319 [46] -0.407599101 -0.409972796 -0.412112743 -0.414409699 > (mypacf <- c(rpacf$acf)) [1] 0.963763214 -0.075348881 -0.040342243 -0.026182667 0.009574374 [6] -0.032613766 -0.042950410 -0.039526338 -0.024415497 0.007971048 [11] 0.043843544 -0.024872603 -0.068145056 -0.050146384 -0.034891764 [16] -0.037583808 -0.035557757 -0.036036267 -0.047108433 -0.033149895 [21] -0.020675726 0.001692982 0.033245413 -0.023304624 -0.061776574 [26] -0.037428256 -0.012020972 -0.015318772 0.075056357 0.025060580 [31] -0.024365576 -0.021433940 0.013751265 -0.044732375 -0.075253104 [36] -0.051225599 -0.037939370 -0.028298562 -0.028283471 -0.030168910 [41] -0.019930705 -0.046888239 -0.027255802 0.029805739 0.088742631 [46] -0.029281497 -0.040333242 -0.032136517 > 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/48mnt1476876587.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/5m16w1476876587.tab") > > try(system("convert tmp/1tpxi1476876587.ps tmp/1tpxi1476876587.png",intern=TRUE)) character(0) > try(system("convert tmp/2jnwb1476876587.ps tmp/2jnwb1476876587.png",intern=TRUE)) character(0) > try(system("convert tmp/35ubr1476876587.ps tmp/35ubr1476876587.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.112 0.102 1.226