R version 3.3.3 (2017-03-06) -- "Another Canoe" Copyright (C) 2017 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(97.96,98.36,98.36,98.51,98.77,98.78,98.89,98.87,99.05,99.09,99.1,99.12,99.37,99.46,99.6,99.87,99.88,100.01,100.02,100.19,100.2,100.35,100.47,100.57,101.41,101.67,101.82,101.86,101.98,102.06,102.17,102.2,102.35,102.47,102.55,102.62,102.81,102.88,102.94,102.95,102.94,103.05,103.09,103.1,103.14,103.19,103.36,103.43,103.62,103.79,103.9,103.92,103.94,103.98,104.04,104.09,104.16,104.22,104.28,104.32) > 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.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/1c9841495045252.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/2124s1495045252.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/3nq161495045252.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.073422744 0.101262487 0.030428948 -0.044609459 [6] -0.005632837 -0.153058258 -0.004528549 -0.062716922 0.135570094 [11] -0.036557804 0.118999194 0.150405614 -0.011103148 -0.072200233 [16] -0.161534114 -0.032378439 -0.107397071 -0.034243985 -0.211094495 [21] 0.090004156 0.040182374 -0.003216152 0.169039871 0.164171888 [26] 0.046813342 -0.039446436 -0.084389205 -0.094587429 -0.036211606 [31] -0.088719182 -0.041798433 -0.012434223 -0.008056530 -0.026540448 [36] -0.011529239 -0.014169846 -0.002603069 -0.023091445 -0.080762075 [41] -0.006113286 -0.024926187 -0.009790934 -0.026155340 -0.017596149 [46] 0.047925613 0.003056551 0.017192271 0.027491656 > (mypacf <- c(rpacf$acf)) [1] 7.342274e-02 9.639122e-02 1.688033e-02 -5.833553e-02 -3.645051e-03 [6] -1.453336e-01 1.915410e-02 -3.828876e-02 1.553596e-01 -6.569126e-02 [11] 1.132310e-01 1.092881e-01 -3.239496e-02 -1.336729e-01 -1.107656e-01 [16] -6.759840e-03 -3.495076e-02 -5.266978e-03 -2.030849e-01 1.018002e-01 [21] -6.257584e-03 -7.457741e-04 1.178367e-01 2.017793e-01 -5.457833e-02 [26] 1.410708e-02 -9.213565e-02 -2.291314e-02 -5.790452e-02 -1.496301e-02 [31] -7.348255e-05 -9.036617e-02 -1.012160e-01 -9.726850e-02 -4.514644e-02 [36] -7.280677e-02 8.370249e-02 2.464656e-02 6.816337e-02 -1.783491e-03 [41] 3.730230e-03 2.920352e-02 3.801799e-02 -8.227979e-02 6.549167e-02 [46] -6.691720e-02 -9.715735e-02 -5.135334e-02 > 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/4ye3a1495045252.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/5dul01495045252.tab") > > try(system("convert tmp/1c9841495045252.ps tmp/1c9841495045252.png",intern=TRUE)) character(0) > try(system("convert tmp/2124s1495045252.ps tmp/2124s1495045252.png",intern=TRUE)) character(0) > try(system("convert tmp/3nq161495045252.ps tmp/3nq161495045252.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.279 0.345 2.746