R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(293544,282672,298980,239184,309852,304416,326160,337032,375084,326160,309852,385956,326160,244620,288108,217440,304416,250056,331596,298980,315288,353340,347904,413136,298980,250056,277236,201132,288108,222876,315288,298980,266364,380520,342468,391392,293544,271800,244620,201132,266364,239184,326160,315288,271800,364212,337032,434880,347904,212004,212004,212004,250056,250056,337032,309852,277236,347904,320724,462060,364212,212004,222876,184824,255492,293544,369648,364212,293544,342468,304416,434880,331596,266364,239184,179388,266364,320724,375084,353340,260928,375084,293544,451188,375084,271800,250056,168516,266364,255492,385956,385956,293544,380520,282672,440316,375084,277236,212004,146772,288108,277236,364212,418572,309852,347904,260928,451188) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '48' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > 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/1vfex1377077370.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/2ox5e1377077370.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/3owdv1377077370.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.33666252 0.16905725 -0.23179385 -0.38278568 -0.13150358 [7] -0.33855635 -0.07743736 -0.35464083 -0.21790430 0.13326714 0.29163814 [13] 0.82222175 0.31966267 0.19079636 -0.21197686 -0.37862457 -0.12342631 [19] -0.30249947 -0.04399535 -0.27173381 -0.18108454 0.08735818 0.21648687 [25] 0.66566936 0.31637728 0.19246186 -0.18306308 -0.35035793 -0.14991405 [31] -0.27506762 -0.05108291 -0.20154335 -0.12951734 0.07878343 0.15858565 [37] 0.55652305 0.27727644 0.13592507 -0.14519105 -0.30542524 -0.16485147 [43] -0.27174131 -0.02770578 -0.12625996 -0.07366218 0.07088212 0.10835015 [49] 0.42218738 > (mypacf <- c(rpacf$acf)) [1] 0.336662520 0.062837726 -0.346809981 -0.279258418 0.207077515 [6] -0.405723303 -0.104223905 -0.444313821 -0.286190688 0.159992314 [11] 0.123630981 0.571131985 -0.098578314 -0.005205219 0.026664331 [16] -0.017875920 0.121990272 0.018679707 -0.015145064 0.166723489 [21] -0.017056543 -0.054663650 -0.002628757 -0.055507551 0.129475168 [26] -0.016448122 -0.066876401 0.058532151 -0.089156269 -0.003810126 [31] -0.113288553 -0.012498323 0.110422372 0.001264829 -0.085368564 [36] 0.075844136 -0.152473746 -0.135010592 0.083280592 -0.003349235 [41] -0.017895679 -0.100266328 0.062624878 0.056929005 -0.027335742 [46] -0.106975923 -0.058907510 -0.030832523 > 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/4uyno1377077370.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/5ghg31377077370.tab") > > try(system("convert tmp/1vfex1377077370.ps tmp/1vfex1377077370.png",intern=TRUE)) character(0) > try(system("convert tmp/2ox5e1377077370.ps tmp/2ox5e1377077370.png",intern=TRUE)) character(0) > try(system("convert tmp/3owdv1377077370.ps tmp/3owdv1377077370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.537 0.601 3.108