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(90.36,90.67,91.21,91.35,91.62,91.28,91.17,91.13,91.55,91.62,91.73,91.91,92.5,92.93,92.77,93.42,93.82,94.02,94.13,93.7,93.84,94.22,95.03,95.03,95.25,96.11,96.16,96.1,96.52,96.35,96.35,96.66,96.86,97.84,98.04,98.06,98.79,99.38,99.75,100.4,100.97,101.16,100.42,99.88,99.8,99.78,99.78,99.89,100.38,100.1,100.02,101.15,100.02,99.99,100.14,98.93,98.52,98.42,98.78,99.04,99.53,99.97,99.95,101.68,101.29,101.45,100.98,100.64,100.6,101.59,101.15,101.03) > 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/1mbfn1489660949.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/21m1z1489660949.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/3tb371489660949.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.957324672 0.914635363 0.871693263 0.829905603 [6] 0.790270758 0.746731033 0.698753778 0.651514633 0.606464058 [11] 0.567230074 0.525799368 0.486069497 0.446817066 0.409724026 [16] 0.371393174 0.334071664 0.299122349 0.262085622 0.224286491 [21] 0.185379639 0.142485554 0.106393195 0.075015254 0.038227920 [26] 0.001948718 -0.030204877 -0.064821145 -0.099575407 -0.132115189 [31] -0.170509704 -0.212413877 -0.250248275 -0.285033802 -0.310036193 [36] -0.330081908 -0.349065875 -0.362604941 -0.372140215 -0.381292987 [41] -0.381451873 -0.374672240 -0.365828372 -0.361250344 -0.361389779 [46] -0.359562124 -0.358246306 -0.356958252 -0.353326189 > (mypacf <- c(rpacf$acf)) [1] 0.957324672 -0.021970261 -0.025324116 -0.009106080 0.002967134 [6] -0.069087911 -0.078311298 -0.018519433 -0.002337188 0.038587410 [11] -0.052297476 -0.001532639 -0.015766500 -0.001301669 -0.051074684 [16] -0.019273197 0.004189887 -0.052279943 -0.039926772 -0.046765805 [21] -0.075084772 0.042135908 0.026298590 -0.099304504 -0.024123362 [26] 0.029308752 -0.070651035 -0.058834410 -0.011152159 -0.104854373 [31] -0.088127685 -0.001515046 -0.016890539 0.074368026 0.037106645 [36] -0.022717725 0.032732651 0.032412811 -0.051490176 0.056888053 [41] 0.078576083 -0.002181141 -0.072513112 -0.055906836 -0.002483531 [46] -0.049606877 -0.010465141 0.014411220 > 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/44g4u1489660949.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/53vky1489660949.tab") > > try(system("convert tmp/1mbfn1489660949.ps tmp/1mbfn1489660949.png",intern=TRUE)) character(0) > try(system("convert tmp/21m1z1489660949.ps tmp/21m1z1489660949.png",intern=TRUE)) character(0) > try(system("convert tmp/3tb371489660949.ps tmp/3tb371489660949.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.465 0.112 1.611