R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(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) > 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/fisher/rcomp/tmp/1yibr1363730657.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/fisher/rcomp/tmp/229ll1363730657.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/fisher/rcomp/tmp/3l23y1363730657.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.96691238 0.92073957 0.87875401 0.83668331 0.79810868 [7] 0.75303527 0.70219184 0.65207468 0.60297929 0.55276697 0.50091930 [13] 0.44537272 0.38709140 0.32976673 0.27389208 0.20817535 0.14038002 [19] 0.07466329 0.01814252 -0.02445660 -0.06442866 -0.10606110 -0.14738300 [25] -0.18031535 -0.20600513 -0.22844928 -0.24752258 -0.27080819 -0.29224308 [31] -0.31089065 -0.32980868 -0.34812566 -0.37100807 -0.38943275 -0.39158169 [37] -0.39200763 -0.39769271 -0.40374842 -0.39990446 -0.38648388 -0.36921914 [43] -0.35243523 -0.34036950 -0.32688381 -0.31089127 -0.29822951 -0.28214682 [49] -0.26774704 > (mypacf <- c(rpacf$acf)) [1] 0.966912385 -0.217884099 0.083523655 -0.060155785 0.049816342 [6] -0.159042186 -0.054482856 -0.017295424 -0.019907259 -0.065272556 [11] -0.044426400 -0.078511824 -0.062642939 -0.030169745 -0.029137618 [16] -0.218075686 -0.012299768 -0.054433552 0.103778186 0.086128994 [21] -0.014219790 -0.034378929 -0.024863504 0.093474795 -0.005856626 [26] -0.006898336 0.034976328 -0.106960564 0.016901639 -0.082212592 [31] -0.029598421 -0.080931470 -0.122410265 0.028195106 0.116608439 [36] -0.100604230 -0.086345643 0.024698533 0.171018813 0.018614551 [41] 0.010795298 -0.013789333 0.023998061 0.031330029 0.007371364 [46] -0.123121684 0.042551110 -0.048735931 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/417re1363730657.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/fisher/rcomp/tmp/5q97z1363730657.tab") > > try(system("convert tmp/1yibr1363730657.ps tmp/1yibr1363730657.png",intern=TRUE)) character(0) > try(system("convert tmp/229ll1363730657.ps tmp/229ll1363730657.png",intern=TRUE)) character(0) > try(system("convert tmp/3l23y1363730657.ps tmp/3l23y1363730657.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.785 0.285 2.049