R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(86.48,86.48,86.7,87.86,88.24,88.23,88.73,88.82,87.16,86.29,86.37,86.59,85.46,85.85,86.93,87.66,87.84,88.09,88.58,88.06,88.26,89,90.78,90,89.84,89.82,91.12,91.5,93.03,94.23,94.76,92.83,92.49,90.85,88.19,86.31,85.74,86.62,86.66,87.39,87.59,88.8,88.64,89.55,89.04,88.49,89.5,89.46,90.33,90.27,91.5,92.53,93.14,93.01,92.84,92.88,93.05,93.17,93.67,94.9,95.72,96.08,97.52,98.26,98.48,98.09,98.03,98.14,98.71,98.69,98.72,98.47,99.49,99.84,100.9,101.31,100.09,99.28,99.57,101.04,101.87,101.39,100.3,99.95,99.87,100.51,100.27,100.04,99.23,99.32,99.95,100.23,101.02,99.83,99.61,100.12,99.83,100.03,100.07,100.46,100.43,100.68,101.8,101.21,100.63,100.55,99.76,98.8) > 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.291 () > #Author: root > #To cite this work: Wessa P., (2012), (Partial) Autocorrelation Function (v1.0.11) 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) > 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/1hucq1445447794.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/2615m1445447794.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/3cnlf1445447794.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.34337178 0.08630504 -0.06541997 0.01100008 -0.14721297 [7] -0.16387645 -0.03895598 -0.11260823 -0.13413390 0.04271742 0.27761463 [13] 0.09387103 -0.04203967 -0.16050159 -0.03487287 -0.08738122 -0.09964532 [19] -0.09161742 -0.03500938 -0.08876227 0.01518764 0.18513769 0.17182220 [25] 0.04847932 -0.02223822 0.02294100 -0.06863080 -0.12077831 -0.07473819 [31] -0.01426019 -0.07871022 -0.02997096 0.04122524 0.01233162 -0.01033852 [37] 0.01982722 0.02770600 -0.04062785 -0.07709880 -0.01407665 -0.03798580 [43] 0.04308366 -0.03475429 -0.02084385 -0.05365020 0.04124298 -0.02462796 [49] 0.00854078 > (mypacf <- c(rpacf$acf)) [1] 0.3433717815 -0.0358227951 -0.0951409642 0.0766161763 -0.1924899652 [6] -0.0753832847 0.0828188673 -0.1833941051 -0.0604737077 0.1656477659 [11] 0.1857520062 -0.1234278824 -0.0592551348 -0.1696325762 0.0483925732 [16] 0.0068799532 -0.0961673557 -0.0654227378 0.0474785769 -0.0859868382 [21] 0.0434709079 0.0893085096 -0.0115252462 0.0213031862 0.0345201812 [26] -0.0550771046 -0.0650806016 -0.0469436094 0.0106659855 0.0248811269 [31] -0.0427378212 -0.0323545556 -0.0355495718 -0.1112471566 0.0367780989 [36] 0.0561482756 -0.0550230927 -0.0140105253 -0.0133575345 -0.0006962439 [41] -0.0653502557 0.1212418466 -0.1354565326 -0.0445208366 -0.0192098148 [46] 0.0262346275 -0.1308190295 0.0214051645 > 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/485831445447794.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/5rhhe1445447794.tab") > > try(system("convert tmp/1hucq1445447794.ps tmp/1hucq1445447794.png",intern=TRUE)) character(0) > try(system("convert tmp/2615m1445447794.ps tmp/2615m1445447794.png",intern=TRUE)) character(0) > try(system("convert tmp/3cnlf1445447794.ps tmp/3cnlf1445447794.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.265 0.226 1.489