R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(88.52,90.15,88.63,88.32,88.51,88.53,88.35,88.4,88.41,88.47,88.46,89.28,89.11,90.74,89.49,88.62,89.09,89.14,89.45,89.33,89.44,89.54,89.52,90.48,90.04,91.93,91.25,89.27,90.57,90.79,90.83,90.76,91.29,91.48,91.63,92.63,91.7,93.86,92.45,92.03,92.71,93.15,92.98,92.73,93.29,93.2,93.34,93.95,93.43,95.67,94.02,93.51,94.6,94.27,94.05,94.1,94.51,94.53,94.2,93.58,94.94,96.24,95.77,94.41,95.09,95.37,95.17,95.05,95.33,95.42,95.95,96.12,96.94,98.73,98.03,97.42,98.39,98.77,98.46,98.3,98.25,98.33,98.61,98.99,98.8,100.26,100.85,98.87,99.81,100.44,100.07,99.8,99.77,99.9,100.58,100.86,101.05,101.3,101.45,101.13,101.38,101.03,100.79,100.84,101.17,101.36,101.14,101.24) > 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.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) 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) > 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/1xfr51445624252.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/2vjr41445624252.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/3psfu1445624252.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.96342886 0.94139227 0.92102447 0.89553020 0.87073577 [7] 0.84416816 0.81909758 0.79246006 0.76614033 0.73402161 0.70773934 [13] 0.69133598 0.65233254 0.62326607 0.60039593 0.57150177 0.54195992 [19] 0.51059196 0.48177342 0.45363285 0.42948869 0.39331983 0.36492563 [25] 0.34911355 0.31340584 0.28766172 0.26688510 0.23781800 0.21000702 [31] 0.18146304 0.15459994 0.12840248 0.10570808 0.07946290 0.05397446 [37] 0.04351456 0.01828765 0.00194060 -0.01163832 -0.03036234 -0.04681323 [43] -0.06215480 -0.07827945 -0.09416139 -0.10771694 -0.12791200 -0.14443868 [49] -0.15192960 > (mypacf <- c(rpacf$acf)) [1] 0.9634288640 0.1837911590 0.0530753189 -0.0665633398 -0.0282388693 [6] -0.0454230232 -0.0001545213 -0.0305261043 -0.0133249619 -0.1017248762 [11] 0.0351061738 0.1512034581 -0.2673133661 0.0147498432 0.0859496340 [16] -0.0452575829 -0.0575267161 -0.0517387303 0.0002089340 0.0007810198 [21] 0.0476335860 -0.1392631549 0.0065457740 0.1382759721 -0.1404720378 [26] 0.0189770502 0.0315444234 -0.1004359883 -0.0275667170 -0.0123219005 [31] -0.0188011512 -0.0245458643 0.0043089553 0.0640213269 -0.0728466830 [36] 0.0921554856 -0.0181704438 0.0254932776 -0.0220427586 -0.0317842927 [41] -0.0179118072 0.0008392931 -0.0174559015 -0.0258608291 -0.0436980707 [46] -0.0224018500 0.0170581619 -0.0102717636 > 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/4w34f1445624252.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/5bonx1445624252.tab") > > try(system("convert tmp/1xfr51445624252.ps tmp/1xfr51445624252.png",intern=TRUE)) character(0) > try(system("convert tmp/2vjr41445624252.ps tmp/2vjr41445624252.png",intern=TRUE)) character(0) > try(system("convert tmp/3psfu1445624252.ps tmp/3psfu1445624252.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.182 0.215 1.408