R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 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(100.55,100.41,100.54,100.66,100.86,100.88,100.88,101.37,101.84,102.25,102.58,102.59,102.59,101.95,101.94,102.18,102.47,102.5,102.5,102.87,103.08,103.47,103.65,103.68,99.76,99.13,99.19,99.37,99.61,99.65,99.66,99.98,100.38,100.92,101.16,101.19,101.52,101.14,101.38,101.46,101.52,101.53,100.79,101.2,101.28,101.59,101.75,101.76,103.03,102.97,103.11,103.17,103.17,103.2,102.17,102.22,102.18,102.44,102.61,102.63) > 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/1komx1483009143.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/2hhl51483009143.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/3q9s21483009143.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.854670853 0.668716578 0.482986597 0.328418058 [6] 0.202573440 0.079214182 -0.022713527 -0.110170589 -0.153392230 [11] -0.149893866 -0.138194138 -0.153133305 -0.181259951 -0.245809866 [16] -0.292638756 -0.316240905 -0.313057998 -0.302930996 -0.329787224 [21] -0.336408503 -0.322826878 -0.275381478 -0.209012404 -0.143591927 [26] -0.085155188 -0.045931183 -0.002800088 0.045486117 0.094922518 [31] 0.124662387 0.105939874 0.089742124 0.083069844 0.103646584 [36] 0.139475143 0.183210616 0.176087896 0.161595230 0.148540823 [41] 0.136307511 0.120130050 0.088990428 0.046304819 0.006400769 [46] -0.026283751 -0.047580557 -0.063503389 -0.080129677 > (mypacf <- c(rpacf$acf)) [1] 0.854670853 -0.229079948 -0.092738113 -0.005423880 -0.033254696 [6] -0.123833116 -0.025287619 -0.063452060 0.052034284 0.066858527 [11] -0.051669027 -0.139480313 -0.049208301 -0.198877443 -0.008532117 [16] -0.016352655 0.004084558 -0.049263448 -0.187919573 -0.007870984 [21] -0.037197639 -0.002227652 -0.004530161 0.003836327 0.002065703 [26] -0.058437110 0.003268055 -0.026287585 0.018812894 -0.030456922 [31] -0.157105283 0.082299083 -0.025832819 0.044669806 0.012197235 [36] 0.071029902 -0.160103534 0.026994991 -0.002564328 -0.052370763 [41] 0.003394825 -0.004778427 -0.048969922 0.083019446 -0.086576974 [46] -0.033576320 -0.058353229 0.017622785 > 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/4dc0n1483009143.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/5b5eb1483009143.tab") > > try(system("convert tmp/1komx1483009143.ps tmp/1komx1483009143.png",intern=TRUE)) character(0) > try(system("convert tmp/2hhl51483009143.ps tmp/2hhl51483009143.png",intern=TRUE)) character(0) > try(system("convert tmp/3q9s21483009143.ps tmp/3q9s21483009143.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.249 0.102 1.368