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(91.46,92.17,91.91,92.06,92.33,92.73,93.35,93.28,93.22,93.31,93.21,93.14,93.82,94.18,94.44,94.35,94.38,94.72,95.25,95.16,94.9,95.09,95.22,95.39,96.57,97.05,97.11,97.08,97.5,97.92,98.44,98.44,98.06,98.2,98.19,98.36,98.41,98.97,99.45,98.95,99.7,100.12,100.62,100.75,100.47,100.71,100.85,101.03,101.13,101.38,101.73,101.89,102.02,102.11,102.77,102.49,102.52,102.69,102.32,102.6,103.03,103.7,103.17,103.88,104.09,104.32,104.88,105.06,104.66,105.41,105.41,105.48) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '1' > par2 <- '1' > par1 <- '60' > #'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/1u5001489961561.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/2yab51489961561.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/3fa9u1489961561.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.140794055 -0.170183679 -0.051305664 -0.088854516 [6] 0.014257852 0.097755692 -0.023034571 -0.190462669 -0.053907694 [11] -0.111538556 0.002984807 0.344746986 0.123384222 -0.145499742 [16] -0.210146836 0.078677995 0.037066759 0.008664060 0.064290053 [21] -0.101453909 -0.071470475 -0.198993638 0.225856434 0.197618375 [26] 0.019912797 0.006074588 -0.148894146 -0.007915418 0.113524081 [31] -0.050098893 -0.087841192 0.002563303 -0.077848891 -0.124449088 [36] 0.019196873 0.216965841 0.102331601 -0.174186130 0.080446191 [41] -0.039170263 0.027036416 0.114742136 -0.074901540 -0.098907834 [46] 0.065543237 -0.069435014 0.003670298 0.111135494 0.015075618 [51] -0.100175610 0.056410689 -0.047391074 0.026163852 -0.014083593 [56] 0.021768519 -0.048464285 0.013556211 -0.028012179 -0.027224455 [61] 0.116931104 > (mypacf <- c(rpacf$acf)) [1] -0.140794055 -0.193849314 -0.113642634 -0.162001540 -0.070977247 [6] 0.032811435 -0.029907933 -0.207807086 -0.156170067 -0.272361747 [11] -0.234193100 0.149564094 0.192792974 0.028893660 -0.218721229 [16] -0.049282263 -0.077787015 -0.164386613 -0.041268193 0.016474888 [21] 0.038431130 -0.290741021 0.052602382 0.106341828 -0.073729336 [26] 0.038315307 0.117391430 0.069440945 -0.008690485 -0.129539616 [31] -0.070067233 -0.057642452 -0.064886301 0.064510969 -0.135313139 [36] -0.049813069 0.030506572 -0.182747862 0.047360721 -0.088978069 [41] -0.002904122 0.048775926 -0.018026632 -0.092941763 0.069117708 [46] 0.007086671 0.097093227 0.023646942 -0.079571477 -0.053826915 [51] 0.085035436 -0.137325300 -0.030199961 0.040554721 0.034325027 [56] 0.019779115 0.040832464 0.021384106 0.002565367 -0.058339547 > 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/4i8r61489961561.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/570vx1489961561.tab") > > try(system("convert tmp/1u5001489961561.ps tmp/1u5001489961561.png",intern=TRUE)) character(0) > try(system("convert tmp/2yab51489961561.ps tmp/2yab51489961561.png",intern=TRUE)) character(0) > try(system("convert tmp/3fa9u1489961561.ps tmp/3fa9u1489961561.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.455 0.105 1.588