R version 3.3.3 (2017-03-06) -- "Another Canoe" Copyright (C) 2017 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(97.96,98.36,98.36,98.51,98.77,98.78,98.89,98.87,99.05,99.09,99.1,99.12,99.37,99.46,99.6,99.87,99.88,100.01,100.02,100.19,100.2,100.35,100.47,100.57,101.41,101.67,101.82,101.86,101.98,102.06,102.17,102.2,102.35,102.47,102.55,102.62,102.81,102.88,102.94,102.95,102.94,103.05,103.09,103.1,103.14,103.19,103.36,103.43,103.62,103.79,103.9,103.92,103.94,103.98,104.04,104.09,104.16,104.22,104.28,104.32) > 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/13f0u1495044758.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/2lc2v1495044758.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/3mcda1495044758.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.95242631 0.90844757 0.86196152 0.81562652 0.77166995 [7] 0.72580265 0.68031505 0.63231841 0.58495692 0.53523849 0.48444982 [13] 0.43285819 0.38429001 0.33553674 0.28888232 0.24539730 0.20038623 [19] 0.15567620 0.10943585 0.06575669 0.01949139 -0.02673064 -0.07258173 [25] -0.11892082 -0.15242681 -0.18291980 -0.21158427 -0.23945280 -0.26481840 [31] -0.28993859 -0.31314947 -0.33623033 -0.35689655 -0.37654220 -0.39437052 [37] -0.40920857 -0.41197888 -0.41321180 -0.41271267 -0.41064940 -0.40931955 [43] -0.40483669 -0.40024447 -0.39452421 -0.38867490 -0.37966803 -0.36688884 [49] -0.35250531 > (mypacf <- c(rpacf$acf)) [1] 0.9524263088 0.0143372135 -0.0486513622 -0.0252380019 0.0008564448 [6] -0.0436260863 -0.0251804258 -0.0530120208 -0.0239592087 -0.0547021755 [11] -0.0458150124 -0.0442249971 -0.0020731165 -0.0359939621 -0.0143889530 [16] -0.0001927207 -0.0469705443 -0.0377367029 -0.0523567197 -0.0146666851 [21] -0.0677018969 -0.0498464952 -0.0453358740 -0.0533794326 0.0859920474 [26] 0.0032284875 -0.0236017301 -0.0272076638 -0.0074843256 -0.0364679860 [31] -0.0215112285 -0.0446584938 -0.0193383365 -0.0375337366 -0.0280594620 [36] -0.0188242027 0.1041587386 -0.0068458972 -0.0085950061 -0.0034241257 [41] -0.0300104713 -0.0027336602 -0.0293788767 -0.0202560725 -0.0351929660 [46] -0.0031772067 0.0098289895 -0.0041804855 > 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/46d191495044758.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/5664n1495044758.tab") > > try(system("convert tmp/13f0u1495044758.ps tmp/13f0u1495044758.png",intern=TRUE)) character(0) > try(system("convert tmp/2lc2v1495044758.ps tmp/2lc2v1495044758.png",intern=TRUE)) character(0) > try(system("convert tmp/3mcda1495044758.ps tmp/3mcda1495044758.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.406 0.156 1.578