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(40927.00 + ,40856.00 + ,40778.00 + ,40635.00 + ,42103.00 + ,42032.00 + ,40927.00 + ,40194.00 + ,40265.00 + ,40265.00 + ,40336.00 + ,40486.00 + ,40856.00 + ,40414.00 + ,40856.00 + ,40486.00 + ,41661.00 + ,42181.00 + ,39973.00 + ,39381.00 + ,39894.00 + ,39823.00 + ,39381.00 + ,39453.00 + ,40336.00 + ,40194.00 + ,40336.00 + ,40336.00 + ,41298.00 + ,41440.00 + ,38790.00 + ,38790.00 + ,39823.00 + ,39310.00 + ,38427.00 + ,38790.00 + ,39674.00 + ,39232.00 + ,39161.00 + ,38206.00 + ,39602.00 + ,39894.00 + ,37023.00 + ,36952.00 + ,38427.00 + ,37615.00 + ,36218.00 + ,36810.00 + ,37465.00 + ,37615.00 + ,37173.00 + ,36290.00 + ,38128.00 + ,38128.00 + ,34893.00 + ,34673.00 + ,35556.00 + ,33939.00 + ,32314.00 + ,32835.00 + ,33939.00 + ,33055.00 + ,32464.00 + ,31210.00 + ,32906.00 + ,32977.00 + ,29743.00 + ,29664.00 + ,30256.00 + ,28418.00 + ,26430.00 + ,27235.00 + ,28339.00 + ,27164.00 + ,27093.00 + ,25910.00 + ,27826.00 + ,28197.00 + ,24585.00 + ,23780.00 + ,24293.00 + ,22305.00 + ,20246.00 + ,20909.00 + ,22156.00 + ,20688.00 + ,20909.00 + ,20026.00 + ,21864.00 + ,22084.00 + ,17668.00 + ,17375.00 + ,18180.00 + ,16050.00 + ,14134.00 + ,14797.00 + ,16414.00 + ,14504.00 + ,14355.00 + ,12880.00 + ,14504.00 + ,15017.00 + ,10451.00 + ,10451.00 + ,11113.00 + ,9347.00 + ,7359.00 + ,8392.00 + ,10230.00 + ,8242.00 + ,9055.00 + ,7950.00 + ,9717.00 + ,10308.00 + ,5592.00 + ,5229.00 + ,5963.00 + ,4196.00 + ,2800.00 + ,3384.00) > 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/1n10g1470929425.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/2juww1470929425.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/3twcs1470929425.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.00000000 -0.12102845 -0.53393972 0.22139723 0.32942673 -0.05983677 [7] -0.40755412 -0.04489044 0.32694355 0.18200352 -0.49354614 -0.08109548 [13] 0.86536533 -0.11781146 -0.50875423 0.21818722 0.31889281 -0.09246857 [19] -0.35771191 -0.02555222 0.29480336 0.13832251 -0.42660759 -0.05716860 [25] 0.73428234 -0.10701446 -0.45788805 0.21045714 0.27203897 -0.11866326 [31] -0.30999026 -0.01090295 0.24312784 0.09130537 -0.36312599 -0.04431494 [37] 0.60109569 -0.10323354 -0.39293093 0.19321508 0.23462006 -0.13118691 [43] -0.26398550 0.01265605 0.18514320 0.05591092 -0.30808224 -0.04656224 [49] 0.47758889 > (mypacf <- c(rpacf$acf)) [1] -0.121028455 -0.556742714 0.078560814 0.120759055 0.243786690 [6] -0.298236040 -0.254354567 -0.144817247 0.454970133 -0.238981291 [11] 0.055095599 0.675216191 0.124648684 0.124944708 -0.020258544 [16] -0.031312539 -0.098494291 0.129019909 0.030782815 -0.018788617 [21] -0.085813452 0.076271393 -0.040475883 0.013242396 -0.010782243 [26] 0.081905087 -0.013509475 -0.069608355 -0.088975485 -0.070466212 [31] -0.036641040 -0.047781584 -0.062484169 -0.074462302 -0.078739550 [36] -0.119171582 -0.068921792 -0.006510176 -0.010536017 0.047162552 [41] 0.005272080 -0.021913593 0.006991089 -0.026517359 0.021165429 [46] -0.032705842 -0.062019562 -0.115852032 > 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/4bsjk1470929425.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/5ecwc1470929425.tab") > > try(system("convert tmp/1n10g1470929425.ps tmp/1n10g1470929425.png",intern=TRUE)) character(0) > try(system("convert tmp/2juww1470929425.ps tmp/2juww1470929425.png",intern=TRUE)) character(0) > try(system("convert tmp/3twcs1470929425.ps tmp/3twcs1470929425.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.338 0.132 1.500