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(103.75,103.89,104.01,104.28,104.34,104.48,104.56,104.71,104.79,104.87,104.95,105,105.05,105.57,105.98,106.45,107.13,107.87,108.56,109.04,109.98,110.4,110.99,111.23,111.76,112.18,112.88,113.54,114.11,114.8,115.56,116.03,116.98,117.65,118.12,118.6,119.03,119.82,120.76,121.4,122.12,123.08,123.86,124.46,125.14,125.89,126.32,126.93,127.48,128.28,129.11,130.23,131.04,132.2,133.12,134.48,135.74,136.88,138.12,139.99) > 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/1xeig1476826736.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/2ihcf1476826736.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/3d6co1476826736.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.6893492734 0.6564164595 0.5793373522 0.5314346229 [6] 0.3686474350 0.3590679553 0.2424407455 0.2448566278 0.1616788433 [11] 0.1492051079 0.1043595182 0.1216841563 0.0991132898 0.0975879250 [16] 0.0829066253 0.0467458831 0.0994839132 0.0904188801 0.0481139032 [21] 0.0287643081 0.0850878621 0.0214001743 -0.0021677574 0.0007877424 [26] 0.0014782629 -0.0267298808 0.0045366118 -0.1011193446 -0.0435532556 [31] -0.1011339451 -0.0935946082 -0.1001666663 -0.0756751411 -0.1169054595 [36] -0.0824137429 -0.1270548438 -0.0767854496 -0.0702687650 -0.0536376831 [41] -0.1290525881 -0.1250619545 -0.1312918111 -0.2009204928 -0.2549882594 [46] -0.2803965908 -0.2973129142 -0.3716656421 -0.3577039406 > (mypacf <- c(rpacf$acf)) [1] 0.689349273 0.345302734 0.097469031 0.053495446 -0.223329447 [6] 0.046314723 -0.095953153 0.100987346 -0.024578172 -0.006429716 [11] 0.011130736 0.030772867 0.058341429 -0.025573567 0.006114916 [16] -0.116986843 0.155957550 0.020029243 -0.082538304 -0.058718399 [21] 0.087254125 -0.038091197 -0.080877194 0.047842216 -0.025063616 [26] 0.018815820 0.048969090 -0.212662319 0.092111716 -0.103212967 [31] 0.040136057 0.064507625 -0.010900458 -0.023786046 -0.073044637 [36] -0.021715900 0.099041473 0.050787771 -0.071914929 -0.152959765 [41] -0.075596901 0.032403204 -0.119571508 -0.126794046 -0.053677456 [46] 0.016134495 -0.130337358 0.032333054 > 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/4hec51476826736.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/5ipta1476826736.tab") > > try(system("convert tmp/1xeig1476826736.ps tmp/1xeig1476826736.png",intern=TRUE)) character(0) > try(system("convert tmp/2ihcf1476826736.ps tmp/2ihcf1476826736.png",intern=TRUE)) character(0) > try(system("convert tmp/3d6co1476826736.ps tmp/3d6co1476826736.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.176 0.108 1.292