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 = '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/1hynz1469794510.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/2wu3m1469794510.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/3v3no1469794510.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.4260747205 -0.1955018296 -0.3304697598 -0.1491820787 [6] -0.1022265794 -0.1662100648 -0.0718161578 -0.1216140869 -0.3456244456 [11] -0.2078732835 0.3935784560 0.8408334278 0.3706142533 -0.1695999560 [16] -0.2651768767 -0.1347397794 -0.0917196469 -0.1463455124 -0.0503908249 [21] -0.1140315672 -0.3075466124 -0.1728764593 0.3632589043 0.6970581358 [26] 0.3169722420 -0.1485849360 -0.2313814997 -0.1370597953 -0.0892959401 [31] -0.1069708902 -0.0356674007 -0.1168458027 -0.2930358719 -0.1449512936 [36] 0.3191351917 0.5798553200 0.2807891463 -0.1019966892 -0.1847339382 [41] -0.1321496478 -0.0946513891 -0.0726600033 0.0005283156 -0.0979406073 [46] -0.2565197183 -0.1178630976 0.2680661762 0.4522822881 > (mypacf <- c(rpacf$acf)) [1] 4.260747e-01 -4.606717e-01 -1.941413e-02 -4.017872e-02 -2.282765e-01 [6] -1.486599e-01 9.637448e-03 -4.042318e-01 -5.112574e-01 -1.372431e-01 [11] 2.669706e-01 5.362802e-01 -2.063951e-01 4.246098e-02 6.453330e-02 [16] -1.503220e-02 1.041822e-01 -6.339767e-02 -2.334886e-02 -1.787486e-03 [21] 1.624084e-01 1.203314e-02 8.032764e-05 -1.808565e-02 5.402940e-02 [26] 1.611042e-03 -3.845742e-02 -5.066441e-02 9.212616e-05 6.399560e-02 [31] -3.597187e-02 -5.101328e-02 -8.067177e-02 3.654428e-03 -4.894944e-02 [36] -4.833279e-02 -1.343497e-02 8.862806e-03 3.922600e-02 -3.207567e-02 [41] -4.162617e-02 -3.105959e-03 1.212799e-01 1.290304e-02 4.211684e-02 [46] 7.901438e-03 2.237649e-02 -3.157481e-02 > 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/4yh611469794510.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/5f2py1469794510.tab") > > try(system("convert tmp/1hynz1469794510.ps tmp/1hynz1469794510.png",intern=TRUE)) character(0) > try(system("convert tmp/2wu3m1469794510.ps tmp/2wu3m1469794510.png",intern=TRUE)) character(0) > try(system("convert tmp/3v3no1469794510.ps tmp/3v3no1469794510.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.215 0.139 1.373