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(75.99,76.31,76.51,76.75,77.23,77.22,77.25,77.36,77.57,77.88,78.29,78.42,78.96,79.85,80.05,80.16,80.29,80.36,80.48,80.95,82.3,84.81,85.4,86.13,87.02,87.38,87.5,87.91,88.06,88.09,88.16,88.33,88.52,88.96,89.26,89.34,89.09,89.25,89.31,89.28,89.32,89.47,89.59,89.62,89.71,89.9,90.04,90.05,90.18,90.5,90.63,90.75,90.76,90.67,90.5,90.8,91.22,92.19,92.51,92.67,93.75,94.1,94.96,95.21,95.33,95.43,95.44,95.64,95.8,95.87,95.98,96.07,96.23,96.32,96.55,96.73,96.61,96.64,96.86,97.02,97.22,98.1,98.46,98.6,98.78,99.13,99.48,99.62,99.68,99.95,100.12,100.25,100.47,100.7,100.88,100.95,100.92,101.12,101.19,101.28,101.28,101.3,101.3,101.36,101.45,101.58,101.73,101.84,102.01,102.14,102.16,102.32,102.41,102.4,102.43,102.42,102.3,102.65,102.72,102.86) > 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/12lll1476802319.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/2tx551476802319.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/3qywg1476802319.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.0000000000 0.9745577134 0.9484227053 0.9216032945 0.8946257894 [6] 0.8675971158 0.8397601609 0.8112726051 0.7821776708 0.7527394997 [11] 0.7233938992 0.6941663216 0.6644618340 0.6352495249 0.6073547656 [16] 0.5794894458 0.5516143842 0.5236640646 0.4953318751 0.4666675790 [21] 0.4384251500 0.4123989788 0.3912058148 0.3708305077 0.3517233302 [26] 0.3338489283 0.3162456190 0.2986936856 0.2818916721 0.2652140242 [31] 0.2482589398 0.2312109325 0.2145003293 0.1978609250 0.1818825602 [36] 0.1665187861 0.1511860064 0.1346877924 0.1179472438 0.1012314533 [41] 0.0849139656 0.0683305584 0.0516510610 0.0350338750 0.0181094352 [46] 0.0007670066 -0.0162952535 -0.0331484174 -0.0504138795 > (mypacf <- c(rpacf$acf)) [1] 0.974557713 -0.026674054 -0.026863646 -0.016756747 -0.015008450 [6] -0.030494299 -0.027692672 -0.027154474 -0.022538296 -0.014470177 [11] -0.014293457 -0.026519933 -0.007378478 0.008964316 -0.017344983 [16] -0.018489676 -0.019331854 -0.026088293 -0.026238836 -0.011485283 [21] 0.024089375 0.077142726 -0.001628335 0.007709268 0.008415299 [26] -0.010883847 -0.017789431 -0.003890469 -0.016121182 -0.023449112 [31] -0.018667359 -0.010073900 -0.015398412 0.001027184 0.001418047 [36] -0.014501858 -0.038452588 -0.021336782 -0.019160877 -0.011421962 [41] -0.020521505 -0.012153664 -0.006400859 -0.018481426 -0.019905195 [46] -0.007442956 -0.011365505 -0.024308781 > 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/4cksq1476802319.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/5ohbi1476802319.tab") > > try(system("convert tmp/12lll1476802319.ps tmp/12lll1476802319.png",intern=TRUE)) character(0) > try(system("convert tmp/2tx551476802319.ps tmp/2tx551476802319.png",intern=TRUE)) character(0) > try(system("convert tmp/3qywg1476802319.ps tmp/3qywg1476802319.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.159 0.066 1.241