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(8899,8899,9093,9093,9093,9116,9116,9116,10073,10073,10073,9223,9223,9223,9151,9151,9151,6727,6727,6727,7232,7232,7232,6370,6370,6370,6862,6862,6862,7029,7029,7029,7031,7031,7031,7223,7223,7223,8065,8065,8065,7657,7657,7657,7328,7328,7328,7115,7115,7115,7926,7926,7926,8681,8681,8681,8670,8670,8670,8028,8028) > 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/11wcr1489690461.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/2dy7n1489690461.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/3h53o1489690461.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.0000000000 -0.0011159811 -0.0005696794 -0.1821300619 -0.0006062690 [6] -0.0006396869 0.2736985505 -0.0006762764 -0.0028521360 -0.4429653927 [11] -0.0028887255 -0.0028578701 0.1153046614 -0.0028944597 -0.0025535804 [16] -0.1411687366 -0.0025901700 0.0008610305 0.0807303872 0.0008244410 [21] 0.0006839010 -0.2151202723 0.0006473114 0.0006542219 0.1122486150 [26] 0.0006176323 -0.0002626802 -0.0099128902 -0.0002992697 -0.0005305484 [31] 0.1160881577 -0.0005671379 -0.0007984166 -0.1683540282 -0.0008350061 [36] -0.0017153186 -0.1163725743 -0.0017519081 -0.0017449977 -0.1173844747 [41] -0.0017815873 -0.0019221272 0.1389295950 -0.0019587168 0.0014924837 [46] 0.0670574721 0.0014558941 0.0017967734 0.0634057904 > (mypacf <- c(rpacf$acf)) [1] -0.0011159811 -0.0005709256 -0.1821316214 -0.0010676929 -0.0009170911 [6] 0.2487766874 -0.0003409469 -0.0029960458 -0.3971589291 -0.0051952662 [11] -0.0044322690 -0.0355081990 -0.0048083086 -0.0029728988 0.0741677230 [16] -0.0023559607 -0.0006245541 -0.1501271367 -0.0020462069 -0.0016037253 [21] -0.2287233038 -0.0041514792 -0.0036271532 0.1088038805 -0.0024474351 [26] -0.0014000764 0.0802207255 -0.0005874011 -0.0026121158 -0.1302376584 [31] -0.0041858187 -0.0038506955 -0.1659599879 -0.0062762037 -0.0040212217 [36] -0.1399958420 -0.0065036629 -0.0053522391 -0.1083340663 -0.0076329366 [41] -0.0095331527 0.0377224190 -0.0089201489 -0.0061252780 0.0296556081 [46] -0.0056480149 -0.0033899133 -0.0688360320 > 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/4w6mg1489690461.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/5tkuw1489690461.tab") > > try(system("convert tmp/11wcr1489690461.ps tmp/11wcr1489690461.png",intern=TRUE)) character(0) > try(system("convert tmp/2dy7n1489690461.ps tmp/2dy7n1489690461.png",intern=TRUE)) character(0) > try(system("convert tmp/3h53o1489690461.ps tmp/3h53o1489690461.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.569 0.135 1.748