R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(1.6,2,2.6,3,2.6,2.9,2.5,2.4,1.5,1.1,0.6,0.9,1.1,1.5,1.7,1.2,0.4,-0.7,-1.4,-1.6,-1.2,-0.4,-0.2,-0.3,-0.5,0,-0.5,0.2,0.7,1.6,2.6,3.3,3.3,3.2,3.5,3.9,4.5,4.6,6.6,7.1,8.9,8.8,8.5,7.6,7.5,7.5,6.1,6.3,8.4,7.1,5.6,4.2,2.1,1.2,0.9,1.4,1.7,1.7,1.9,1.3,-0.7,0.3,0.8,0.9,1.1,2.5,2.7,3.3,4.2,3.8,3.8,3.2,2.9,1.9,1.7,1.6,1.7,1.2,0.7,-0.2,-1.5,-1.2,-1,0,-0.6,0.7,1.3,0.8,1,0.5,0.3,1,1,1.1,1.5,1.5,2,1.7,0.6,1.2,1.5,2.1,3.2,3.9,4.6,4.2,4.4,3.7,3.7,2.8,2.9,3.9,3.1,3,2.8,2.4,2.1,3.1,3,3.1,3.3,3.3,3.8,3.1,3.9,4,4.4,3.7,3.6,3.4,2.8,2.8,2.6,3.3,2.4,1.6,0.7,0,-1.1,-1.2,-1.3,-1.6,-1.3,-1.6,-1.1,-1,0.3,1.2,0.7,1.1,2.1,2.5,2.3,2.3,2.6,3.2,2.2,2.7,2.2,1.4,2.4,2,1.3,1.1,1.4,1.8,1.9,1.6) > 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/1edib1354017822.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/2hfjz1354017822.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/3tq8n1354017822.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.21750498 0.14977590 0.08291833 -0.04905378 -0.11715637 [7] -0.04220618 0.12163845 0.10644920 0.12724104 0.01655876 -0.02888446 [13] -0.43164841 -0.18538347 -0.14479582 -0.19845618 -0.13433765 0.01867530 [19] 0.11728088 -0.06723108 0.06897410 -0.09250498 -0.17567231 -0.09760956 [25] -0.09138446 0.03560757 0.06984562 0.19820717 0.12412849 0.09125996 [31] -0.05689741 -0.12885956 -0.11230080 -0.04793327 0.07495020 0.07295817 [37] 0.10358566 0.04892928 0.07183765 -0.11503984 -0.08441235 -0.04295319 [43] -0.13869522 0.11503984 -0.06337151 0.03759960 0.03486056 0.03461155 [49] -0.06411853 > (mypacf <- c(rpacf$acf)) [1] 0.2175049801 0.1075557734 0.0323374769 -0.0925531306 -0.1117150850 [6] 0.0159833432 0.1802207483 0.0778894511 0.0457356920 -0.0943290148 [11] -0.0562859635 -0.4313305501 0.0089925670 0.0197436967 -0.1027946912 [16] -0.1768995884 -0.0127993341 0.1556280017 0.0028848467 0.1447892074 [21] -0.0731027434 -0.1947117245 0.0002317713 -0.2120934196 0.1002670807 [26] 0.0387225269 0.0272067933 -0.1322818123 0.0301326369 0.0706854171 [31] -0.1966687195 0.0690635484 -0.0130371890 -0.0578862166 0.0022415066 [36] -0.1464005558 0.0414201018 0.0506225201 0.0106105855 -0.0890406244 [41] 0.0609868296 -0.0903094757 -0.0061686667 -0.1487125853 0.0126001735 [46] -0.0223866370 -0.0189717802 -0.1140088988 > 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/4y97g1354017822.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/5tuy61354017822.tab") > > try(system("convert tmp/1edib1354017822.ps tmp/1edib1354017822.png",intern=TRUE)) character(0) > try(system("convert tmp/2hfjz1354017822.ps tmp/2hfjz1354017822.png",intern=TRUE)) character(0) > try(system("convert tmp/3tq8n1354017822.ps tmp/3tq8n1354017822.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.759 0.398 2.153