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(58109,57087,56064,54019,74712,73689,58109,47763,48785,48785,49808,51964,45718,39462,34339,34339,54019,56064,40484,22859,32183,32183,39462,43663,42640,32183,37417,35362,52987,48785,32183,19782,31160,34339,37417,41507,33205,26038,29116,30138,57087,57087,41507,39462,45718,42640,50942,61288,63343,48785,44685,40484,68567,70622,65388,70622,69589,61288,70622,80968,85169,72667,64365,70622,97570,105872,103827,107916,106894,96548,114173,118374,124519,105872,98593,106894,126675,144300,140099,140099,142154,134976,153634,153634,150455,132820,135999,138054,151579,169204,156701,162958,157724,154656,178538,173304,166025,155679,166025,171259,177505,185806,177505,182628,176381,175359,201285,203441,195140,180583,192984,198208,204464,213788,204464,211743,208564,197185,221066,221066) > 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/13wfx1471215528.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/2efp11471215528.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/3pk3w1471215528.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.00000000 0.01881828 -0.30195234 -0.30955479 -0.14099170 0.19083469 [7] 0.30091133 0.17589409 -0.08905763 -0.33219858 -0.28608822 0.06521247 [13] 0.79803265 0.00369085 -0.25309139 -0.24486040 -0.11794744 0.12776409 [19] 0.27374993 0.15246302 -0.08704546 -0.32578163 -0.18867893 0.07985126 [25] 0.60559535 -0.04128901 -0.18974569 -0.14488892 -0.14057077 0.03367686 [31] 0.28072477 0.15550902 -0.05002182 -0.33009076 -0.18060494 0.07727996 [37] 0.42438741 -0.02609713 -0.11571950 -0.06879341 -0.16347258 -0.05671958 [43] 0.27498031 0.18347099 -0.01688579 -0.31652204 -0.15994118 0.03816143 [49] 0.31764685 > (mypacf <- c(rpacf$acf)) [1] 0.018818279 -0.302413556 -0.326420776 -0.304045228 -0.070775453 [6] 0.095370385 0.211231716 0.185050591 -0.031133669 -0.240332248 [11] -0.235164223 0.676211614 -0.030315526 0.081388141 0.126620649 [16] 0.182845767 -0.102570367 0.015194218 -0.035660041 -0.122823871 [21] -0.095902718 0.175434862 -0.048515304 -0.064562185 -0.054794938 [26] 0.100363828 0.054765345 -0.125405313 -0.166679884 0.074833653 [31] 0.059926102 0.106191825 -0.059265034 -0.134827990 -0.082749138 [36] -0.121372609 0.009597764 -0.133515354 -0.005237135 0.023996983 [41] 0.085498133 0.061591513 0.090510724 -0.034850464 -0.019565635 [46] 0.039174458 -0.023386989 -0.016664556 > 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/4ernv1471215528.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/5jn1a1471215528.tab") > > try(system("convert tmp/13wfx1471215528.ps tmp/13wfx1471215528.png",intern=TRUE)) character(0) > try(system("convert tmp/2efp11471215528.ps tmp/2efp11471215528.png",intern=TRUE)) character(0) > try(system("convert tmp/3pk3w1471215528.ps tmp/3pk3w1471215528.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.169 0.102 1.285