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(94.46,96.91,101.92,104.53,105.85,106.39,106.08,106.42,106.51,106.59,105.71,104.41,103.04,100.99,100.93,99.31,99.79,99.57,99.11,98.96,97.72,99.35,98.15,97.64,97.49,97.94,98.03,98.05,97.54,98.71,99.33,99.16,98.41,98.43,97.02,97.89,97.92,97.37,97.42,96.12,96.72,96.64,95.28,95.3,95.02,95.57,94.78,95.27,96.14,96.16,95.08,94.39,94.15,94.58,94.16,95.02,94.86,94.49,94.81,94.16,94.83,96.02,95.97,95.88,95.97,97.55,97.49,98.4,98.2,97.16,96.96,96.37,96.34,96.86,96.32,95.44,92.85,92.56,91.74,92.44,93.19,92.62,94.04,93.8,96.73,98.99,100.38,101.07,99.92,101.78,100.91,100.49,101.17,100.25,98.94,99.4,100.02,99.91,99.22,98.84,98.42,97.59,97.07,96.59,95.96,94.22,94.48,93.14,93.73,94.24,98.52) > 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/1wlg61476898370.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/2nnp31476898370.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/3byho1476898370.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.937757853 0.851957405 0.749368179 0.647316872 [6] 0.546373773 0.438419000 0.337211045 0.233198139 0.148732828 [11] 0.092193700 0.052587929 0.032677935 0.011034859 -0.002212304 [16] -0.011094608 -0.013764911 0.005395506 0.023941878 0.047161520 [21] 0.062469711 0.080868611 0.109942753 0.135032287 0.159943059 [26] 0.161921128 0.155590729 0.134018014 0.106027860 0.069203865 [31] 0.032041677 -0.003491954 -0.046121763 -0.087043812 -0.118844724 [36] -0.146557314 -0.165736394 -0.183076247 -0.206344894 -0.224037222 [41] -0.243998685 -0.251008113 -0.250544838 -0.251147139 -0.247199558 [46] -0.251029441 -0.250809462 -0.250746747 -0.241909453 > (mypacf <- c(rpacf$acf)) [1] 0.9377578532 -0.2274466323 -0.1572567681 -0.0126216846 -0.0468451321 [6] -0.1397995468 0.0031265760 -0.1063490756 0.0836925420 0.1389766020 [11] -0.0067123859 0.0516999544 -0.0915033608 0.0002754338 -0.0063135686 [16] -0.0076186985 0.1455118184 -0.0238297853 0.0287608732 -0.0135322624 [21] 0.0519721000 0.0861212978 -0.0331764924 -0.0202576222 -0.1213823413 [26] 0.0182662730 -0.0752616724 0.0014669172 -0.1052866226 0.0800569878 [31] 0.0087099166 -0.0626655371 0.0044854442 0.0031730038 -0.0466905614 [36] -0.0346513546 -0.0228047438 -0.1315488643 0.0613764540 -0.0801510484 [41] 0.0301529941 0.0482505164 -0.1007222316 0.0499604316 -0.1408019210 [46] -0.0127197984 -0.0317355632 0.0198468409 > 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/4jlo71476898370.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/5la6z1476898370.tab") > > try(system("convert tmp/1wlg61476898370.ps tmp/1wlg61476898370.png",intern=TRUE)) character(0) > try(system("convert tmp/2nnp31476898370.ps tmp/2nnp31476898370.png",intern=TRUE)) character(0) > try(system("convert tmp/3byho1476898370.ps tmp/3byho1476898370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.278 0.075 1.366