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(84.71,85.17,84.93,85.1,85.19,85.38,85.95,86.04,85.68,85.79,85.79,86.05,86.14,86.82,86.93,87.03,87.13,87.09,87.65,87.6,87.03,87.12,87.08,87.56,87.31,87.89,88.2,87.7,88.19,88.65,89.48,89.65,89.34,89.73,89.77,90.26,90.03,91.09,90.94,91.03,91.14,91.51,91.99,91.91,91.8,91.8,91.44,91.83,91.46,92.17,91.91,92.06,92.33,92.73,93.35,93.28,93.22,93.31,93.21,93.14,93.82,94.18,94.44,94.35,94.38,94.72,95.25,95.16,94.9,95.09,95.22,95.39,96.57,97.05,97.11,97.08,97.5,97.92,98.44,98.44,98.06,98.2,98.19,98.36,98.41,98.97,99.45,98.95,99.7,100.12,100.62,100.75,100.47,100.71,100.85,101.03,101.13,101.38,101.73,101.89,102.02,102.11,102.77,102.49,102.52,102.69,102.32,102.6) > 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.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/1e6oj1445592861.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/2yyzv1445592861.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/3pir71445592861.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.152060695 -0.043563567 -0.147526373 -0.056103350 [6] 0.139013847 -0.116563941 0.138724254 -0.102600322 -0.180122912 [11] -0.101605357 -0.046578420 0.532418782 -0.056866382 -0.072830225 [16] -0.264382696 0.071726503 0.069305779 -0.084370293 0.185117185 [21] -0.128238439 -0.140270611 -0.130098172 0.106680680 0.325018045 [26] 0.020025371 -0.073058734 -0.170944297 -0.014769685 0.044101912 [31] -0.019608557 0.044183867 0.002665935 -0.200320224 -0.087050936 [36] 0.065359024 0.280490426 0.042654497 -0.104792284 0.009570395 [41] -0.126441975 0.084992790 0.023750100 0.019712228 0.055675641 [46] -0.216240080 -0.027915773 0.079512271 0.241228136 > (mypacf <- c(rpacf$acf)) [1] -0.152060695 -0.068264464 -0.169679049 -0.118340474 0.092395486 [6] -0.122471845 0.098415481 -0.054917179 -0.228864263 -0.194941588 [11] -0.145348271 0.438586583 0.115658421 -0.049990766 -0.281791448 [16] 0.027047760 -0.031594669 -0.091306512 0.065352458 -0.017765026 [21] -0.081822048 -0.063778719 0.098663626 0.002063815 0.067146326 [26] -0.013266729 0.078415349 -0.143195260 -0.088216697 -0.056177080 [31] -0.118569415 0.103517557 -0.065183985 0.063609413 -0.175472721 [36] 0.077129667 -0.020571720 0.005672345 0.132229522 -0.095808463 [41] 0.028856783 -0.063754400 0.018219744 -0.021447457 0.048485597 [46] -0.038258504 0.198859487 0.023287989 > 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/4djc41445592861.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/583841445592861.tab") > > try(system("convert tmp/1e6oj1445592861.ps tmp/1e6oj1445592861.png",intern=TRUE)) character(0) > try(system("convert tmp/2yyzv1445592861.ps tmp/2yyzv1445592861.png",intern=TRUE)) character(0) > try(system("convert tmp/3pir71445592861.ps tmp/3pir71445592861.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.145 0.199 1.360