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(7175,7048.75,6922.5,6670,9225,9098.75,7175,5897.5,6023.75,6023.75,6150,6416.25,5645,4872.5,4240,4240,6670,6922.5,4998.75,2822.5,3973.75,3973.75,4872.5,5391.25,5265,3973.75,4620,4366.25,6542.5,6023.75,3973.75,2442.5,3847.5,4240,4620,5125,4100,3215,3595,3721.25,7048.75,7048.75,5125,4872.5,5645,5265,6290,7567.5,7821.25,6023.75,5517.5,4998.75,8466.25,8720,8073.75,8720,8592.5,7567.5,8720,9997.5,10516.25,8972.5,7947.5,8720,12047.5,13072.5,12820,13325,13198.75,11921.25,14097.5,14616.25,15375,13072.5,12173.75,13198.75,15641.25,17817.5,17298.75,17298.75,17552.5,16666.25,18970,18970,18577.5,16400,16792.5,17046.25,18716.25,20892.5,19348.75,20121.25,19475,19096.25,22045,21398.75,20500,19222.5,20500,21146.25,21917.5,22942.5,21917.5,22550,21778.75,21652.5,24853.75,25120,24095,22297.5,23828.75,24473.75,25246.25,26397.5,25246.25,26145,25752.5,24347.5,27296.25,27296.25) > 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/10ao31470837188.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/2b70b1470837188.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/3mwq31470837188.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.966415594 0.931663836 0.911826726 0.897320360 [6] 0.887642224 0.873800155 0.846519039 0.815094091 0.787612190 [11] 0.770882482 0.765646265 0.754209385 0.715799749 0.676715243 [16] 0.651220323 0.632168292 0.616301769 0.597813632 0.566949661 [21] 0.531611937 0.500930741 0.480796223 0.469309281 0.452553114 [26] 0.415318333 0.376305877 0.349466561 0.325371774 0.305218038 [31] 0.284924037 0.250773705 0.215135142 0.185300791 0.165622316 [36] 0.152000015 0.131166570 0.095611707 0.059587437 0.031897015 [41] 0.003853908 -0.016649137 -0.035910297 -0.066429730 -0.098184178 [46] -0.123797015 -0.138450384 -0.149949272 -0.167092087 > (mypacf <- c(rpacf$acf)) [1] 0.966415594 -0.034755195 0.208418793 0.063766119 0.117390016 [6] -0.037902659 -0.169762487 -0.089848749 -0.040235975 0.096083851 [11] 0.158376526 -0.025335356 -0.334452315 -0.030766065 0.064341846 [16] 0.019979018 -0.002377645 0.007741283 -0.062072546 -0.037211079 [21] -0.031934348 0.010412137 0.031308982 0.016602797 -0.133457538 [26] -0.049394355 0.018727509 -0.074218195 0.005434680 0.017237899 [31] -0.079184762 0.027799161 -0.018737221 0.026987003 -0.021645588 [36] -0.042848302 -0.054524443 -0.031963376 -0.030209968 -0.122954713 [41] 0.051233560 0.020081977 -0.002535083 0.005901760 -0.015460148 [46] 0.058256929 -0.040549570 -0.009774218 > 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/44bqe1470837188.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/5y4101470837188.tab") > > try(system("convert tmp/10ao31470837188.ps tmp/10ao31470837188.png",intern=TRUE)) character(0) > try(system("convert tmp/2b70b1470837188.ps tmp/2b70b1470837188.png",intern=TRUE)) character(0) > try(system("convert tmp/3mwq31470837188.ps tmp/3mwq31470837188.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.249 0.145 1.418