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(36439.00 + ,36368.00 + ,36290.00 + ,36147.00 + ,37615.00 + ,37543.00 + ,36439.00 + ,35705.00 + ,35777.00 + ,35777.00 + ,35848.00 + ,35998.00 + ,35998.00 + ,35335.00 + ,35043.00 + ,35335.00 + ,36368.00 + ,36218.00 + ,34822.00 + ,33640.00 + ,33419.00 + ,32977.00 + ,33276.00 + ,33640.00 + ,33497.00 + ,33198.00 + ,32614.00 + ,33198.00 + ,33718.00 + ,33568.00 + ,31873.00 + ,31139.00 + ,30405.00 + ,29814.00 + ,29743.00 + ,30184.00 + ,29593.00 + ,29372.00 + ,29151.00 + ,30405.00 + ,30548.00 + ,29814.00 + ,27826.00 + ,26943.00 + ,25547.00 + ,24955.00 + ,25247.00 + ,25689.00 + ,25689.00 + ,25326.00 + ,25247.00 + ,26430.00 + ,27385.00 + ,26943.00 + ,25468.00 + ,24735.00 + ,23189.00 + ,22234.00 + ,22968.00 + ,23702.00 + ,23702.00 + ,22747.00 + ,22676.00 + ,23922.00 + ,24735.00 + ,24442.00 + ,22968.00 + ,22013.00 + ,19947.00 + ,19142.00 + ,19434.00 + ,20688.00 + ,20759.00 + ,18921.00 + ,19584.00 + ,21201.00 + ,21935.00 + ,21493.00 + ,19506.00 + ,18109.00 + ,16492.00 + ,15238.00 + ,15751.00 + ,16855.00 + ,16563.00 + ,14946.00 + ,15459.00 + ,17076.00 + ,17960.00 + ,17447.00 + ,15459.00 + ,14576.00 + ,13251.00 + ,11854.00 + ,12075.00 + ,13179.00 + ,13322.00 + ,11997.00 + ,12218.00 + ,14063.00 + ,14504.00 + ,13764.00 + ,11042.00 + ,9646.00 + ,7801.00 + ,5963.00 + ,6554.00 + ,7359.00 + ,7217.00 + ,5813.00 + ,6625.00 + ,8613.00 + ,9496.00 + ,9055.00 + ,7288.00 + ,5892.00 + ,4417.00 + ,2721.00 + ,3021.00 + ,3534.00) > 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/10z301469793100.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/2gvj71469793100.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/3fye31469793100.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.0000000000 0.9709045438 0.9360793061 0.9019584898 0.8732689108 [6] 0.8459973707 0.8213666564 0.8018726427 0.7839957863 0.7650761868 [11] 0.7455143074 0.7257918087 0.7036067784 0.6726683341 0.6367769843 [16] 0.6011319847 0.5700297254 0.5413583774 0.5153569311 0.4962826414 [21] 0.4797168396 0.4632088058 0.4465535951 0.4302342194 0.4114922836 [26] 0.3852183933 0.3537041420 0.3232973617 0.2961371800 0.2712678642 [31] 0.2482868529 0.2310612319 0.2153684973 0.1996887041 0.1843413192 [36] 0.1690780731 0.1522965782 0.1304682396 0.1037621962 0.0768882837 [41] 0.0518558824 0.0300648262 0.0118451488 -0.0005044854 -0.0115055706 [46] -0.0215304303 -0.0314455563 -0.0420883368 -0.0532590383 > (mypacf <- c(rpacf$acf)) [1] 0.9709045438 -0.1146813118 0.0041007584 0.0746545778 -0.0085045185 [6] 0.0310567354 0.0773768189 0.0034040886 -0.0233268336 -0.0010939569 [11] -0.0063647944 -0.0512961979 -0.1528973447 -0.0788231376 -0.0172622193 [16] 0.0282242405 -0.0069321690 0.0090183563 0.0860706807 0.0055785393 [21] 0.0006466806 0.0227970862 0.0100192528 -0.0378288370 -0.1028815521 [26] -0.0696989227 -0.0004158595 -0.0079650772 -0.0177543942 -0.0134524886 [31] 0.0433670834 -0.0235650167 -0.0040029430 0.0292659102 -0.0015337959 [36] -0.0186854405 -0.0441015713 -0.0580064143 -0.0197131618 -0.0245499606 [41] 0.0001967775 0.0127682122 0.0348804403 -0.0282571388 0.0173799309 [46] 0.0185932252 -0.0166000835 0.0065618072 > 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/41ibs1469793100.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/5j2rp1469793100.tab") > > try(system("convert tmp/10z301469793100.ps tmp/10z301469793100.png",intern=TRUE)) character(0) > try(system("convert tmp/2gvj71469793100.ps tmp/2gvj71469793100.png",intern=TRUE)) character(0) > try(system("convert tmp/3fye31469793100.ps tmp/3fye31469793100.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.262 0.082 1.371