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 = '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/101xv1489660200.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/2f6w51489660200.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/3d7ny1489660200.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.169591168 -0.025950139 0.051513836 -0.129818138 [6] 0.098418790 -0.010086126 0.121942006 -0.071800307 0.087020164 [11] 0.059836407 -0.227996685 0.172500254 -0.154309890 -0.042990378 [16] -0.012318218 -0.172352258 -0.007135530 -0.031664357 0.014453478 [21] -0.045125666 -0.015736628 -0.009317214 -0.211834116 0.146062549 [26] -0.106232862 0.032198440 0.163242988 -0.136874043 0.057123878 [31] -0.008425674 0.035537597 0.016894509 0.089354511 0.174168694 [36] -0.133943367 0.092534393 -0.096543184 0.066565549 0.099785292 [41] -0.037343316 0.030759653 -0.096382608 0.047600854 0.063955078 [46] -0.001815779 0.019269361 -0.063746902 0.003593443 > (mypacf <- c(rpacf$acf)) [1] -0.169591168 -0.056331462 0.038538892 -0.119422868 0.062009418 [6] 0.005739076 0.143953413 -0.052397107 0.105750494 0.071921077 [11] -0.177508138 0.083656503 -0.128789860 -0.079536874 -0.111039813 [16] -0.180720546 -0.127599743 -0.038617397 -0.059276849 -0.003492417 [21] -0.002058708 -0.013348810 -0.129140507 0.061822815 -0.070555520 [26] 0.029442943 0.096532793 -0.069752986 -0.010086161 -0.018833009 [31] -0.008468864 -0.011106207 0.069466860 0.137668866 -0.001867414 [36] -0.036881910 -0.091269678 0.064607120 -0.034961009 0.013922643 [41] -0.043180066 -0.089279593 -0.001544375 0.102984420 0.059217373 [46] 0.015537470 0.070722812 -0.018289942 > 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/482fu1489660200.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/59evn1489660200.tab") > > try(system("convert tmp/101xv1489660200.ps tmp/101xv1489660200.png",intern=TRUE)) character(0) > try(system("convert tmp/2f6w51489660200.ps tmp/2f6w51489660200.png",intern=TRUE)) character(0) > try(system("convert tmp/3d7ny1489660200.ps tmp/3d7ny1489660200.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.492 0.115 1.830