R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" 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(89.72,89.95,90.19,90.23,90.32,90.86,90.99,90.98,91.22,91.42,91.55,91.67,92.30,92.92,93.10,93.23,93.36,93.42,93.58,93.68,94.02,94.29,94.54,94.64,96.70,96.83,97.07,97.11,97.42,97.44,97.67,97.84,98.17,98.31,98.42,98.44,98.89,99.26,99.59,99.82,99.95,99.99,100.28,100.38,100.46,100.52,100.43,100.44,101.33,101.43,101.41,101.53,101.58,101.73,102.12,101.86,101.93,101.86,101.92,102.02) > 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/1v1ut1458041070.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/26z4v1458041070.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/3dvy81458041070.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.957466992 0.914738577 0.871588995 0.826064276 [6] 0.778510216 0.731451248 0.684509078 0.636385380 0.587429628 [11] 0.538491552 0.488009825 0.435793036 0.388784061 0.344148285 [16] 0.298147204 0.251183640 0.203193729 0.154692666 0.106672606 [21] 0.057300862 0.009278691 -0.036835194 -0.080883232 -0.123898078 [26] -0.153014132 -0.182313091 -0.210512542 -0.238978506 -0.264735029 [31] -0.290523220 -0.315096356 -0.338698381 -0.359267282 -0.379143322 [36] -0.397746857 -0.416638754 -0.422496675 -0.425751706 -0.425836524 [41] -0.423372095 -0.418744837 -0.413703241 -0.406087839 -0.397971368 [46] -0.388817569 -0.378688110 -0.368669541 -0.355605834 > (mypacf <- c(rpacf$acf)) [1] 0.9574669917 -0.0240756282 -0.0273719510 -0.0515997976 -0.0493099953 [6] -0.0205538439 -0.0248735916 -0.0409330978 -0.0393171320 -0.0310143016 [11] -0.0499376989 -0.0541102151 0.0272601434 -0.0038773727 -0.0482111659 [16] -0.0496917814 -0.0546273642 -0.0456593307 -0.0331714243 -0.0597856537 [21] -0.0310714627 -0.0237114212 -0.0232539798 -0.0383206679 0.1250997690 [26] -0.0362301220 -0.0271149648 -0.0533783490 -0.0182029384 -0.0425659944 [31] -0.0263362909 -0.0397802345 -0.0117070595 -0.0336503131 -0.0326334105 [36] -0.0566694931 0.1382032682 0.0046764844 0.0015158133 -0.0163939110 [41] -0.0148152563 -0.0314817287 0.0039270378 -0.0353912914 -0.0114188457 [46] -0.0136416152 -0.0302872000 -0.0009590113 > 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/4tkbr1458041070.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/5bpg11458041070.tab") > > try(system("convert tmp/1v1ut1458041070.ps tmp/1v1ut1458041070.png",intern=TRUE)) character(0) > try(system("convert tmp/26z4v1458041070.ps tmp/26z4v1458041070.png",intern=TRUE)) character(0) > try(system("convert tmp/3dvy81458041070.ps tmp/3dvy81458041070.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.148 0.199 1.359