R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" 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(16.68,16.68,16.69,16.61,16.58,16.6,16.6,16.62,16.62,16.6,16.63,16.66,16.66,16.65,16.5,16.39,16.34,16.35,16.35,16.38,16.36,16.38,16.39,16.41,16.41,16.41,16.45,16.41,16.44,16.47,16.47,16.49,16.54,16.62,16.69,16.72,16.72,16.71,16.89,16.93,16.91,16.93,16.93,16.93,16.95,16.93,16.95,16.95,16.95,16.95,16.92,16.91,16.9,16.96,16.96,16.95,16.92,16.87,16.87,16.88,16.88,16.86,16.88,16.88,16.88,16.88,16.88,16.87,16.92,16.94,17.03,17.02,17.02,17.02,16.99,17.03,16.98,16.89,16.89,16.9,16.89,16.96,16.97,16.97) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > par8 <- '' > par7 <- '0.95' > par6 <- 'White Noise' > par5 <- '12' > par4 <- '0' > par3 <- '0' > par2 <- '1' > par1 <- '60' > #'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/1hodo1384953143.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/2m8zi1384953143.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/3xfjq1384953143.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.000000000 0.975075769 0.939643711 0.902069769 0.865178891 [6] 0.828713389 0.788696380 0.744269612 0.697793056 0.650694034 [11] 0.605450710 0.556033414 0.503672378 0.448741083 0.391894692 [16] 0.340430007 0.284989639 0.231877745 0.180507555 0.137452912 [21] 0.100929214 0.066065624 0.030474275 -0.002321527 -0.028307700 [26] -0.046280710 -0.060399830 -0.073379012 -0.091950789 -0.112806641 [31] -0.131892590 -0.150474567 -0.166038708 -0.184138911 -0.200864889 [36] -0.219037387 -0.234433538 -0.252727530 -0.275861158 -0.290201666 [41] -0.299115470 -0.308211663 -0.318841973 -0.332470920 -0.347161208 [46] -0.361089538 -0.371171478 -0.371500350 -0.375254734 -0.378782331 [51] -0.382213634 -0.381149381 -0.375890457 -0.368624642 -0.359513328 [56] -0.346748213 -0.328848578 -0.306522984 -0.288003882 -0.268306445 [61] -0.248884693 > (mypacf <- c(rpacf$acf)) [1] 0.975075769 -0.226074905 -0.018177519 0.003888783 -0.018637818 [6] -0.099207208 -0.085794495 -0.034576625 -0.030778068 0.009611406 [11] -0.134091730 -0.052154547 -0.062896806 -0.063809470 0.080438545 [16] -0.175701503 0.062797692 -0.018451732 0.148010921 0.015537219 [21] -0.035827121 -0.039106914 0.041512237 0.112726878 0.024160391 [26] 0.016582653 -0.038106975 -0.143966712 -0.038978573 -0.079312119 [31] -0.048835007 -0.024651708 -0.075371726 0.002983086 -0.110976605 [36] 0.032605429 -0.141893537 -0.075090567 0.243372438 0.007903408 [41] -0.003909025 -0.065316660 0.050560128 -0.027997473 -0.031643072 [46] 0.034842516 0.129944869 -0.087486133 -0.030350675 -0.001915356 [51] -0.031969217 -0.060226320 0.016551235 -0.025278919 0.082200556 [56] 0.057362536 0.037422269 -0.107682758 0.040789995 -0.061338815 > 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/4t91y1384953143.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/536hb1384953143.tab") > > try(system("convert tmp/1hodo1384953143.ps tmp/1hodo1384953143.png",intern=TRUE)) character(0) > try(system("convert tmp/2m8zi1384953143.ps tmp/2m8zi1384953143.png",intern=TRUE)) character(0) > try(system("convert tmp/3xfjq1384953143.ps tmp/3xfjq1384953143.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.321 0.488 2.781