R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(88.52,90.15,88.63,88.32,88.51,88.53,88.35,88.4,88.41,88.47,88.46,89.28,89.11,90.74,89.49,88.62,89.09,89.14,89.45,89.33,89.44,89.54,89.52,90.48,90.04,91.93,91.25,89.27,90.57,90.79,90.83,90.76,91.29,91.48,91.63,92.63,91.7,93.86,92.45,92.03,92.71,93.15,92.98,92.73,93.29,93.2,93.34,93.95,93.43,95.67,94.02,93.51,94.6,94.27,94.05,94.1,94.51,94.53,94.2,93.58,94.94,96.24,95.77,94.41,95.09,95.37,95.17,95.05,95.33,95.42,95.95,96.12,96.94,98.73,98.03,97.42,98.39,98.77,98.46,98.3,98.25,98.33,98.61,98.99,98.8,100.26,100.85,98.87,99.81,100.44,100.07,99.8,99.77,99.9,100.58,100.86,101.05,101.3,101.45,101.13,101.38,101.03,100.79,100.84,101.17,101.36,101.14,101.24) > 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.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) 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) > 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/1wqgs1445624339.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/2b23d1445624339.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/37kik1445624339.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.312583070 -0.245933048 0.127181328 0.006844750 [6] 0.038938175 -0.114981951 -0.008675315 -0.008422473 0.128492565 [11] -0.195635308 -0.231255447 0.691834509 -0.149098264 -0.266277196 [16] 0.096002610 0.038590139 0.009555947 -0.114422984 0.009581762 [21] -0.038603886 0.154110813 -0.210064532 -0.171698232 0.543158110 [26] -0.111209641 -0.211479902 0.057223806 0.058908740 0.006420159 [31] -0.103525275 -0.008921732 0.023904380 0.046184872 -0.104271795 [36] -0.205372567 0.446763926 -0.067338841 -0.180664964 0.116595842 [41] 0.009656096 -0.018441284 -0.026574549 -0.016149405 0.040056358 [46] 0.042488724 -0.167601140 -0.101832524 0.340975282 > (mypacf <- c(rpacf$acf)) [1] -0.312583070 -0.380853748 -0.127064660 -0.104058321 0.036540503 [6] -0.109551291 -0.088189433 -0.159955764 0.059462169 -0.207953256 [11] -0.452175632 0.469551216 0.280394560 0.094480041 0.014870385 [16] 0.006830892 -0.107326871 -0.161685556 -0.023510415 -0.055159623 [21] 0.058911624 -0.105912985 -0.087606464 0.016626220 -0.082838082 [26] -0.006085391 0.010215198 0.014662073 -0.012735983 -0.008395068 [31] -0.071772162 0.084362793 -0.170478514 0.036159511 -0.152191987 [36] -0.061029049 -0.118940939 -0.020776643 0.182199653 0.053983627 [41] -0.033704358 0.046377878 0.061257145 0.019364809 0.123363502 [46] -0.093154593 0.039188366 -0.029629762 > 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/49uxc1445624339.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/5frkx1445624339.tab") > > try(system("convert tmp/1wqgs1445624339.ps tmp/1wqgs1445624339.png",intern=TRUE)) character(0) > try(system("convert tmp/2b23d1445624339.ps tmp/2b23d1445624339.png",intern=TRUE)) character(0) > try(system("convert tmp/37kik1445624339.ps tmp/37kik1445624339.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.152 0.225 1.384