R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 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(93.09,93.02,93.23,92.7,92.68,93.11,93.02,93.29,93.2,92.86,93.04,92.8,93.11,93.42,94.01,94.47,94.07,94.33,94.43,95.37,95.83,95.46,96,95.35,96.85,97.84,98.38,98.9,99.51,99.95,99.93,101.4,101.7,101.65,102.33,101.56,101.91,102.29,102.44,102.84,103.2,103.23,103.16,103.31,103.04,102.57,102.88,101.91,102.59,103.27,103.59,104.35,104.6,105.08,104.93,105.15,104.67,104.55,109.82,109.25) > 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/1hrmu1489659912.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/2pfxf1489659912.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/3sfh51489659912.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.93430578 0.86557416 0.83457406 0.79643290 0.75569586 [7] 0.71304983 0.66650638 0.61858634 0.57149797 0.52342645 0.47422513 [13] 0.43285431 0.39053668 0.34427652 0.30160191 0.25534145 0.20756068 [19] 0.15954418 0.10963930 0.06104640 0.01588292 -0.03002847 -0.07467181 [25] -0.11591364 -0.15445477 -0.19356217 -0.22832908 -0.26782336 -0.30051149 [31] -0.32374841 -0.34860219 -0.36618861 -0.37968006 -0.39325300 -0.40580888 [37] -0.41165973 -0.40831867 -0.40610632 -0.40186028 -0.40211941 -0.39702851 [43] -0.38629978 -0.37295228 -0.35890241 -0.35142759 -0.34332282 -0.33073620 [49] -0.31909062 > (mypacf <- c(rpacf$acf)) [1] 0.934305782 -0.057865552 0.261598555 -0.098279014 0.051759791 [6] -0.083833794 -0.031878798 -0.063364790 -0.028017259 -0.050640225 [11] -0.035493842 0.027995218 -0.046701067 -0.022488361 -0.017857755 [16] -0.068619911 -0.033835201 -0.068888088 -0.052964037 -0.044101577 [21] -0.021985540 -0.049737274 -0.015339685 -0.025688902 -0.013454242 [26] -0.041151302 -0.002233107 -0.100782557 0.037377961 -0.019295679 [31] -0.011558357 0.039206993 -0.013078586 0.005873177 -0.028215202 [36] 0.029251072 0.034249360 -0.012743157 0.016894609 -0.079244867 [41] 0.054526801 -0.040322799 0.055601136 -0.027160263 -0.052255205 [46] -0.016895325 -0.021544285 -0.025318086 > 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/4qxd01489659912.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/51hq91489659912.tab") > > try(system("convert tmp/1hrmu1489659912.ps tmp/1hrmu1489659912.png",intern=TRUE)) character(0) > try(system("convert tmp/2pfxf1489659912.ps tmp/2pfxf1489659912.png",intern=TRUE)) character(0) > try(system("convert tmp/3sfh51489659912.ps tmp/3sfh51489659912.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.229 0.122 1.373